Skip to content

Latest commit

 

History

History
110 lines (70 loc) · 2.92 KB

File metadata and controls

110 lines (70 loc) · 2.92 KB

sendx.EventsApi

All URIs are relative to https://api.sendx.io/api/v1/rest

Method HTTP request Description
trackCustomEvent POST /events/custom Track custom event
trackRevenueEvent POST /events/revenue Track revenue event

trackCustomEvent

EventResponse trackCustomEvent(customEventRequest)

Track custom event

Records custom events for advanced tracking.

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.EventsApi();
let customEventRequest = {"identifier":"user@example.com","name":"video_watched","data":{"video_id":"12345","duration":"120","completed":"true"},"time":1669990400}; // CustomEventRequest | 
apiInstance.trackCustomEvent(customEventRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
customEventRequest CustomEventRequest

Return type

EventResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

trackRevenueEvent

EventResponse trackRevenueEvent(revenueEventRequest)

Track revenue event

Records revenue events for analytics and attribution.

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.EventsApi();
let revenueEventRequest = new sendx.RevenueEventRequest(); // RevenueEventRequest | 
apiInstance.trackRevenueEvent(revenueEventRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
revenueEventRequest RevenueEventRequest

Return type

EventResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json