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("user@example.com");Apxor.logPageView(location.pathname); //String URL pathnameEg:
Apxor.logPageView("/about.html");Apxor.logEvent(name, properties, [category]); //All StringsEg:
Apxor.logEvent("ADD_TO_CART", {
"userId": "user@example.com",
"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"
});