Skip to content

SDK QuickStart

The JS SDK lets you send events to Orbee. See the full documenation at JS SDK.

Table of Contents

  1. Initialize the library
  2. Send data
  3. Check for success
  4. Complete code example

Initialize the library


First, install the JavaScript snippet and initialize the library on your site.

Script loader

This package is also distributed via our CDN. Copy and paste this script in your HTML file.

<script async src="https://scripts.orb.ee/sdk/tms.js?sid=SCRIPT_TOKEN"></script>
<script>;(function(w,d,n){if(!w[n]){w[n]=function(){return (w[n].q=w[n].q||[]).push(arguments)};w[n].q=w[n].q||[];}}(window,document,"orb"));</script>

Initialization

Before you can use the SDK, you need to initialize it by providing your SCRIPT_TOKEN.

Script Token

Replace SCRIPT_TOKEN in the script URI above with your Orbee script token.


Send data


The script will automatically initialize the SDK and collect user activity from the site! If you want to send custom events, you can do the following:

const eventProperties = {
    color: 'Fire-Truck Red'
};
orb('track', 'Vehicle color selected', eventProperties);

Check for success


After you begin sending data to Orbee, use Orbee's Chrome extension to check your instrumentation and validate your events.


Complete code sample


Here's a complete example of how to use the SDK on your site:

<script async src="https://scripts.orb.ee/sdk/tms.js?sid=SCRIPT_TOKEN"></script>
<script>;(function(w,d,n){if(!w[n]){w[n]=function(){return (w[n].q=w[n].q||[]).push(arguments)};w[n].q=w[n].q||[];}}(window,document,"orb"));</script>
<script>
    const eventProperties = {
        color: 'Fire-Truck Red'
    };
    orb('track', 'Vehicle color selected', eventProperties);
</script>

You can learn more about available functionality in the JS SDK.


Last update: 2023-04-20