track
Track an event in the user session.
This method tracks an event for analytics and personalization purposes.
It is a shorthand for calling the tracker.track method.
Signature
This method has the following signature:
croct.track(event: string, payload: EventPayload): Promise<Event>
The return is a Promise that resolves to the tracked event after successful transmission.
Example
Here is a basic example of how to use this method:
import croct from '@croct/plug';croct.track('goalCompleted', {goalId: 'newsletter-sign-up'});
Parameters
The following list describes the supported parameters:
- eventstring
The name of the event to track.
For a list of supported events, see the Event reference.
- payloadobject
The payload of the event for the specified event type.
For more information about the payload structure, see the Event reference.