JavaScript SDK

A lightweight JavaScript library to integrate your web sites with your DCN

The JavaScript SDK makes it easy to integrate your sites with your DCN. It can be installed as a ES6 compatible npm module paired with module bundlers such as webpack or browserify, or can be loaded on a webpage directly, or using a tag management system, by referencing a release build from the page HTML via a <script> tag.

Details on installing and using the web SDK can be found in the Github README. A demo of various SDK functionalities can be seen on demo.optable.co.

Creating a Site (JavaScript SDK) Source

  1. Head to Integrations -> Sources and click Create.

  2. Select the JavaScript SDK source.

  3. Enter the name of the source, this is how your source will be identified when you want to use it across the platform.

  4. You can then enter and override settings related to your SDK setup:

    • Slug: This has to be the same value as the value set in window.optable.site in your SDK instantiation.

    • Header Name: Override the default HTTP Request Header name if desired (cookie-based integration only)

    • Cookie Name: Override the default Optable cookie name if desired (cookie-based integration only)

    • Expiry: Override the default cookie expiration if desired (cookie-based integration only)

    • Allowed HTTP Origins: To prevent receiving data from unauthorized origins, you need to specify authorized domains, such as http://localhost, https://sub.domain.com. We also support a single wildcard to authorize a domain and all its subdomains such as https://*.mydomain.com.

  5. Click "Create"

Failing to authorize the proper "HTTP Origins" per source will result in CORS errors.

Last updated