@mic85b
I’m sorry but that is not useful at all. The code itself is not useful at all, because it will not work on every website. I have tried a lot of times to adjust the code. Now after almost 2weeks i have the correct code. And its ok to have an example of GA, but other cookies are twice as hard to find the correct code to disable them.
@triplecomp
If you do not want the cookie to work before accepting the privacy bar you should try the following that i am using(i am using google analytics as example in this one:
function my_google_opt_out() {
if ( is_allowed_cookie( '_ga' ) ) {
?>
<script>
window['ga-disable-UA-xxxx-xx'] = false;
</script>
<?php
}
else{
?>
<script>
window['ga-disable-UA-xxxx-x'] = true;
</script>
<?php
}
}
This means, if the cookie is allowed, the cookie GA disable is FALSE, so will be active.
If the cookie is not allowed(else) and you have the category with the cookie you want standard on OFF, then the cookie is not allowed and it will activate the else. The GA disabled will be set to true and so, it will be disabled.
p.s. dont forget to replace the XXXX by your GA ID, ofcourse for other cookie this is not needed. Also make sure that you search the cookies, and insert them inside the category like following: _ga,_gid,_PHPSESSID,_ss . So with comma’s between but no spaces.
This worked for me, if it doesnt for you, you should adjust the code a bit to your website.
Goodluck!
-
This reply was modified 6 years, 6 months ago by Willem Munts.
-
This reply was modified 6 years, 6 months ago by Willem Munts.