Initializing the JavaScript Library
Using the init method
The init
function is available under the xo
, xo.activity
and xo.search
namespace.
Example :
xo.init({activity: {activityOptions}, search: {searchOptions}})
xo.activity.init({activityOptions})
xo.search.init({searchOptions})
Even if the library is called xo it's used for both FHR & XO
The activityOptions
parameters are:
trackerKey
: your unique trackerKey to enable the tracking functions.region
: the region in which your data is stored: currently only EU is available, and that's the region enabled by default.storage
: optional, used to define custom storage.
The searchOptions
parameters are:
token
: your unique Search token, available in your Console at this address.region
: the region in which your data is stored. Available regions are listed below, and the default is EU.
Supported regions | Code |
---|---|
Europe (default) |
|
United States |
|
Important! To prevent possible loss of data, you should always initialize the client and identify the user before sending activities.
Once you have initialized the library, you can move on to identifying the user by following the link below.
pageManaging identitiesUsing custom storage
When the library is initialized, a default storage is defined. (localStorage for the browser version, or as a variable for the nodeJs version).
To use custom storage you may use the storage
option as described below.
This parameter takes an object with the same methods as the localStorage
api (see localStorage documentation) so 4 methods:
Method | description |
---|---|
| The |
| Return the |
| Remove key and value from storage |
| Clear storage |
All key
, and value
must be String.
Last updated