Files
landing_page/qdrant-landing/themes/qdrant-2024/assets/js/onetrust-helpers.js
T
jasonbryant84 f89f6c7039 OneTrust & Segment (#1563)
* remove cookit (styling and logic), introduce segment load snippet directly into <head>, no consent for loading, add onetrust consent snippet and logic

* simplify register call and leverage window.OnetrustActiveGroups

* onetrust load before segment ready

* add production value for HUGO_PARAMS_onetrustScriptId to netlify.toml
2025-05-08 14:31:08 +01:00

35 lines
1005 B
JavaScript

export function registerAndCall() {
const consentPreferences = window.OnetrustActiveGroups ?? '';
// Register OneTrust Integration plugin
window.analytics
.register({
name: 'OneTrust Integration Cookie',
version: '0.1.0',
type: 'enrichment',
isLoaded: () => true,
load: () => Promise.resolve(),
// context object and reference to the analytics.js instance
page: (ctx) => {
if (ctx.event.context) {
ctx.updateEvent('context.consent', { onetrust: consentPreferences });
}
return ctx;
},
track: (ctx) => {
if (ctx.event.context) {
ctx.updateEvent('context.consent', { onetrust: consentPreferences });
}
return ctx;
},
identify: (ctx) => {
if (ctx.event.context) {
ctx.updateEvent('context.consent', { onetrust: consentPreferences });
}
return ctx;
},
})
.catch(() => false);
return true;
} // registerAndCall