{"id":74,"date":"2026-07-10T13:37:00","date_gmt":"2026-07-10T11:37:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=74"},"modified":"2026-07-05T23:25:33","modified_gmt":"2026-07-05T21:25:33","slug":"implementing-google-tag-gateway-a-complete-guide","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/","title":{"rendered":"Implementing Google Tag Gateway: A Complete Guide"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In an era of tightening privacy restrictions (such as ITP in Safari) and the growing popularity of ad blockers, maintaining high-quality analytical data is a significant challenge. The solution is the <strong>Google Tag Gateway (GTG)<\/strong>. This involves routing analytical traffic through your own domain (a first-party context), which allows for extending cookie lifespans and bypassing basic blockades.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How do you implement this mechanism? The architecture depends on your current setup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Two Implementation Scenarios<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The approach to Google Tag Gateway differs depending on whether you already use Server-Side GTM or rely solely on browser-based implementation.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>Scenario<\/strong><\/td><td><strong>How it works<\/strong><\/td><td><strong>When to choose?<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>Client-Side GTM Only<\/strong><\/td><td>Reverse Proxy directly tunnels requests to Google servers (e.g., downloads <code>gtm.js<\/code> and forwards Google Analytics hits).<\/td><td>When you want to quickly obtain first-party cookies and bypass ad blockers without the costs of GTM server infrastructure.<\/td><\/tr><tr><td><strong>Client-Side + Server-Side GTM<\/strong><\/td><td>Browser traffic reaches your Server-Side GTM container via a Reverse Proxy, which processes the data before sending it to external tools.<\/td><td>When you want full control over data, IP masking, and integration with server-side conversion APIs. This is the recommended approach.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Quick Deployment with Cloudflare<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If your domain uses Cloudflare, creating a tag gateway is extremely simple using <strong>Cloudflare Workers<\/strong>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a new script in the Cloudflare Workers section.<\/li>\n\n\n\n<li>Configure the script to intercept traffic from a path (e.g., <code>[yourdomain.com\/gtg\/](https:\/\/yourdomain.com\/gtg\/)<\/code>) and forward it to Google servers or the address of your Server-Side GTM container.<\/li>\n\n\n\n<li>Set appropriate HTTP headers (especially <code>X-Forwarded-For<\/code> and <code>X-Forwarded-Host<\/code>) to maintain correct client IP addresses.<\/li>\n\n\n\n<li>Attach the script to a specific path in the &#8220;Triggers&#8221; tab using routing rules.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Cloudflare will act as a lightning-fast Reverse Proxy operating at the edge of the network, ensuring minimal latency for users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Webmaster-Side Changes (Reverse Proxy)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Launching the Gateway is only half the battle. Your website must start using it. The webmaster or developer must make the following changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>GTM Script Update:<\/strong> Instead of loading GTM from <code>[https:\/\/www.googletagmanager.com\/gtm.js](https:\/\/www.googletagmanager.com\/gtm.js)...<\/code>, the code must point to your new path, e.g., <code>[https:\/\/yourdomain.com\/gtg\/gtm.js](https:\/\/yourdomain.com\/gtg\/gtm.js)...<\/code>.<\/li>\n\n\n\n<li><strong>GA4 Transport URL Change:<\/strong> In the Google Analytics 4 (or Google Tag) configuration, the <code>transport_url<\/code> parameter must be overwritten so that hits are sent to your Reverse Proxy address.<\/li>\n\n\n\n<li><strong>CORS Verification:<\/strong> The webmaster must ensure that <em>Cross-Origin Resource Sharing<\/em> headers do not block requests sent to the new subdomain or path.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Load Balancer in Google Cloud for GTG + Server-Side GTM<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For large e-commerce projects where traffic is counted in millions of sessions, a single entry point may not be enough. Implementing Server-Side GTM in the Google Cloud Platform environment (e.g., using Cloud Run) requires creating a professional Load Balancer (GCP HTTP\/S Load Balancing).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure a <strong>Serverless Network Endpoint Group (NEG)<\/strong> that connects the Load Balancer with your SS GTM container instances in Cloud Run.<\/li>\n\n\n\n<li>Reserve a global, static IP address in the GCP panel to assign it to the A record in your DNS system.<\/li>\n\n\n\n<li>Deploy a <strong>Google-managed SSL certificate<\/strong> on the Load Balancer to automatically manage HTTPS certificates for your analytical subdomain (e.g., <code>metrics.yourdomain.com<\/code>).<\/li>\n\n\n\n<li>Create <strong>Routing Rules<\/strong> (URL map) that direct the relevant analytical traffic directly to the GTM servers.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks to this architecture, your solution will automatically scale based on traffic volume (e.g., during Black Friday), guaranteeing full stability.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In an era of tightening privacy restrictions (such as ITP in Safari) and the growing popularity of ad blockers, maintaining high-quality analytical data is a significant challenge. The solution is the Google Tag Gateway (GTG). This involves routing analytical traffic through your own domain (a first-party context), which allows for extending cookie lifespans and bypassing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-digital-analytics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog\" \/>\n<meta property=\"og:description\" content=\"In an era of tightening privacy restrictions (such as ITP in Safari) and the growing popularity of ad blockers, maintaining high-quality analytical data is a significant challenge. The solution is the Google Tag Gateway (GTG). This involves routing analytical traffic through your own domain (a first-party context), which allows for extending cookie lifespans and bypassing [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-10T11:37:00+00:00\" \/>\n<meta name=\"author\" content=\"luky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"luky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/\"},\"author\":{\"name\":\"luky\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Implementing Google Tag Gateway: A Complete Guide\",\"datePublished\":\"2026-07-10T11:37:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/\"},\"wordCount\":536,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"articleSection\":[\"Digital Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/\",\"name\":\"Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"datePublished\":\"2026-07-10T11:37:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/implementing-google-tag-gateway-a-complete-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Implementing Google Tag Gateway: A Complete Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"luky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"luky\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/author\\\/luky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/","og_locale":"en_US","og_type":"article","og_title":"Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog","og_description":"In an era of tightening privacy restrictions (such as ITP in Safari) and the growing popularity of ad blockers, maintaining high-quality analytical data is a significant challenge. The solution is the Google Tag Gateway (GTG). This involves routing analytical traffic through your own domain (a first-party context), which allows for extending cookie lifespans and bypassing [&hellip;]","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-07-10T11:37:00+00:00","author":"luky","twitter_card":"summary_large_image","twitter_misc":{"Written by":"luky","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/"},"author":{"name":"luky","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Implementing Google Tag Gateway: A Complete Guide","datePublished":"2026-07-10T11:37:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/"},"wordCount":536,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"articleSection":["Digital Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/","name":"Implementing Google Tag Gateway: A Complete Guide - Lukas Wojcik - Blog","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"datePublished":"2026-07-10T11:37:00+00:00","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/implementing-google-tag-gateway-a-complete-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Implementing Google Tag Gateway: A Complete Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"luky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"luky"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"],"url":"https:\/\/www.lukaswojcik.com\/blog\/author\/luky\/"}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":2,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}