Configure products and send data¶
You can use oa
commands anywhere on your page after the snippet is
installed. There are two main commands that you should use initially: configure
to configure properties, and track
to send data.
Initialize products with configure
¶
Use the configure
command to initialize and configure settings for a particular
account. The config command takes the following format:
oa.configure('<api token>', null, null, (scope) => {...});
where <api token>
is the Token of the script which belongs to your
account. The second and third parameters can be explored later; the last
parameter is an optional callback once the full SDK is loaded.
The most basic example consists is just the configure
command, with an
api_token
:
oa.configure('api_token');
Note
When using the entire snippet, the tms.js
file will automatically
configure your api token for you. The above configure command is best used
yourself to:
- optimize network usage when using many api tokens.
- to override server-side configuration.
- to test out a development api token.
Send data with track
¶
The track
command is the easiest way to send event data. An event is just a
string, with optional key/vals added for context. For example, you can use the
track
command to send a view video
event:
oa.track("view video");
Debugging¶
To open Orbee's JavaScript SDK Debugger, you can update your configure with the following additional configuration:
oa.configure('api_token', null, {debug: true});
You can also trigger this after initialization with the following command:
oa.enableDebug(true);