Created
January 7, 2022 19:09
-
-
Save RoboticDinosaur/a6302f3954a71992df8ec6896737e47e to your computer and use it in GitHub Desktop.
GDPR Compliant Analytics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Hubspot Tracking --> | |
<script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/{{ analytics.hubspot.id }}.js"></script> | |
<!-- End of HubSpot Embed Code --> | |
<!-- Google Analytics --> | |
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ analytics.google.id }}"></script> | |
<script defer> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('consent', 'default', { | |
'ad_storage': 'denied', | |
'analytics_storage': 'denied', | |
'wait_for_update': 5000 | |
}); | |
gtag('set', 'url_passthrough', true); | |
gtag('js', new Date()); | |
gtag('config', '{{ analytics.google.id }}'); | |
</script> | |
<!-- End Google Analytics --> | |
<!-- Facebook Pixel Code --> | |
<script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js'); | |
fbq('consent', 'revoke'); | |
fbq('init', {{ analytics.facebook.id }}); | |
fbq('track', 'PageView'); | |
</script> | |
<noscript> | |
<img height="1" width="1" src="https://www.facebook.com/tr?id={{ analytics.facebook.id }}&ev=PageView&noscript=1" /> | |
</noscript> | |
<!-- End Facebook Pixel --> | |
<!-- Microsoft Clarity --> | |
<script type="text/javascript"> | |
(function(c,l,a,r,i,t,y){ | |
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; | |
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; | |
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); | |
})(window, document, "clarity", "script", "{{ analytics.clarity.id }}"); | |
</script> | |
<!-- End Microsoft Clarity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _hsp = window._hsp = window._hsp || []; | |
_hsp.push(['addPrivacyConsentListener', function(consent) { | |
/* GOOGLE ANALYTICS */ | |
gtag('consent', 'update', { | |
'ad_storage': 'granted', | |
'analytics_storage': 'granted' | |
}); | |
/* FACEBOOK PIXEL */ | |
fbq('consent', 'grant'); | |
/* MICROSOFT CLARITY */ | |
window.clarity('consent'); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment