Hello,
this is my last hope you guys can help me here with cookie notice plugin.
I tried on other forums to search how to set cookies right.
I am using only google analytics code on my site.
I have notice and everything, but it does not metter if i click yes, i accept or no, i do not accept because cookies are installed automaticly.
I tried to put different codes to many files but nothing help.
Can you please tell me what code i need to put to script blocking ?
Is this GA code or analytics…
<?php
if ( function_exists(‘cn_cookies_accepted’) && cn_cookies_accepted() ) { ?>
<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);
ga(‘create’, ‘XXX’, ‘auto’);
ga(‘send’, ‘pageview’);
</script>
<?php } ?>
OR
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-114775937-1″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘XXX’);
</script>
And how to make this code right and where to put it ?
if ( function_exists(‘cn_cookies_accepted’) && cn_cookies_accepted() ) { // Your third-party non functional code here }
I want that cookies are not installed if somebody says NO…
Please help.
Thank you.
Best regards.