</a>
</div>
<p>Google Tag Manager is <a href="https://radar.cloudflare.com/year-in-review/2024#website-technologies"><u>the most used tag management solution</u></a>: it makes a complex tagging ecosystem easy to use and requires less effort from web developers. That’s why we’re collaborating with the Ads measurement and analytics teams at Google to make the integration with Google tag gateway for advertisers as seamless and accessible as possible.</p><p>Site owners will have two options of where to enable this feature: in the Google tag console, or via the Cloudflare dashboard. When logging into the Google tag console, you’ll see an option to enable Google tag gateway for advertisers in the Admin settings tab. </p>
<figure>
<img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1QUzHjBrer762UOvypV2Fh/4695fb3996591f001bb02b1be88e41ad/image1.png" />
</figure><p>Alternatively, if you already know your tag ID and have admin access to your site’s Cloudflare account, you can enable the feature, edit the measurement ID and path directly from the Cloudflare dashboard: </p>
<figure>
<img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/amyXiwUzZ0X2V3BGzuOja/b4480e0fe1b420cf7942b0d0957fd6f5/image2.png" />
</figure>
<div>
<h3>Improved performance and measurement accuracy </h3>
<a href="#improved-performance-and-measurement-accuracy">
</a>
</div>
<p>Before, if site owners wanted to serve first-party tags from their own domain, they had to set up a complex configuration: create a CNAME entry for a new subdomain, create an Origin Rule to forward requests, and a Transform Rule to include geolocation information.</p><p>This new integration dramatically simplifies the setup and makes it a one-click integration by leveraging Cloudflare's position as a <a href="https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/"><u>reverse proxy</u></a> for your domain. </p><p>In Google Tag Manager’s Admin settings, you can now connect your Cloudflare account and configure your measurement ID directly in Google, and it will push your config to Cloudflare. </p>
<figure>
<img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2ToLjUY5vNVWV5AGjxeONF/b79b4b32c24080b2461860cea58232a3/image3.png" />
</figure><p>When you enable the Google tag gateway for advertisers, specific calls to Google’s measurement servers from your website are intercepted and re-routed through your domain. The result: instead of the browser directly requesting the tag script from a Google domain (<code>e.g. www.googletagmanager.com</code>), the request is routed seamlessly through your own domain (<code>e.g. www.example.com/metrics</code>).</p><p>Cloudflare acts as an intermediary for these requests. It first securely fetches the necessary Google tag JavaScript files from Google's servers in the background, then serves these scripts back to the end user's browser from your domain. This makes the request appear as a first-party request.</p><p>A bit more on how this works: When a browser requests <code>https://example.com/gtag/js?id=G-XXXX</code>, Cloudflare intercepts and rewrites the path into the original Google endpoint, preserving all query-string parameters and normalizing the <b>Origin</b> and <b>Referer</b> headers to match Google’s expectations. It then fetches the script on your behalf, and routes all subsequent measurement payloads through the same first-party proxy to the appropriate Google collection endpoints.</p><p>This setup also impacts how cookies are stored from your domain. A <a href="https://www.cloudflare.com/learning/privacy/what-are-cookies/"><u>cookie</u></a> is a small text file that a website asks your browser to store on your computer. When you visit other pages on that same website, or return later, your browser sends that cookie back to the website's server. This allows the site to remember information about you or your preferences, like whether a user is logged in, items in a shopping cart, or, in the case of analytics and advertising, an identifier to recognize your browser across visits.</p><p>Traditionally, when your website loaded a script directly from a third-party domain like <code>www.googletagmanager.com</code>, any cookies set by <i>that script</i> were associated with the <code>googletagmanager.com</code> domain. From your website's perspective, these are "third-party cookies." </p><p>With Cloudflare’s integration with Google tag gateway for advertisers, the tag script itself is delivered <i>from your own domain</i>. When this script instructs the browser to set a cookie, the cookie is created and stored under your website's domain. </p>
<div>
<h3>How can I get started? </h3>
<a href="#how-can-i-get-started">
</a>
</div>
<p>Detailed instructions to get started can be found <a href="https://developers.cloudflare.com/google-tag-gateway/"><u>here</u></a>. You can also log in to your Cloudflare Dashboard, navigate to the Engagement Tab, and select Google tag gateway in the navigation to set it up directly in the Cloudflare dashboard.</p>