Installation
The Break Ground SDK is a client-side JavaScript snippet loaded via a <script> tag. It loads asynchronously and does not block page rendering.
Embed Snippet
Add the following snippet inside the <head> section of your HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Your Application</title>
<!-- 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;
fjs.parentNode.insertBefore(js, fjs);
})(window, document, "script", "https://cdn.example.com/sdk.js", "DAP");
DAP("init", { tenantKey: "YOUR_TENANT_KEY" });
</script>
</head>
<body>
<!-- Your application content -->
</body>
</html>
Replace YOUR_TENANT_KEY with the API key from your dashboard (Settings > API Keys).
How the Snippet Works
The IIFE performs the following steps:
- Registers a global
DAPfunction onwindowthat queues any calls made before the SDK script has loaded. - Creates a
<script>element pointing to the SDK bundle and inserts it into the page. - Sets
async=1so the script loads without blocking the page. - Once the SDK script loads, it processes the queued calls — starting with the
initcommand.
Initialization
The DAP('init', config) call accepts a configuration object. At minimum, you must provide your tenantKey:
DAP("init", { tenantKey: "YOUR_TENANT_KEY" });
For additional options such as debug, locale, and journeys, see the SDK Configuration reference.
Verifying the Installation
After adding the snippet, confirm the SDK loaded correctly:
- Open your application in a browser.
- Open the developer console (
F12orCmd+Option+I). - Type
window.DAPand press Enter. If the SDK is loaded, you will see the DAP function object. - Enable debug mode to see detailed logs in the console:
DAP("init", { tenantKey: "YOUR_TENANT_KEY", debug: true });
- Check the Network tab for a successful request to the SDK bundle URL.
If window.DAP is undefined, verify the snippet is placed inside <head> and that no script errors appear in the console.
Framework-Specific Installation
Using a JavaScript framework or CMS? See the Framework Installation Guides for step-by-step instructions for React, Next.js, Angular, Vue.js, WordPress, and Google Tag Manager.