Apxor Web Analytics
npm install apxor``bash`
npm install --save apxor
Import Apxor sdk and initialize it in application root component or page
`javascript
import Apxor from "apxor"; // ES6
//var Apxor = require('apxor'); // ES5
Apxor.init("YOUR_SITE_ID", {
// Configuration options
});
`
- honorDNT: _boolean_ [false],
- idle_time_out: _number(seconds)_ [1800]
- plugins: []
- deps: []
- version: _string_ [ALL]
> Note:
>
> Contact support@apxor.com to get your unique SITE_ID
- Run the following command in your terminal
`bash`
npm install --save apxor-qe apxor-rtm
- Add the following import statements in your root component or page. Make sure you add lint ignore lines for both of these lines, if you use lint
`javascript`
import CE from "apxor-qe";
import ApxorRTM from "apxor-rtm";
- Add the following value in Configuration option's plugin and deps array
`javascript`
Apxor.init("YOUR_SITE_ID", {
// ...
plugins: ["ApxorRTM"],
deps: [ApxorRTM, CE],
// ...
});
A unique user identifier that you can assign to the user
Usage:
`javascript`
Apxor.setUserId(String);
Example:
`javascript`
Apxor.setUserId("user@example.com");
---
You can log a page view event when users navigate through your website
Usage:
`javascript`
Apxor.logPageView(String); //String URL pathname
Example:
`javascript`
Apxor.logPageView("/about.html");
---
Usage:
`javascript`
Apxor.logEvent(eventName, eventProperties);
Example:
`javascript`
Apxor.logEvent("ADD_TO_CART", {
userId: "user@example.com",
value: 1299,
item: "Sony Head Phone 1201",
});
---
Usage:
`javascript`
Apxor.setUserProperties({
userProperty1: "value1",
userProperty2: "value2",
});
Example:
`javascript`
Apxor.setUserProperties({
gender: "Male",
age: 24,
isPaidUser: true,
creditsLeft: 250,
});
---
Usage:
`javascript`
Apxor.setSessionProperties({
property1: "value1",
property2: "value2",
});
Example:
`javascript`
Apxor.setSessionProperties({
language: "en",
location: "Hyderabad",
});
---
Use this API to get the unique identifier that Apxor SDK generates for this user
Example:
`javascript`
const clientId = Apxor.getClientId();
---
Starts new session if there is no active session. If a session is already in progress, it acts as a no-op
`javascript`
Apxor.startNewSession();
---
Ends the active session if any active session in progress. After this call, none of the Apxor APIs work, except startNewSession() API.
`javascript`
Apxor.endSession();
---
For single page applications built with React/Angular/Vue, you need to handle the internal redirection on your own by using the setRedirectionHandler method.
#### Example
`javascript``
Apxor.setRedirectionHandler((url) => {
// Interpret the URL and redirect user to the specific URL
});