mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 09:58:30 +02:00
* 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
35 lines
1005 B
JavaScript
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
|