The opt-in rate of the cookie bar shows how many consents I get. A high opt-in rate is good because it means I get a lot of consents.
If we want to measure it, we need a more precise definition.

Why you need to know the opt-in rate
The most important reason is that I need to know how much I can trust the measured data. There is a significant difference between having 30% of data in GA4 and 70%.
Marketing codes, which are key to the AI algorithms that drive your campaigns, are also linked to the consent given on the cookie bar. The opt-in rate therefore also affects campaign performance.
If you want to work with the cookie bar and optimize it, you will need to know the opt-in rate.
Oh, that definition
However, there is no clear standard definition of opt-in rate. You can find at least 3–4 different definitions online in a matter of moments.
However, it is always a ratio where the numerator is the number of clicks on “I agree to everything.” What the denominator is is not entirely clear. The number of visits? People? Something else?
If you use Google Analytics, you might think of the number of sessions. The problem is that if you don’t get consent on the first page, the number of sessions cannot be calculated correctly – you don’t have consent to create cookies.
You can use the number of people who saw the cookie bar. But here again, you run into the problem of how to determine the number of people when you don’t have consent.
You can look at the reports offered directly by cookie bar tools. For example, in CookieHub, you can use the number of sessions. Note that this is a completely different metric than sessions in GA4! CookieHub (and other cookie bars) considers a session to be the loading of the script that downloads the cookie bar. This is then stored in the browser for 24 hours, after which it is downloaded again. So you can only do one session per day on the website. Furthermore, it does not distinguish whether a person has already given their consent or not.
You can use the number of cookie bar views.
So what should you choose?
What do I want from the opt-in rate?
First, you need to clarify what you want from the cookie bar. Typically, it is:
To get as many people as possible to click “I agree to everything”
People to click on “I agree to everything” as soon as possible – ideally on the first page. Because if you don’t get consent on the first page, you lose key data for marketing.
And these two requirements must be described by the opt-in rate.
How I calculate the opt-in rate
I ended up calculating the opt-in rate as
Opt-in rate = count of “consent with all”⁄count of displays
Examples:
- A person clicks “I agree to everything” right on the first page:
Opt-in rate = 1⁄1 = 100 % - A person ignores banners on the first page and gives his/her consent on the second page:
Opt-in rate = 1⁄2 = 50 % - There were two people on the website, the first rejected the banner, the second allowed it on the first page.:
Opt-in rate = 1⁄2 = 50 % - There were two people on the website, both of whom rejected the banner:
Opt-in rate = 0⁄2 = 0 %
I use this calculation method because it has two advantages:
- The resulting metric meets the requirements—it deteriorates if people do not give their consent. At the same time, it deteriorates if people do not give their consent on the first page.
- Measuring the opt-in rate in this way is simple—all you need is the number of clicks and the number of views. You can get both from GA4 connected to BigQuery if you send anonymous pings. A little scripting in GTM is usually enough to set it up.
At the same time, I don’t use the metrics reported by (otherwise) my favorite CookieHub. Because if you examine its exact definition, the results are misleading.
What next?
- Check that you are measuring the opt-in rate on your website.
- Find out what the definition of the opt-in rate you are measuring is (what you are actually measuring).
And always pay attention to the definition of metrics. Because the opt-in rate rate can be a completely different metric than the opt-in rate rate.