1

I personally don't post any kind of external advertisements in any of my websites: Not Adsense, not anything. I just don't charge other organizations and companies to advertise in my websites and I don't desire that this would happen. My websites are basically websites that give information and in which I present and offer my services.

I thus want to ask:

Does totally disabling cookie-gathering from my visitors, in my WordPress websites, might malfunction Google Analytics (if I'll decide to start using it in my websites sometime)?

The reason I'd like to totally disable cookie-gathering is to raise performance - I don't gather data on my visitors for external advertisements (that is, to better suit them advertisements).

I just want that basically any URL I serve under any domain, will be a cookie-free domain, to overcome Google PageSpeed Insights "Use cookie free domains" error.

But I do fear that if I do, it might prevent me from using Google Analytics, if and when I'll want to use it.

7
  • 1
    When you say "disabling cookies", how would you do so? Are you planning to just not have WordPress set cookies, or do you have something that would identify cookies that get set and delete them? Apr 7 '18 at 11:39
  • 1
    When you say you "don't use Google Analytics", do you mean you've never had the Google Analytics tracking code on your website? Or do you mean you have it but you never check the stats? Apr 7 '18 at 14:46
  • Please edit your question to provide the requested information. Apr 8 '18 at 8:59
  • I did my best to clarify, @StephenOstermiller.
    – user58733
    Apr 8 '18 at 18:29
  • Google Analytics sets cookies on its own. I doubt that a WordPress setting would delete those cookies. Michael d's answer says how to do so though. If you do delete GA cookies, GA isn't going to work very well. Every page view is going to look like a new visit from a new visitor. You won't have any session or user data. Apr 8 '18 at 20:44
1

Apparently, you can indeed disable Google Analytics cookies through PHP. How Wordpress goes about disabling cookies will determine whether it effects GA.

This code should disable GA cookies:

setcookie($key, '', time()-1000, '/', '.domain.com');

Source:https://stackoverflow.com/questions/10836122/how-to-remove-google-analytics-cookies

If WP is using a code like above then this would effect GA.

This javascript below would also disable GA cookies if set before the GA script:

window['ga-disable-UA-XXXXXX-X'] = true;

Source:https://stackoverflow.com/questions/30578614/delete-google-analytics-cookies-and-eu-e-privacy-law


What you can do is disable cookies and check your GA data. If it appears that it has changed, you can undo the disable cookies settings and then Google Analytics should continue to function properly.

If you can find the exact script that disables cookies through Wordpress, you can reply to this message and I can try to analyze it to determine if I think it would block GA cookies or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy