OK, that worked. However, now the script is included no matter whether the user has confirmed or not. I tried this approach in the functions.php:
add_action('wp_footer', 'complianz_gtm');
function complianz_gtm(){
?>
<script type="text/plain" data-category="statistics">
(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-xxxxxxx');</script>
<?php
}
Now, the script is included twice:
https://walterluebeck.com/
It seems that the script is included in the category “functional”, which is not correct, of course:
<!-- Statistics script Complianz GDPR/CCPA -->
<script data-category="functional">
(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-xxxxxx');
</script>
-
This reply was modified 4 months ago by
cutu234.