Page updated Jan 16, 2024

Record events

Recording Custom Events

To record custom events call the record method:

1Analytics.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:

2 name: 'albumVisit',
3 // Attribute values must be strings
4 attributes: { genre: '', artist: '' }

Record Engagement Metrics

Data can also be added to an event:

2 name: 'albumVisit',
3 attributes: {},
4 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.

2 name: 'albumVisit',
3 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.