I don’t know about you, but I’m sick of cookie consent banners. When I visit a page, I often don’t want to interact with it by clicking. It’s especially annoying if a consent banner gets in the way of consent. I don’t want to click “Yes” OR “No”. Just leave me be! Unfortunately, GDPR rules via the EU directive Directive 2009/136/EC mandate that websites collect consent even for mundane stuff like analytics. There’s no perfect solution, but here is how you can avoid cookie banners while using analytics and remain compliant with the law.
You have to Disable ALL Cookies (Not Just 3rd Party)
Much is made of Google Analytics 4 (GA4) and the cookieless future. It’s important to note that most of these articles talk about 3rd party cookies – namely, cookies that are set by a site other than the one you visit. GA4 still very much uses first-party cookies. It’s not a secret. These are the cookie variables it sets. You need consent banners for both third-party and first-party cookies.
So if you thought that using GA4 frees you from the legal requirements to use a cookie consent banner, think again!
Disabling Cookies on Google Universal Analytics (UA)
While it’s possible to disable cookies on UA by modifying the code, I suggest you delete it and use another solution. For example, on WordPress websites, you can use the Cookieless Privacy-Focused Google Analytics plugin. This plugin takes your Google identifier as a configuration setting and outputs the UA code on your website without allowing it to set cookies.
Sure, you lose functionality. But there’s no getting around that. Google Analytics without first or third-party cookies isn’t going to distinguish between repeat visitors and first-time visitors.
Disabling Cookies on Microsoft Clarity
I’d recently written a review of Microsoft Clarity, where I considered it as a replacement for Google Analytics. While it’s useful, it has some ways to go. But you can opt-out of cookies entirely via the advanced settings as shown here:
This means that if you use Clarity with this setting turned off, you can do away with cookies banners entirely.
Cloudflare’s Web Analytics
Cloudflare’s Web Analytics is quickly becoming one of my favorite analytics tools. It’s not yet a substitute for GA, and doesn’t track events like clicks and scrolls, but who knows the future? The best part is that it’s completely cookieless and so you don’t have to show your users a cookie consent banner. Cloudflare also measures Core Web Vitals (CWV) in real-time. This is something that you don’t find on regular analytics software, so it’s really useful.
Plus the interface is very user-friendly. If I didn’t have to track events, I would use Cloudflare analytics over Google Analytics all the time.
Anonymize Google Analytics Data
I’ve come across a very interesting service that takes the data from Google Analytics, strips it of any code that sets cookies, anonymizes the data, and then sends it forward to Google Analytics. As a result, you get GA tracking without cookies, and with perfect anonymity from your users. The service is called Privera, and it’s an open-source project as of now. There’s no paid tier, but you can use it for 10,000 visits every month for free. It’s just a single line of code on your website that replaces the one you use for Google Analytics.
How this would work with Google Analytics 4, I don’t know. And so far, I haven’t found an easy way to remove cookies in GA4. But when I find a method, I’ll be sure to let you know!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!