Event tracking
Get customer’s events
This method retrieves events for an authenticated customer.
This method requires customer authentication.
Method name:
Client.getEvents(clientEventsQuery)
Declaration:
public static IDataApiCall<List<ClientEventData>> getEvents(ClientEventsQuery clientEventsQuery)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientEventsQuery | ClientEventsQuery | yes | - | Object to create clientEvent query |
Return Value:
IDataApiCall<List<ClientEventData» object to execute the request.
Example:
private IDataApiCall<List<ClientEventData>> getEventClientsCall;
if (getEventClientsCall != null) getEventClientsCall.cancel();
getEventClientsCall = Client.getEvents(clientEventsQuery);
getEventClientsCall.execute(({ this.onSuccess() }), ({ this.onFailure() });
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.
Method name:
Tracker.setCustomIdentifier(customIdentifier)
Declaration:
public static void setCustomIdentifier(String customIdentifier)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
customIdentifier | String | yes | - | Client’s custom identifier |
Return Value:
Void type method.
Example:
Tracker.setCustomIdentifier(customIdentifier)
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.
Method name:
Tracker.setCustomEmail(customEmail)
Declaration:
public static void setCustomEmail(String customEmail)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
customEmail | String | yes | - | Customer’s email |
Return Value:
Void type method.
Example:
private void setCustomEmail(String customEmail) {
Tracker.setCustomEmail(customEmail);
}
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.
It also supports Android O’s Background Execution Limits.
Method name:
Tracker.send(event)
Declaration:
public static void send(Event event)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | Event | yes | - | Event object (e.g. CustomEvent() instance). |
Return Value:
Void type method.
Example:
Tracker.send(new CustomEvent("my.action", "label"));
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.Method name:
Tracker.flush()
Declaration:
public static void flush()
Parameters:
No parameters required.
Return Value:
Void type method.
Example:
Tracker.flush();