APXOR Cordova API Guide
APIs
Add the following after your import statements in every component where you use Apxor APIs
declare var ApxorSDK: any;
UserId
Sets a unique user identifier. You can set it when user logged into application and reset it when users logged out
// Syntax
ApxorSDK.setUserIdentifier("STRING");
// Example
ApxorSDK.setUserIdentifier("<unique_user_id>");
To track events
// Syntax
ApxorSDK.logAppEvent(event_name, properties[, isAggreagte]);
// Example
ApxorSDK.logAppEvent("ADD_TO_CART", {
"userId": "johnwick@example.com",
"value": 1299,
"item": "Sony Head Phone 1201"
}[, false]);
To track client events
// Syntax
ApxorSDK.logClientEvent(event_name, properties);
// Example
ApxorSDK.logClientEvent("ADD_TO_CART", {
userId: "johnwick@example.com",
value: 1299,
item: "Sony Head Phone 1201",
});
User Attributes
Set unique user properties only when you need to add or update them. All the properties whose value is null
or undefined
will be ignored
// Syntax
ApxorSDK.setUserCustomInfo(properties);
// Example
ApxorSDK.setUserCustomInfo({
Age: 10,
Name: "John Wick",
});
Session Attributes
A Session can be simply defined as user journey as he opens the app, until he closes the app. There can be various pieces of information that be very impactful when accumulated in a session. For example, location in a session can be useful to know exactly where, the user is utilizing the app most.
To add session attributes that are specific to a session,
ApxorSDK.setSessionCustomInfo({network: "4G", city: "Newyork"});
Track Screens
You can track time spent in tabs/components inside your application
ApxorSDK.trackScreen("CartPage");
Note
You can check the typings or APIs exposed by exploring
plugins/cordova-plugin-apxor-sdk/www/ApxorCordovaPlugin.js
orplugins/cordova-plugin-apxor-sdk/src/ApxorSDK.d.ts