Docs

File DA-006 View as Markdown

Script tag

<script>window.doubleagent=window.doubleagent||{q:[],push(){this.q.push(arguments)}};</script>
<script async src="https://cdn.doubleagent.so/v1/doubleagent.js" data-profile="auto"></script>
AttributeDefault
data-keynone (keyless)Public key, pk_live_… or pk_test_…. Optional; see Capabilities. Safe to expose.
data-profileautoSee Clearance.
data-endpointhttps://api.doubleagent.soOnly for a self-hosted API.
data-liveon for pk_test_, off for pk_live_Live presence for HQ's Live now panel (one small ping per open tab every few seconds). data-live="false" turns it off. Needs a key.

Testing on localhost

Use the site's test key (pk_test_…) on your machine. It works on localhost, *.localhost, 127.0.0.1 and [::1], on any port, with no domain to add. Those sessions show in the portal's HQ under Test data (localhost), even before your real domain is verified. Switch to the live key (pk_live_…) for production. Live keys only work on verified domains.

Everything else goes in a queued init, which is merged over the attributes:

doubleagent.push('init', { mode: 'analytics', consent: 'auto', block: { adConversions: 'bot', forms: false } });

npm:

import { doubleagent } from '@doubleagent-so/js';
doubleagent.init({});                     // keyless
doubleagent.init({ key: 'pk_live_xxx' }); // keyed; after a keyless start this upgrades in place