Skip to content

Latest commit

 

History

History
99 lines (77 loc) · 1.39 KB

README.md

File metadata and controls

99 lines (77 loc) · 1.39 KB

Apxor Web SDK

Install through NPM

npm i -s apxor

Import and initialize SDK in root of your application

import Apxor from 'apxor'; //ES6
//var Apxor = require('apxor'); //ES5

Apxor.init('YOUR_SITE_ID', {
    debug: true //remove this option in production
});

APIs:

import Apxor from 'apxor';
UserId
Apxor.setUserId(String);

Eg:

Apxor.setUserId("[email protected]");

PageView:
Apxor.logPageView(location.pathname); //String URL pathname

Eg:

Apxor.logPageView("/about.html");

Events:
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");

User Properties:
Apxor.setUserProperties({
    "property1": "value",
    "property2": "value2"
});

Eg:

Apxor.setUserProperties({
    "gender": "male",
    "age": "24"
});

Session Properties:
Apxor.setSessionProperties({
    "property1": "value",
    "property2": "value2"
});

Eg:

Apxor.setSessionProperties({
    "language": "en",
    "location": "Hyderabad"
});