Consent adapters
With consent.required: true, Backstory attaches no collectors and buffers nothing until consent is granted. An adapter turns your consent platform’s state into grant() and revoke() calls.
IAB TCF 2.x
Section titled “IAB TCF 2.x”Backstory.init({ projectKey: "pk_live_…", consent: { required: true, adapter: "tcf", purposeIds: [1, 7, 8, 10] },});The adapter calls __tcfapi("addEventListener") and grants when every listed purpose is consented; it revokes when any is withdrawn.
OneTrust
Section titled “OneTrust”consent: { required: true, adapter: "onetrust" }Reads OnetrustActiveGroups and listens to OptanonWrapper. Grants when the performance/analytics group is active.
Cookiebot
Section titled “Cookiebot”consent: { required: true, adapter: "cookiebot" }Listens to CookiebotOnAccept and CookiebotOnDecline; grants when Cookiebot.consent.statistics is true.
consent: { required: true, adapter: "osano" }Listens to Osano.cm consent events for the analytics category.
Your own CMP
Section titled “Your own CMP”consent: { required: true, adapter: "callback", callback: (grant, revoke) => { myCmp.on("change", (state) => (state.analytics ? grant() : revoke())); },}Global Privacy Control
Section titled “Global Privacy Control”If navigator.globalPrivacyControl is true, the SDK treats the visit as opted out and records nothing, unless consent.ignoreGPC: true and your project documents a different lawful basis.
Opt-out API
Section titled “Opt-out API”Backstory.optOut() stops recording, wipes local buffers and the IndexedDB spill, and sends a final consent: false control event so the server can honor a deletion request.