Skip to main content

SDK Installation

The BreakGround SDK is loaded via a script tag. It is not available as an npm package.

Embed Snippet

Add the following snippet inside the head section of your HTML, before any other application scripts:

<!-- DAP SDK Snippet -->
<script>
(function (w, d, s, o, f, js, fjs) {
w["DAPObject"] = f;
w[f] =
w[f] ||
function () {
(w[f].q = w[f].q || []).push(arguments);
};
w[f].l = 1 * new Date();
js = d.createElement(s);
fjs = d.getElementsByTagName(s)[0];
js.id = f;
js.src = o;
js.async = 1;
js.crossOrigin = "anonymous";
fjs.parentNode.insertBefore(js, fjs);
})(window, document, "script", "https://cdn.example.com/sdk.js", "DAP");
DAP("init", { tenantKey: "YOUR_TENANT_KEY" });
</script>

Replace YOUR_TENANT_KEY with the API key from your dashboard (Settings > API Keys).

Placement

Place the snippet in the head section of your HTML. This ensures the SDK begins loading as early as possible and can queue commands before the page fully renders. The async flag prevents it from blocking your page load.

Verifying the Installation

After adding the snippet, confirm the SDK loaded:

  1. Open your application in a browser.
  2. Open the developer console (F12 or Cmd+Option+I).
  3. Type window.DAP and press Enter. You should see the DAP function object.
  4. To see detailed initialization logs, enable debug mode:
DAP("init", { tenantKey: "YOUR_TENANT_KEY", debug: true });
  1. Check the Console tab for messages prefixed with [DAP] confirming successful initialization.

If window.DAP is undefined, verify the snippet is present in your page source and that no Content Security Policy (CSP) rules are blocking the SDK script.

Framework-Specific Guides

For step-by-step instructions on installing the SDK in a specific framework: