From 9bcd924b5cec1c5a5f58de1458b56ccd211b2464 Mon Sep 17 00:00:00 2001 From: danfunk Date: Thu, 3 Aug 2023 16:55:07 -0400 Subject: [PATCH] allow opting out of tracking. --- layouts/partials/cookie-consent.html | 17 +++++++---------- layouts/partials/meta.html | 7 ------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/layouts/partials/cookie-consent.html b/layouts/partials/cookie-consent.html index c27de14..0a595fe 100644 --- a/layouts/partials/cookie-consent.html +++ b/layouts/partials/cookie-consent.html @@ -54,16 +54,13 @@ document.head.appendChild(script); } - /* This is the part where you call the above defined function and "calls back" - your code which gets executed after the script has loaded */ - //REPLACE WITH YOUR GA TAG! - loadScriptAsync('https://www.googletagmanager.com/gtag/js?id=G-3Z83G8WLEK', function () { - window.dataLayer = window.dataLayer || []; - function gtag() { dataLayer.push(arguments); } - gtag('js', new Date()); - //REPLACE WITH YOUR GA TAG! - gtag('config', 'G-3Z83G8WLEK', { 'anonymize_ip': true, cookie_flags: 'secure;samesite=none' }); - }); + + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); + })(window,document,'script','dataLayer','GTM-NFMNL96Z'); + {{ end }} } else if (readCookie('cookie-notice-option')!='false'){ diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index f685bcf..0ec9145 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -7,10 +7,3 @@ - - - \ No newline at end of file