Docs

File DA-007 View as Markdown

Browser API

doubleagent.init({ key?, profile?, endpoint?, integrations?: 'auto' | { ga4: true, … },
  consent?: 'auto' | 'granted' | 'denied', mode?: 'analytics' | 'security',
  block?: { adConversions?: 'bot' | 'bot+agent' | 'none', forms?: boolean }, debug? })
MethodReturnsNeeds a key
ready()Provisional verdict, about 1.5 sNo
verdict()Verdict | nullNo
on('verdict' | 'final', fn)Unsubscribe functionNo
identify(sha256(userId))– (hash only)No
reset()–No
flush()Sends the beacon nowNo
check(action)Server-checked verdict and tokenYes
getToken(action)Signed token, cached per actionYes
stripeToken()getToken('payment')Yes
protect(form, action)Hidden da_token on submitYes

Without a key, check, getToken and stripeToken reject, and protect throws, with DoubleAgentError code key_required. See Capabilities.

Calling init({ key }) after a keyless auto-init upgrades the page in place. Live presence stays off without a key.

Before load: doubleagent.push('method', ...args) or doubleagent.push(da => …).

Actions: pageview search login signup password_reset add_to_cart checkout payment gift_card promo post message lead_form api_key, or your own [A-Za-z0-9/_].