1Consent with Google tag gateway
Google tag gateway for advertisers serves Google's tags from a path on your own domain, such as /metrics, instead of www.googletagmanager.com. Your CDN forwards everything under that path to Google. Cloudflare can turn the gateway on for a whole zone.
What changes on your pages
With the gateway, the page requests Google's tags from your measurement path. The gateway addresses below are from Google's manual setup guide, with /metrics as the path; the Tag Manager address without the gateway is from Google's data layer guide:
| Tag | Without the gateway | With the gateway |
|---|---|---|
| Tag Manager container | https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX | /metrics/?id=GTM-XXXXXX |
| Google tag (gtag.js) | https://www.googletagmanager.com/gtag/js?id=G-XXXXXX | /metrics/ |
| Measurement requests | Google's domains | Under /metrics/ |
Keep 1Consent ahead of the Google tags
- Re-tag your pages yourself. Use Google's guided or self-service setup, not the automated script setup. Google's help says to turn off automated script setup if you use Consent Mode. Cloudflare's dashboard setup replaces an existing Tag Manager script with its own. Either way, you no longer control where the Google tag is placed, so 1Consent cannot be sure to run first.
- Website script install: keep the 1Consent script synchronous and above the gateway snippet. The 1Consent script queues the Consent Mode defaults in the data layer before it returns. A Google tag reads the same data layer wherever it is served from.
- GTM template install: nothing changes. The 1Consent CMP template sets the defaults inside your container, so the container's address does not matter.
Google's setup guide says the gateway does not support the GTM <noscript> snippet. Follow the Google Tag Manager guide for <noscript> and for setting up consent checks in your container.
Automatic blocking does not hold gateway-served Google tags
1Consent's automatic blocking does not hold Google tags served through Google tag gateway. It recognises Google tags by Google's own domains, and a gateway path is on your domain. Without the gateway, automatic blocking holds a Google tag until the visitor consents. With the gateway, the tag loads before the visitor chooses.
What that means on a gateway site that relies on automatic blocking:
- Without Consent Mode: Google Analytics runs before the visitor chooses.
- With Consent Mode: the Google tag loads before the visitor chooses and starts with the Consent Mode defaults 1Consent sets. With denied defaults, Google's tags send cookieless requests until the visitor consents. A Google tag you load yourself from a gateway path behaves this way in Basic mode too, although Basic mode otherwise loads the Google tag only after consent.
To hold Google tags until the visitor consents, use one of these two ways:
- Additional consent checks in Google Tag Manager. Set up consent checks for each tag in your container (Tag Manager's additional consent checks), as the Google Tag Manager guide describes, so a tag fires only with the consent it needs. The container itself still loads before the visitor chooses: Consent Mode's built-in checks change how Google tags behave, they do not stop the container from loading. For strict Basic mode, also wrap the gateway container snippet in a service template as in the second way, so the container loads only after consent.
- A service template around the snippet. Wrap the whole gateway snippet in a service template. It stays inert until the visitor consents to that service, wherever the script is served from. The template value must identify a service on your banner; see Gate third-party scripts.
<template data-1c-service-tag="google-analytics-4">
<script async src="/metrics/"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXX');
</script>
</template>Banner A/B tests
While a banner A/B test assigns a visitor to a variant, 1Consent holds scripts from www.googletagmanager.com until that variant's Consent Mode defaults are set. It does not hold a script from your gateway path, so a gateway-served Google tag can start before those defaults exist. If you run banner A/B tests with Consent Mode, wrap the gateway snippet in a service template as shown above.
The scan warning
When a scan finds Google tags served through Google tag gateway and a published banner of your site uses automatic blocking, the scan's results page shows a warning. It names the gateway paths the scan found and links to this guide. The scan cannot tell whether your own consent checks or a service template already hold those tags, so the warning says what happens unless they do. There is no warning for Tag Manager loaded from Google's own domain, or when no published banner of your site uses automatic blocking. A site that already uses the gateway shows the warning after its next scan.
Scans
1Consent scans recognise these gateway requests and report them as the same Google services as a direct install:
- the Tag Manager container loader,
/metrics/?id=GTM-XXXXXX, as Google Tag Manager; - GA4 measurement requests the gateway-served tag sends under the measurement path, as Google Analytics;
- other scripts under the measurement path, as Google Tag Manager, once the same scan has seen one of the two requests above for that path.
A scan does not recognise a gateway path that serves only a Google Ads tag, and it does not recognise Google Ads measurement requests sent through the gateway. They appear as unidentified requests to your own site.
Check your setup
- In Tag Assistant, open Summary → Output → Hits Sent and check that hits go to your measurement path.
- In your browser's developer tools, check that the 1Consent script loads before any request to your measurement path.
- In the console, run
dataLayerbefore choosing anything in the banner. Theconsent,defaultentry must come before the first Google tag entry (gtm.jsorconfig).
Sources
- Google: Set up Google tag gateway for advertisers
- Google: The data layer
- Google Help: Set up Google tag gateway for advertisers in the Google tag with Cloudflare
- Cloudflare: Google tag gateway for advertisers
Google Tag Manager
Set up Google Consent Mode v2 with the Google tag, a website script alongside GTM, or the 1Consent CMP template. Verify how your tags respond to visitor choices.
Lovable
Add 1Consent to a Lovable app with one prompt, for both TanStack Start and Vite projects, then verify the published site. Connecting the MCP for later edits is optional.