npm i -s apxor
import Apxor from 'apxor'; //ES6
//var Apxor = require('apxor'); //ES5
Apxor.init('YOUR_SITE_ID', {
debug: true //remove this option in production
});
import Apxor from 'apxor';
Apxor.setUserId(String);
Eg:
Apxor.setUserId("[email protected]");
Apxor.logPageView(location.pathname); //String URL pathname
Eg:
Apxor.logPageView("/about.html");
Apxor.logEvent(name, properties, [category]); //All Strings
Eg:
Apxor.logEvent("ADD_TO_CART", {
"userId": "[email protected]",
"value": "1299",
"item": "Sony Head Phone 1201"
}, "PRODUCT_PURCHASE");
Apxor.setUserProperties({
"property1": "value",
"property2": "value2"
});
Eg:
Apxor.setUserProperties({
"gender": "male",
"age": "24"
});
Apxor.setSessionProperties({
"property1": "value",
"property2": "value2"
});
Eg:
Apxor.setSessionProperties({
"language": "en",
"location": "Hyderabad"
});