• Resolved rojohueso

    (@rojohueso)


    Hi,

    My problem is Google Analytics put its cookies before GDPR Cookie Consent banner appears asking for accepting or rejecting cookies, so it’s just a esthetic element in my website.

    Following the plugin author instructions I tried moving the script of Google analytics cookies in my site theme to their plugin categories.

    Sadly the set up guide doesn’t explain it properly.

    I created a new category for Google Analytics cookie, then, moved that script that starts with “<!– Global site tag (gtag.js) – Google Analytics –>
    <script async…” to the “This script will be add to the HEAD section of the page…” box.

    Also kept it where it was and simply add “<script> enableGoogleAnalytics(); </script>” to that HEAD box, but it doesn’t work.

    Actually this issue is a pain in the ass.

    Is it so complicated to explain in detail the actual steps to follow to set this up?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    You have to add the script of google analytics which looks similar as below to the HEAD script area under any of the categories.

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-xxxxxxxxx');
    </script>

    Also make sure to remove the script from anywhere else in the site and clear the site cache.

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee,

    Thanks for your help.

    I have followed your instructions but everything seems to be the same.

    (I also have tried adding the script of google analytics to HEAD script area and BODY script area)

    I have visited my website monitoring it with Google Analytics, then I noticed it starts to count that visit real-time, no matter if I have accepted or refused cookies.

    So I think the problem is still there. 🙁

    Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    In the source code of the page, we can see the Google analytics script added twice. One is blocked while the other isn’t. Kindly check this at your end.

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee,

    I have checked it, only see Google Analytics script (line 378/ Home) once.
    Please, where did you see it added twice?

    Thank you.

    Thread Starter rojohueso

    (@rojohueso)

    (Is it happen because I added _ga to Cookies List and the script in Cookie Categories?)

    Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    Please check line 364 here.

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee ,

    So I have to remove “_ga” from Cookies List and only keeps the script in Cookie Categories?

    (Sorry for my questions, but since I’m not a web developer or programmer some stuff is not what I do usually)

    Thanks

    Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    You must keep the _ga in the cookie list and script in categories. Are you sure that you have added the script only via the Analytics category script edit section?

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee,

    Good.

    I have checked my website again. It could be Rank Math SEO plugin option “Install Analytics Code”?
    (It was enabled, then I have disabled it but I think that script is still there)

    • This reply was modified 3 years, 2 months ago by rojohueso.
    Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    We checked the site now and the cookies are now setting only upon accept. Please see the screen recording here:

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee ,

    Thank you for kindly visiting my website and checking it.

    Yes, yesterday I disabled the Rank Math SEO plugin option I told you about, then I disabled GDPR Cookie Consent, enabled it again but configuring it freshly. This time CookieYes scanner worked fine.

    I was testing my site and as you could noticed the cookies are now setting only upon accept.

    But I have noticed Google Analytics is not showing info properly. I mean, suddenly my site bounce rate and dwell time have dropped alarmingly.

    So I’m gonna test it enabling again that Rank Math SEO plugin option.

    Thread Starter rojohueso

    (@rojohueso)

    Hi again @webtoffee ,

    Watching again your video I have noticed it seems to work properly but in yours it shows the Google Analytics cookies afyer accepting but when I visit my website (incognito mode) after accepting cookies they remain the same:

    Plugin Author WebToffee

    (@webtoffee)

    Hi @rojohueso,

    Please remove the below script from No Necesarias category(head script area).

    <script> enableGoogleAnalytics(); </script>

    It is just an example script provided in the plugin.

    Thread Starter rojohueso

    (@rojohueso)

    Hi @webtoffee ,

    Thanks for answering me.

    I have removed that script you have told me but everything remain the same as showed in my previous video, it doesn’t show the Google Analytics cookies after accepting them 🙁

    Thread Starter rojohueso

    (@rojohueso)

    Hi again @webtoffee ,

    This time I could test it with Chrome. Then, it works fine like in your Loom video.

    I mean, from Firefox it doesn’t show that cookies are put there after accepting them, even Google Analytics monitore it.

    Again, thanks for your patience and help. (Sadly I cannot edit my previous posts)

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Google Analytics cookies just visiting a website’ is closed to new replies.