Before launching an experience you must first install and initialize Supertab.js

You must have a Supertab clientId to use Supertab.js. You can find the clientId associated with each of your sites in the business portal.

From npm

For use with bundlers, you can install Supertab.js from the npm registry.

Install
npm install @getsupertab/supertab-js

Then import the Supertab class and instantiate it:

Initialize
import { Supertab } from "@getsupertab/supertab-js";

const supertabClient = new Supertab({ clientId: "test_client.X" });

From CDN

You can load Supertab.js from our CDN using either a direct ES Module import or by using the global loader script.

With an ES Module import

The compiled module exports the Supertab class.

Import & Initialize
<script type="module">
    import { Supertab } from "https://js.supertab.co/v3/supertab.js"

    const supertabClient = new Supertab({ clientId: "test_client.X" });
</script>

With the global loader function

For environments that don’t support ES modules, you can use the global loader. This script exposes the global function window.loadSupertab(). It returns a promise that resolves with the Supertab class..

You can handle promises through the use of async / await or through promise chaining with .then().

<script src="https://js.supertab.co/v3/supertab.global.js"></script>
<script>
    (async () => {
        const { Supertab } = await window.loadSupertab();
        const supertabClient = new Supertab({ clientId: "test_client.X" });
    })();
</script>

Versioning

The CDN URL is versioned, including v3 will automatically upgrade you to new minor versions. Breaking changes are included in new major versions.