Event tracking
Set custom identifier for events
This method sets a custom identifier in the parameters of every event.
You can pass a custom identifier to match your customers in our database.
Declared In:
lib/main/modules/TrackerModule.js
Class:
TrackerModule
Declaration:
public setCustomIdentifier(identifier: string)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
identifier | string | yes | - | Customer’s custom identifier |
Return Value:
No value is returned.
Example:
Synerise.Tracker.setCustomIdentifier("CUSTOM_IDENTIFIER");
Set custom email for events
This method sets a custom email in the parameters of every event.
You can pass a custom email to match your customers in our database.
Declared In:
lib/main/modules/TrackerModule.js
Class:
TrackerModule
Declaration:
public setCustomEmail(email: string)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
string | yes | - | Customer’s custom email |
Return Value:
No value is returned.
Example:
Synerise.Tracker.setCustomEmail("CUSTOM_EMAIL");
Send event
This method sends an event.
DO NOT send transaction.charge
events as custom events.
Transactions must be tracked with these endpoints:
/v4/transactions
(single transaction)/v4/transactions/batch
(multiple transactions)
- The tracker caches and enqueues all your events locally, so they all will be sent eventually.
- The API key must have the
API_BATCH_EVENTS_CREATE
permission from the Events group.
Declared In:
lib/main/modules/TrackerModule.js
Related To:
Event
CustomEvent
Class:
TrackerModule
Declaration:
public send(event: Event)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | Event | yes | - | Event object |
Return Value:
No value is returned.
Example:
let parameters = {
"name": "John",
"surname": "Rise",
"company": "Synerise",
"age": 25,
"lastOrder": 380.50
};
let event = new CustomEvent("label", "my.action", parameters);
Synerise.Tracker.send(event);
Flush events from Tracker
This method forces sending the events from the queue to the server.
API_BATCH_EVENTS_CREATE
permission from the Events group.Declared In:
lib/main/modules/TrackerModule.js
Class:
TrackerModule
Declaration:
public flushEvents(onSuccess: () => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
Return Value:
No value is returned.
Example:
Synerise.Tracker.flushEvents(function() {
// success
});