The script that google indicates to put in the head section of the not necessary cookies section in the plugin is not working for me. Which script should be put and where to make google analytics cookies considered “not necessary” and therefore can be rejected?
Hi @diegorot,
You must add the google analytics script including its <script> tag in the script input field in the plugin. Here is a sample code.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxxx');
</script>
Once you add it and save, the GA cookies will be set only if the user accepts the cookies.
Sorry but the problem is not solved. I have just put that script in the “head” section, with our google analytics ID in “not necessary cookies settings, I have indicated that the default state of the not necessary cookies is disabled, I have saved the changes and when loading the website without cookies, it doesn’t work, it loads by default the 3 Google analytics cookies (_gat, _ga and _gid).
-
This reply was modified 6 years, 2 months ago by
diegorot.
-
This reply was modified 6 years, 2 months ago by
diegorot.
Hi. with the reload page option is active all works fine for me.
The website pages are reloaded when visitors click on accept and google analytics script is loaded
The problem is that when the website pages are reloaded the plugin insert a query string in the url. It’s possible to avoid this query string?
@easyweb-consulting my problem is different, I have disabled non-necessary cookies by default and the google analytics script in the Head section with the UA code but when I reload the page without cached cookies (cleared through the browser option) it generates them again. Ga, gat and gid are reinstalled.
In my case, I should not load these 3 cookies when I load the page unless I click accept, however, it loads them before I can indicate any option.
Hi @diegorot,
Please share the site URL so that we can have a look.
Hi @webtoffee , you have a private support ticket with the information and a screenshot (ticket number is 11463).
Thanks for the help.
Hi @diegorot,
The support team will follow up from there.