Record events
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});