Add OpenPanel analytics with cookie consent integration

Loads OpenPanel (analytics.bluenotelogic.com, client 6a6d90f8) only when user
accepts analytics cookies via the existing dg:cookie-consent consent event.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 14:41:59 +02:00
parent 39712d8d5e
commit 87bd5af809
+11 -1
View File
@@ -65,10 +65,19 @@ const chromeCopy = getChromeCopy({ activeSlug, issueDate, articleKey });
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link <link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap" href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Newsreader:opsz,ital,wght@6..72,0,400..700;6..72,1,400..600&family=Special+Elite&family=IBM+Plex+Mono:wght@400;500;600&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
<title>{title}</title> <title>{title}</title>
<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}})};
(function(){
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);}
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();}});
})();
</script>
</head> </head>
<body> <body>
<header class="site-ribbon"> <header class="site-ribbon">
@@ -128,6 +137,7 @@ const chromeCopy = getChromeCopy({ activeSlug, issueDate, articleKey });
<p>davegilligan.com</p> <p>davegilligan.com</p>
<strong><LocaleCopy copy={chromeCopy.footerHeadline} /></strong> <strong><LocaleCopy copy={chromeCopy.footerHeadline} /></strong>
<span><LocaleCopy copy={chromeCopy.footerBody} /></span> <span><LocaleCopy copy={chromeCopy.footerBody} /></span>
<span style="font-size:0.78rem;color:var(--ink-whisper);font-family:var(--font-mono);letter-spacing:0.1em;text-transform:uppercase;">Filed under the Subcommission for Multilingual Weather</span>
</div> </div>
<div class="footer-links"> <div class="footer-links">