Cloudflare's Google Tag Gateway Can Bypass Cookie Consent in Practice

Cloudflare Google Tag Gateway and cookie consentCloudflare Google Tag Gateway and cookie consent

Google and Cloudflare market Google tag gateway for advertisers as a performance win: first-party cookies, better signal recovery, improved ad measurement — all without running your own server. In a production setup we audited, enabling the Cloudflare integration caused tracking to fire even when users clicked Reject on a working consent banner. Because the gateway runs in front of your page, it can effectively sit outside your client-side consent logic if it’s not configured in a consent‑aware way.

I pay attention to tag gateway because we run Google Ads for clients and are always looking to squeeze more performance out of campaigns. When Cloudflare rolled out its integration — first-party measurement, no server to run, easy toggle in the dashboard — it sounded like a straightforward upgrade. In a recent audit, I found something more worrying: in a real Cloudflare + consent banner + GTM setup, turning Tag Gateway on caused GA4, Ads, and LinkedIn requests to fire even after users clicked Reject. GTM was correctly blocked, but measurement still flowed through a Cloudflare-controlled endpoint.

Key Takeaways

  • If you use Cloudflare and have a consent banner, check Engagement > Google tag gateway. If enabling it results in tracking after Reject, consider disabling it until you have a verified, compliant setup.
  • Test the reject path in DevTools Network tab; filter for securemetriccloudflare (or the measurement path your GTG deployment uses) to see if tracking is being proxied outside your consent layer.
  • Until Google or Cloudflare provide clearer consent-aware patterns for tag gateway, treat it as an infrastructure change that can affect compliance, not just performance.
  • Document the trade-off for your team: GTG can improve measurement and ad performance, but in some configurations it may run before or around client-side consent.

We discovered this while debugging a consent setup that was correct in every way we could verify. The banner worked. The cookie was set. Google Tag Manager never loaded when users rejected. And yet GA4, Google Ads, and LinkedIn tracking requests still fired. In this case, the requests went through the measurement path Cloudflare uses for proxied traffic (e.g. /securemetriccloudflare), not through googletagmanager.com. Our client-side consent logic had no way to stop those proxied requests.


What Google Tag Gateway Does (According to Google)

Google tag gateway lets you serve Google tags (GA4, Google Ads) from your own domain instead of Google’s. Cloudflare’s integration makes it a one-click setup: enable it in the Cloudflare dashboard or Google tag console, and requests that would normally go to googletagmanager.com or google-analytics.com get routed through your domain instead.

The benefits are real: first-party cookies survive better in a world of third-party cookie blocking. Measurement signals improve. Early testers reportedly saw an average uplift in data signals. The setup requires no changes to your existing tag snippets. It’s free.

Where things get tricky is how this interacts with consent. Google’s documentation notes that enabling tag gateway affects tag firing and explicitly points you back to Consent Mode and consent settings, but it does not walk through concrete edge cases like the one we hit. Because the gateway operates at the infrastructure layer (for example, on Cloudflare’s edge), it can proxy measurement traffic before or outside your page’s JavaScript. If your setup only blocks or loads GTM based on a consent cookie, that logic may never touch traffic that the gateway is handling directly.


How We Found It

We had a Basic Consent Mode setup: GTM loads only when the user accepts. On reject, the head script reads the cookie, sees denied, and returns without loading GTM. No googletagmanager.com requests. Clean.

Except the Network tab showed GA4, Google Ads, and LinkedIn requests anyway. They appeared as calls to the measurement path Cloudflare uses for proxied traffic (in our case, /securemetriccloudflare). The gtm parameter in the URLs indicated the requests originated from tag configuration, but GTM itself never loaded. The working hypothesis: something at the infrastructure level was injecting or proxying these tags independent of our client-side consent code.

Cloudflare Dashboard > Engagement > Google tag gateway: enabled. We disabled it. The tracking stopped.

That doesn’t prove this behavior will occur in every environment, but it is enough to treat tag gateway as a potential consent‑bypass vector that deserves explicit testing.


The Fix

Cloudflare Dashboard > select your domain > Engagement > Google tag gateway > Disable.

That was all it took in this case. No code changes. No GTM configuration adjustments. In our client’s setup, the gateway configuration was the missing piece that allowed tracking to continue after Reject.

If you want to keep GTG, you’ll need to work with your CMP, Consent Mode implementation, and Cloudflare/GTM configuration until you can prove — via network traces — that no tracking runs contrary to user choice.


The Trade-Off

Google tag gateway is a powerful tool. First-party measurement improves conversion attribution and remarketing, and the uplift figures Google shares are meaningful for advertisers who depend on accurate data.

Disabling it means you lose those benefits. Tracking runs only when your consent layer allows it — via GTM when the user accepts. For sites that must comply with GDPR, CCPA, CIPA, or similar frameworks, that’s the correct behavior. But it’s a trade-off that’s easy to miss if you treat GTG as a pure performance switch rather than a change to how tags are delivered.

Until Google or Cloudflare offer clearer, consent-aware guidance and patterns — ideally with ways for the gateway to take consent state into account before proxying tags — you should assume there is work to do to make GTG and consent coexist. In some stacks, the practical choice today may still feel like “more data with more risk” versus “less data with clearer compliance.”

Google Tag Gateway consent behavior and compliance trade-offGoogle Tag Gateway consent behavior and compliance trade-off


Why This Matters for Practitioners

From Cookie Consent and the Enforcement Underground: “A consent layer that fires tracking before the user responds is not compliance. It’s documentation of the violation.”

If you’re responsible for a site that uses both Cloudflare and a consent banner, tag gateway can create exactly that scenario if you’re not careful. Your banner looks compliant. Your GTM configuration is correct. But the gateway can fire tags at the edge or via a proxy endpoint before your consent logic runs. Automated scanners and plaintiff firms looking for CIPA or GDPR violations will see the tracking. Your consent layer won’t protect you unless it controls all the ways measurement can leave the browser.

Test the reject path. Open DevTools > Network. Reject consent, reload, and filter for securemetriccloudflare (or whichever measurement path your GTG deployment uses), google.com/ccm, linkedin.com, facebook.net, bat.bing.com. If you see requests after rejecting, something is bypassing your consent layer. For Cloudflare users, the tag gateway configuration is the first place to check.


Sources and Further Reading

Disclaimer: This article describes behavior observed in a specific production setup using Cloudflare, Google Tag Gateway, and a consent banner. Your implementation, legal obligations, and risk profile may differ. Always validate behavior in your own environment and consult your legal counsel about consent and tracking compliance.
Digital marketing agency for SEO, paid media, and marketing systems. Flat-rate retainers, no spend markups. Lexington, KY.

Back to articles...