Skip to content
EARNST.
DE
Tracking & Compliance

Consent Debugging: How to Find Tracking Violations Before the Data Protection Authority Does

Tags fire before consent, cookies survive rejection, consent signals never reach GTM. Here is how to systematically uncover violations.

EARNST · · 14 min read

Key Takeaways

  • In 7 out of 10 setups, tags fire before consent or cookies survive rejection
  • A systematic consent debugging tool replaces manual spot checks with automated violation detection
  • Three audit levels: consent timing, cookie hygiene, signal integrity
  • CSV/JSON export delivers audit-ready documentation for DPOs and regulatory authorities

Most tracking setups look correct in the GTM Preview. Tags fire, events arrive in GA4, the banner works. But "looks correct" and "is GDPR-compliant" are two different things.

In 7 out of 10 audits, we find consent violations that are invisible at first glance. A GA4 tag that fires 200 milliseconds before the consent signal. A cookie that survives rejection. A consent update that never reaches the SST container. Each of these errors is a potential GDPR violation, and none of them show up in standard debugging.

This article shows how to find consent violations systematically: with a methodology that replaces manual spot checks with automated detection.

Why standard debugging is not enough

GTM Preview Mode shows which tags have fired and which variables are set. That is helpful for functional testing, but useless for compliance testing. Three examples.

Timing problem. GTM Preview shows Tag A has fired. But did Tag A fire before or after the consent signal? The Preview shows the order of DataLayer pushes, but not the millisecond-precise relation between gtag('consent', 'default', ...) and the first GA4 hit. A tag that fires 150ms before the consent default is a violation. In GTM Preview, everything looks normal.

Cookie persistence. The user clicks "Reject". GA4 stops. But the _ga cookie lives on, because it was set during a previous visit and the current consent update does not delete it. On the next visit, GA4 reads the cookie before the banner even appears. This is not visible in Preview, because Preview always tests with fresh cookies.

Signal integrity. gtag('consent', 'update', ...) is processed correctly in the client-side container. But does the signal also reach the SST container? If the SST container does not receive the consent signal, tags there fire without consent context. Nobody checks this who only uses the client-side Preview.

The three audit levels

Consent debugging only works when all three levels are tested systematically. Skip one level and you get false confidence.

Level 1: Consent timing

The question: Are consent defaults in place before the first tag fires?

The most common error: GTM loads before the consent defaults. The first 200 to 500 milliseconds of a session fire tags without a consent signal. GA4 cannot start Behavioral Modeling for these hits. Google Ads receives the first pageview without an ad_storage signal. These are not edge cases. This is the default state in setups with external CMPs that load as separate scripts.

How to test it:

  1. Chrome DevTools > Network > filter all requests for google-analytics.com and googleads.g.doubleclick.net
  2. Note the timestamp of the first GA4 request
  3. In the Console tab, search for the gtag('consent', 'default', ...) call
  4. Compare: did the consent default come before the first tracking request?

A consent debugging tool automates this: it logs every DataLayer push with a millisecond timestamp and flags violations when a tracking event precedes the consent default.

Level 2: Cookie hygiene

The question: Are all non-essential cookies deleted upon rejection?

The most common error: The banner sets the consent state correctly, but does not clean up existing cookies. A _ga cookie from a previous session survives rejection. This is technically not a new cookie being set, but it is problematic under data protection law: you are reading a cookie ID that the user has not (re-)approved.

How to test it:

  1. Visit the shop, accept all cookies
  2. Chrome DevTools > Application > Cookies: document all cookies
  3. Revoke consent (reopen banner, reject)
  4. Compare the cookie list: are _ga, _gid, _fbp, _fbc and other tracking cookies gone?
  5. Reload the page: do the cookies come back even though consent is set to "denied"?

A debugging tool tracks the cookie state before and after every consent change and reports violations automatically.

Level 3: Signal integrity

The question: Does the consent signal reach every container and every tag?

The most common error: The client-side GTM container receives the consent update correctly. But the SST container has its own tag configurations that do not check the consent state. Or a Custom HTML tag in the client container loads an external script that does not support Consent Mode.

How to test it:

  1. GTM > Client container: check all tags for consent signal reactions
  2. GTM > SST container: verify that incoming requests contain the gcs parameter (Google Consent State)
  3. Network tab: after rejection, no requests should go to facebook.com, google-analytics.com (without consent parameters), or other third parties
  4. Web Pixel: verify that the pixel reads the consent cookie and configures its GTM instance accordingly

Building a consent debugging tool

Manually testing the three levels takes 30 to 45 minutes per page. For a shop with 5 page types (Home, Collection, Product, Cart, Checkout), that is 2.5 to 3.5 hours. And the test must be repeated after every deployment.

The alternative: a debugging tool that runs directly in the frontend and detects violations in real time.

Architecture

The tool consists of a Liquid file (snippet) that is embedded in the theme. It renders a debug panel in the frontend, visible via a query parameter (e.g. ?consent-debug=true) or a keyboard shortcut. No external dependencies, no performance impact during normal operation.

What the tool checks

Consent state monitoring: Displays the current consent state for all four signals (analytics_storage, ad_storage, ad_user_data, ad_personalization) in real time. Updates with every consent change.

Violation detection: Logs every DataLayer push with a timestamp. Flags events that fire before the consent default or after a rejection. Counts violations per session.

Cookie inventory: Lists all cookies with name, domain, expiration, and category. Flags cookies that still exist after a rejection.

Tag inventory: Lists all loaded scripts and their consent dependency. Identifies scripts that load without a consent signal.

Export for audits

The tool exports all collected data as CSV or JSON. The export contains: timestamp, event name, consent state at the time of the event, violation type (if applicable), cookie state before and after the event.

This export is not a nice-to-have. During a GDPR audit, you must be able to prove that your tracking respects consent. An export from the debugging tool is audit-ready documentation.

QA checklist for consent compliance

Use this checklist after every deployment that contains tracking-relevant changes.

Pre-deployment

  1. GTM Preview: all tags checked for consent triggers?
  2. New tags: consent requirement configured?
  3. Custom HTML tags: do they load no external scripts without a consent check?
  4. SST container: consent signal is passed through?

Post-deployment (5 page types)

For each page type (Home, Collection, Product, Cart, Checkout):

  1. First visit without cookies: banner appears, no tracking requests before consent
  2. Accept: GA4, Google Ads, Meta fire correctly
  3. Reject: no tracking requests, no tracking cookies
  4. Revoke consent: tracking stops, cookies are deleted
  5. Return visit with stored consent: banner does not appear, tracking runs according to stored state

Shopify-specific

  1. Web Pixel: reads consent cookie correctly, fires Purchase only with consent
  2. Shopify Customer Privacy API: setTrackingConsent() is called, visitorConsentCollected event fires
  3. Regional control: non-EU visitors see no banner (if implemented)
  4. Consent audit log: consentId() returns an ID, entry exists in Shopify Admin

Common violations and their causes

Violation Cause Fix
GA4 hit before consent default GTM script in <head> before consent defaults Consent defaults as the very first line in <head>
_ga cookie after rejection Consent update does not delete existing cookies Explicitly delete all tracking cookies upon rejection
Meta Pixel fires after rejection Meta Pixel as Custom HTML without consent trigger Configure consent trigger for Meta tags
SST tags without consent signal gcs parameter is not forwarded to the SST container Check GA4 client in SST, configure consent forwarding
Web Pixel fires without consent Consent cookie is not read in the Pixel Implement browser.cookie.get() for consent cookie
Consent signal does not reach GTM gtag('consent', 'update', ...) is not pushed to the DataLayer Ensure DataLayer push directly after setTrackingConsent()

Automation: consent tests in the CI/CD pipeline

For teams that regularly work on tracking, integrating consent tests into the deployment pipeline is worthwhile.

Playwright or Cypress can automate consent flows: load page, verify banner appears, grant consent, verify tags fire, revoke consent, verify tags stop. These are not unit tests but end-to-end tests that simulate the real user flow.

Post-deployment monitoring: A cron job that crawls the most important pages hourly with the debugging tool and reports violations via Slack or email. No more manual checks after every deployment.

Conclusion

Consent debugging is not an optional step. It is the only method to ensure that your tracking actually respects consent: not just on paper, but in practice.

The three levels (timing, cookie hygiene, signal integrity) cover the most common violations. A debugging tool with export functionality delivers the documentation you need during a GDPR audit. And the QA checklist ensures that new deployments do not cause regressions.

How compliant is your current setup? Our GDPR & Compliance Audit checks 17 areas, including consent timing and cookie hygiene.

Our service

GDPR & Compliance Audit

We analyze your tracking infrastructure. GDPR score, accessibility check, actionable recommendations.

Learn more