Skip to content
You are reading the docs for Backstory 0.2 (private beta). Behavior may change before general availability; the changelog lists every change.

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.

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.

consent: { required: true, adapter: "onetrust" }

Reads OnetrustActiveGroups and listens to OptanonWrapper. Grants when the performance/analytics group is active.

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.

consent: {
required: true,
adapter: "callback",
callback: (grant, revoke) => {
myCmp.on("change", (state) => (state.analytics ? grant() : revoke()));
},
}

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.

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.