Amplify CLI Analytics Plugin

4.4.2 · active · verified Wed Apr 22

This package is an internal plugin for the AWS Amplify Command Line Interface (CLI) that enables developers to integrate analytics capabilities into their full-stack applications. It simplifies the provisioning and management of AWS analytics services, primarily Amazon Pinpoint and (for the Amplify JavaScript library) Amazon Kinesis, within an Amplify project. As of `npm@4.4.2`, it operates within the larger `@aws-amplify/cli` ecosystem, which is currently at `v14.3.0`. The Amplify CLI project maintains a frequent release cadence, with various component packages receiving updates multiple times per month. Key differentiators include its deep integration with the Amplify ecosystem, providing a streamlined, guided CLI workflow for adding, updating, and removing analytics backend resources, abstracting away direct AWS SDK calls or complex CloudFormation template management for user engagement and tracking services. It leverages Cognito Identity Pools for user identification, supporting both authenticated and unauthenticated analytics data collection.

Common errors

Warnings

Install

Quickstart

Demonstrates initializing an Amplify project and adding analytics via the CLI.

nvm install 20 # Ensure Node.js v20+ for Amplify CLI v14+
npm install -g @aws-amplify/cli@latest

amplify configure # Set up your AWS credentials if not already done

mkdir my-amplify-analytics-app
cd my-amplify-analytics-app

amplify init \
  --amplify-config '{"projectName":"myAnalyticsApp","envName":"dev","defaultEditor":"code"}' \
  --frontend 'javascript' \
  --framework 'react' \
  --provider 'awscloudformation'

amplify add analytics
# Follow the CLI prompts:
# ? Select an Analytics provider: Amazon Pinpoint (or Kinesis if preferred)
# ? Provide your pinpoint resource name: myAnalyticsAppPinpoint
# ? Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated users to send analytics events? (we recommend you allow this when getting started): Yes

amplify push
# Confirm the changes: ? Are you sure you want to continue? Yes
# The CLI will provision the backend resources, including Pinpoint/Kinesis and associated IAM roles.

view raw JSON →