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:
1Analytics.record({2 name: 'albumVisit',3 // Attribute values must be strings4 attributes: { genre: '', artist: '' }5});
Record Engagement Metrics
Data can also be added to an event:
1Analytics.record({2 name: 'albumVisit',3 attributes: {},4 metrics: { minutesListened: 30 }5});
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.
1Analytics.record({2 name: 'albumVisit',3 immediate: true4});