# How To Avoid A Cookie Banner While Using Analytics

> By law, you need to show a cookie banner to your visitors if you use Google Analytics. Here's how to avoid that by making some changes.

- Author: [Bhagwad Park](https://www.namehero.com/blog/author/bhagwad-park/)
- Published: 2022-04-18
- Updated: 2022-04-18
- Category: [Website Performance](https://www.namehero.com/blog/category/website-performance/)
- Web page: https://www.namehero.com/blog/how-to-avoid-a-cookie-banner-while-using-analytics/

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](https://support.google.com/analytics/answer/11397207?hl=en). 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](https://wordpress.org/plugins/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](https://www.namehero.com/blog/microsoft-clarity-is-useful-but-no-replacement-for-google-analytics/), 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:
 ![Remove Cookies from Microsoft Clarity](https://blogcdn.namehero.com/startup/wp-content/uploads/2022/04/11124315/Instruct-Microsoft-Clarity-to-Not-Set-Cookies.png)Remove Cookies from Microsoft Clarity

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](https://www.namehero.com/blog/using-cloudflare-web-analytics-for-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](https://privera.io/), 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!

## Related posts

- [4 Caching Strategies That Will Speed Up Your Website](https://www.namehero.com/blog/4-caching-strategies-that-will-speed-up-your-website/)
- [How to Track Competitor Website Traffic in 2025](https://www.namehero.com/blog/how-to-track-competitor-website-traffic/)
- [What Is Direct Traffic? (And How to Track It)](https://www.namehero.com/blog/what-is-direct-traffic-and-how-to-track-it/)
