cookie consent for clarity

main
alexanderroese 2024-07-13 10:56:28 +02:00
parent 473f37f894
commit 5e85ac1b85
1 changed files with 13 additions and 9 deletions

View File

@ -53,7 +53,17 @@
%}
<script>
console.log("2",)
function msClarity() {
if(window.Shopify.customerPrivacy.analyticsProcessingAllowed()) {
(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", "lvd5xzm4d8");
}
}
console.log("3",)
window.Shopify.loadFeatures([
{
@ -66,9 +76,11 @@
throw error;
}
console.log("here1")
msClarity()
document.addEventListener('visitorConsentCollected', () => {
console.log("here2 visotorConsentCollected")
msClarity()
});
});
@ -383,14 +395,6 @@
}
</script>
<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", "lvd5xzm4d8");
</script>
<!-- Render CSS content -->
{% render 'shx-loading-screen'
, content_type: 'head' %}