Google Tag Gateway
7 min
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 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 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 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