Fix OpenPanel consent tracking bootstrap
This commit is contained in:
@@ -129,6 +129,7 @@ import { cookieBannerCopy } from "../data/locales";
|
|||||||
if (existing) {
|
if (existing) {
|
||||||
applyPreference(existing);
|
applyPreference(existing);
|
||||||
closeBanner();
|
closeBanner();
|
||||||
|
window.dispatchEvent(new CustomEvent("dg:cookie-consent", { detail: { preference: existing } }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,10 +70,11 @@ const chromeCopy = getChromeCopy({ activeSlug, issueDate, articleKey });
|
|||||||
/>
|
/>
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
window.op=window.op||function(){var n=[];return new Proxy(function(){arguments.length&&n.push([].slice.call(arguments))},{get:function(t,r){return"q"===r?n:function(){n.push([r].concat([].slice.call(arguments)))}},has:function(t,r){return"q"===r}})};
|
window.op=window.op||function(){var n=[];return new Proxy(function(){arguments.length&&n.push([].slice.call(arguments))},{get:function(t,r){return"q"===r?n:function(){n.push([r].concat([].slice.call(arguments)))}},has:function(t,r){return"q"===r}})}();
|
||||||
(function(){
|
(function(){
|
||||||
var cfg={apiUrl:'https://analytics.bluenotelogic.com/api',clientId:'6a6d90f8-66ea-413e-9b3d-9b7278ac6c09',trackScreenViews:true,trackOutgoingLinks:true,trackAttributes:true};
|
var cfg={apiUrl:'https://analytics.bluenotelogic.com/api',clientId:'6a6d90f8-66ea-413e-9b3d-9b7278ac6c09',trackScreenViews:true,trackOutgoingLinks:true,trackAttributes:true};
|
||||||
function initOP(){window.op('init',cfg);var s=document.createElement('script');s.src='https://analytics.bluenotelogic.com/op1.js';s.defer=true;s.async=true;document.head.appendChild(s);}
|
var opLoaded=false;
|
||||||
|
function initOP(){if(opLoaded)return;opLoaded=true;window.op('init',cfg);var s=document.createElement('script');s.src='https://analytics.bluenotelogic.com/op1.js';s.defer=true;s.async=true;document.head.appendChild(s);}
|
||||||
if(document.documentElement.getAttribute('data-cookie-analytics')==='true'){initOP();}
|
if(document.documentElement.getAttribute('data-cookie-analytics')==='true'){initOP();}
|
||||||
window.addEventListener('dg:cookie-consent',function(e){var p=e.detail&&e.detail.preference||'';if(p==='all'||p.indexOf('analytics')!==-1){initOP();}});
|
window.addEventListener('dg:cookie-consent',function(e){var p=e.detail&&e.detail.preference||'';if(p==='all'||p.indexOf('analytics')!==-1){initOP();}});
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user