Adam Brzostek
Reading time: 12:00

Consent Exception Tracking: understand it and set it up yourself

Web analytics has always had a built-in measurement error caused by ad blockers and other tracking restrictions. Even so, the share of lost data was small enough that the numbers stayed reliable and statistically significant, and you could base sound business decisions on them.

Since 2024, when the Digital Services Act came into force and required website owners to obtain consent for tracking based on client-side identifiers, working with data has become genuinely hard. A high consent rejection rate combined with Google Analytics' opaque algorithms can make reliable statistics practically impossible.

Does that mean we have no choice but to make decisions based on trends of questionable quality?

Not quite.

Consent exception tracking is a specific model that allows analytics tracking without consent. The idea is that you collect fully anonymized data that cannot identify the user in any way and is used for statistics only.

To use this model in compliance with GDPR, you have to meet a few essential prerequisites:

  • Full IP anonymization - the IP address must be truncated as soon as any request is received
  • No fingerprinting - you don't collect any device data that could identify the device
  • No cross-site tracking - you can't track the user on third-party sites
  • No data export - the data can only be used for your own purposes and can't be shared with any third parties, such as marketing platforms like Google or Meta.

This means consent exception tracking lets you collect information about every interaction that happens on your site. The downside is that you give up user-level analysis entirely, including telling new users from returning ones.

Besides event data, this model allows short-lived session identifiers that group the collected events into a single visit, provided they don't live longer than one session.

So with this approach you can collect not only the number of events, but also the number of sessions, and see what happened during those sessions.

What about traffic sources?

More good news: this model lets you collect traffic source data, but attribution only works on a last click (direct included) basis. That's because there is no persistent identifier linking a user's visits over time, so you can only rely on data within a session.

This leads to another quirk that sets this attribution apart from the last click model you know from Google Analytics, for example. In consent exception tracking, direct traffic gets more credit, because unlike last non-direct click, it isn't ignored when a returning customer comes back.

What about device data, then?

Device data lives in the HTTP header called User-Agent. You can read it, but you have to keep it general enough that you don't accidentally create a user fingerprint. Here is what you can use:

Data dimensionCan we use it?Notes
Device typeYESYou'll see a breakdown into Desktop, Mobile, Tablet, Smart TV. This is low-uniqueness data, so it's safe.
Operating systemYESYou'll see: Windows, Android, iOS, Linux.
OS versionPartiallyInstead of "Android 13.0.1" you may only see "Android 13" or just "Android". A version that is too precise is risky.
BrowserYESYou'll see: Chrome, Safari, Firefox.
Screen resolutionNO / LimitedIn strict privacy mode (e.g. the CNIL configuration in Piwik PRO/Matomo), this parameter is often removed or rounded, because it strongly points to a specific phone or monitor model.
Device brand/modelNO / LimitedInstead of "Samsung Galaxy S22 Ultra" you may see a generic "Samsung" or "Android Device".

So I won't have any information about the user?

The line is very thin here, but if you meet a few conditions, you can collect a user ID.

First of all, the rules from the first section of this article still apply: collecting a User ID should serve technical or security purposes, not marketing.

To be on the safe side, hash the user ID before storing it.

Second, your terms of service are the foundation. If the terms users accept when they register state that you'll use their data to analyze behavior on your site, you're entitled to send the user ID without consent from the CMP.

Popular analytics platforms already offer consent exception tracking.

Google Analytics

With the right GTM configuration, you could say that Google Analytics works in this model to some extent. I mean a setup based on Advanced Consent Mode, where GA4 tags fire even without consent and send pings to the tool, that is, signals stripped of certain information, including the client ID and session ID. It's a specific form of consent exception tracking, because the GA interface doesn't show actual data, only modeled data. You'll find more on this in the official documentation: https://support.google.com/analytics/answer/11161109?hl=pl

Piwik Pro

Another platform that offers this data collection model is Piwik Pro, which has two versions of this kind of tracking:

  • anonymous tracking with a session hash: it doesn't use cookies, but generates a short-lived session hash (e.g. for 30 minutes) from the anonymized IP address and the User-Agent (browser data). This lets you group events into a single visit, but you can't recognize a returning user the next day.
  • anonymous tracking (no cookies, no session hash): the main subject of this article. Piwik PRO stores nothing in the browser and creates no hash linking events. Every page view and every click (ping) is a completely independent, isolated entity for the server.

We've already covered the second model in detail on our blog: https://bettersteps.pl/en/blog/analytics-without-consent-piwik-pro-test

Ilustracja: Glowna grafika Cookie Consent 1 – Jakie platformy oferują model consent exception tracking?

Your own system

The last option is to build your own system. You can do it with server-side tracking and Google BigQuery, and that's the setup I'll walk you through in this article.

Cookie less consent exception tracking schema – Jak wdrożyć consent exception tracking?

Here is how the system will work. On the client side, we'll send data to sGTM with the Stape Data Tag, and sGTM will pass the data straight to a dedicated BigQuery table through an HTTP POST request handled by a Cloud Run instance we'll create.

Subscribe to the newsletter to read the rest of this article

Join the Bettersteps newsletter to read the full article for free

When you sign up with this form, you'll get access to the full article, plus an email with a link to download ready-made JSON files for the GTM web and GTM server containers and the configuration files for Google Cloud

Related articles

Get in touch

Characters left:
2000