Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.

Page updated Apr 29, 2024

NewDeploy web apps with Git or your AI coding agent using the latest AWS Amplify. Add managed databases and authentication as you grow. Explore the documentation.
Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade.
JavaScript v5Amplify JavaScript v5 has entered maintenance mode. We recommend upgrading to v6. A migration guide is available to help you upgrade from v5 to v6.

Record events

These docs cover Amplify Gen 1. For new web apps, we recommend the latest AWS Amplify, with a simplified CLI and native integrations for databases, storage, and AI models. Get started with the latest AWS Amplify.

AWS will end support for Amazon Pinpoint on October 30, 2026,, and is no longer accepting any new users as of May 20 (see the linked doc). The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics.

Recording Custom Events

To record custom events call the record method:

Analytics.record({ name: 'albumVisit' });

Record a Custom Event with Attributes

The record method lets you add additional attributes to an event. For example, to record artist information with an albumVisit event:

Analytics.record({
name: 'albumVisit',
// Attribute values must be strings
attributes: { genre: '', artist: '' }
});

Record Engagement Metrics

Data can also be added to an event:

Analytics.record({
name: 'albumVisit',
attributes: {},
metrics: { minutesListened: 30 }
});

Metric values must be a Number type such as a float or integer.

Record Events Immediately

The Amazon Pinpoint & Kinesis providers send events in batches to optimize network bandwidth. However, events can be sent immediately using the immediate flag.

Analytics.record({
name: 'albumVisit',
immediate: true
});

The AWS Pinpoint event count updates in minutes after recording your event.

However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Pinpoint.