Consent and lifecycle¶
With an apiKey set, the SDK will not start without training consent, and the API refuses the session even when
called directly.
| State | Entered on | Captures | Uploads |
|---|---|---|---|
loaded |
Script evaluated; waits for DOMContentLoaded if autoStart is on |
No | No |
blocked (consent, gpc) |
start() without consent.training === true, or Global Privacy Control set while respectGPC is on |
No | No |
running |
start() or setConsent({ training: true }) succeeded |
Yes | After the handshake |
paused |
pause() |
No | What was already captured |
stopped |
stop(), setConsent({ training: false }), or a 401/403 at the handshake |
No | One final flush |
- The SDK keeps no consent state between page loads: store the choice yourself and pass it every time.
policyVersion(up to 64 characters) is stored with each session, so you can show which notice a user accepted.- On withdrawal, call
setConsent({ training: false })before the erasure endpoint. An upload that lands after erasure opens a new, empty session for that user. - Offer both choices with equal weight; declining must not change your service.