Google Tag Gateway
Google Tag Gateway (GTG) is a feature that allows you to deliver your Google tracking tags, such as a Google Tag Manager (GTM) container, directly from your own website's infrastructure, like a Content Delivery Network (CDN) or a web server, instead of relying directly on Google's servers.
This gives you greater ownership and control over how your tracking scripts are delivered to your visitors.
Why Publishers Adopt GTG
Integrating Google Tag Gateway offers significant strategic advantages for publishers looking to optimize their data infrastructure and monetization:
- First-Party Data Ownership: Serving tracking scripts directly from your own domain removes reliance on third-party endpoints, giving you complete control over your data delivery path.
- Mitigation of Browser Restrictions: By routing traffic through a first-party architecture, GTG helps bypass strict browser privacy features (like Apple's ITP) and standard ad-blockers, preventing loss of critical analytics and revenue data.
- Extended Cookie Lifespan: It enables the creation of durable, first-party cookies that resist automatic browser deletion, ensuring accurate long-term user recognition and conversion attribution.
- Optimized Site Performance: Delivering scripts via your existing CDN infrastructure allows for edge-caching closer to your audience, reducing page latency and improving Core Web Vitals.
For official details and technical specifications, please refer to Google's documentation: https://developers.google.com/tag-platform/tag-manager/gateway
Managing "Late Consent"
While GTG improves how scripts are delivered, it can complicate the timing of user consent. A common issue is "Late Consent."
When using automated "one-click" setups on a CDN, the tracking scripts might be delivered to the user's browser incredibly fast, often before your CMP has fully loaded.
As a result, the Google tag might activate and start collecting data before the user has had a chance to set their privacy preferences.
In a traditional manual setup, you control the exact order in which scripts load in your website's code. Automated deployments remove this control. To ensure your website respects user privacy and complies with data regulations, you must address this timing issue by following the resolution steps at the end of this document.
Verification and Troubleshooting
1. Verifying Your GTG Integration
Simply turning on the gateway does not guarantee it is working correctly. You must actively verify the setup.
- The Recommended Verification Method: We highly recommend using official Google properties, such as Google Tag Manager or Google Tag Assistant, to confirm your setup. These tools are specifically built to interact with Google's infrastructure and provide the most reliable, accurate confirmation that your tags are successfully routing through your personal gateway.
- Please use this tool to verify your tag is loading correctly: https://support.google.com/tagmanager/answer/16816376
- A Warning on Alternative Methods: We cannot guarantee the accuracy of results from other testing methods, such as inspecting the "Network" tab in your browser's developer tools or using third-party network scanners. Because of how Google processes tag requests through a gateway, these alternative tools often display incomplete or misleading data.
- Manual Setup (Configuring CDN Origin Rules): If you are setting up GTG manually (instead of using an automated partner integration like Cloudflare), you must create specific rules within your CDN or load balancer to route traffic correctly.
- First, create a routing rule that identifies the specific web path used for your tag (for example, /your-tag-path/*).
- Next, configure your server to forward these specific requests to the unique endpoint provided by Google (for example, <tag-id>.fps.goog).
- Crucially, ensure your rules override the Host header to match Google's endpoint, and confirm that your server is allowed to forward all necessary cookies and web queries (query strings).
- For step-by-step guidance on this manual setup, visit: https://developers.google.com/tag-platform/tag-manager/gateway
2. How to Detect Late Consent
To check if your tags are firing before user consent is captured, you can use the PubConsent GCM debug system.
- Open your configurator and enable the "debug" option. This will allow you to see background activity in your browser's developer console.
- Add ?pubtechGoogleTagsDebug=true to the end of your website's URL and press Enter, or type window.pubtech_google_tags_debug() directly into the console.
- Important: Make sure you interact with your website's cookie banner (click accept or reject) before you open the debug window, so the system has a baseline to check against.
Tip: Inside the PubConsent configurator, clearly select what you are trying to achieve (like Basic vs. Advanced Consent Mode). This helps the debugging tool give you more accurate and helpful advice.
3. Resolving Late Consent
If you cannot guarantee that your cookie banner will load before your tags, you must implement safety measures to ensure privacy rules are always respected.
A. Set Default Consent to "Denied"
You can configure your Google tags to automatically assume the user has denied consent until told otherwise. This acts as a safety net. Learn how to override consent mode defaults here: https://support.google.com/tagmanager/answer/12131703
B. Optimize Measurement for Exempt Regions
To keep your website analytics accurate in regions where you are not legally required to show a cookie banner, we recommend using "Advanced Consent Mode" alongside a specific setup in your PubConsent panel:
- Create a New Rule (Variant): In your CMP settings, create a variant and name it "GCM All Granted".
- Configure the Settings: Set the type to "Google Consent Mode" and enable global consent defaults. This tells the system that consent is automatically granted the moment the script loads.
- Apply to Specific Regions: Set your standard privacy setup as the default, but map this new "GCM All Granted" rule specifically to regions where automatic tracking is legally permitted.
C. Manual Implementation (Highest Control)
For the most reliable control over privacy timing, avoid using automated "one-click" installation methods. Instead, manually add the GTG code to your website. By doing this by hand, you can strictly order your website's code to ensure the cookie banner completely loads and initializes before the Google tag ever requests information.