www.googletagmanager.com and sends hits straight to Google. With it, those requests go to a first-party path you reserve, such as https://www.example.com/98a7hfca.
First-party serving is more durable against browser restrictions and some blockers, so Google gets a more complete signal. See the .
Google Tag Gateway is separate from Set up a proxy. The Converge proxy serves Converge from your domain. This guide serves Google from your domain.
Before you start
- Use Cloudflare as the DNS service for your domain.
- Create one Worker or Snippet and one path per Google Tag ID.
G-,AW-, andGT-IDs are separate tags unless they share the same tag ID. - Pick your own unused path. Don’t use a readable word like
/gtg,/gtm, or/metrics. Use a random string, for example/98a7hfca. Don’t copy the example path onto a live site. Don’t use/. - Set up the Converge destinations that load that tag: GA4, Google Ads conversions (browser), Google Ads conversions (server), and Google Ads remarketing.
Choose Worker or Snippet
Converge doesn’t care which one you use. Both send your measurement path to Google. Pick a tab in Set up Cloudflare and follow that path.Set up Cloudflare
Use the tabs to switch between Worker and Snippet. After this section, every step is the same.- Worker
- Snippet
Add a Worker for each Google Tag. Then attach it to a path-scoped route on the proxied hostname.The Worker proxies every request it receives to
1
Create the Worker
- In the Cloudflare account home, go to Compute > Workers & Pages.
- Click Create application, then Start with Hello World!.
- Give it a name that includes the tag ID, for example
google-tag-gateway-g-xxxxxxxx. - Click Deploy.
2
Paste the Worker code
- Click Edit code.
- Replace the placeholder with the example below.
- Set
TAG_IDto your Google Tag ID. Use aG-,AW-, orGT-ID. - Click Deploy.
{TAG_ID}.fps.goog. The route, not the Worker, limits which paths reach it. The Worker forwards cookies and query strings, and attaches geolocation from Cloudflare.3
Attach a path-scoped route
- Open the Worker and go to Domains.
- Click Add route.
- Select the zone you want to use.
- Add the route
*.example.com/98a7hfca*. Replace the hostname and path with the random path you reserved. - Leave Failure mode set to Fail closed (block) and click Add Route.
* route would send your whole site to Google.4
Confirm the hostname is proxied
- Go to the DNS settings for your domain.
- Find the record for the hostname you used in the route.
- Confirm the orange cloud is on (Proxied).
Point Converge at the path
Set the path on every destination that loads that Google Tag. Don’t edit the site snippet. Converge loadsgtag from https://www.example.com/98a7hfca instead of www.googletagmanager.com. Use the random path you reserved, not this example.
1
Set the Google Tag Gateway path
- Open the destination and go to Configuration.
- Open Advanced configuration.
- Set Google Tag Gateway path to the same random path you used in Cloudflare, for example
/98a7hfca. - Click Save.
- Google Analytics 4
- Google Ads conversions (browser)
- Google Ads conversions (server)
- Google Ads remarketing
For visitors in the European Economic Area (EEA), Google does not send GA4 events through the Google Tag Gateway path. Those events still use Google’s regular regional analytics endpoints. This is Google’s privacy behavior, not a Converge setting. Google Ads hits still go through the gateway path.
Verify the setup
- Open
https://www.example.com/98a7hfca/healthy. The page should readok. - Open
https://www.example.com/98a7hfca/?validate_geo=healthy. The page should readok. - Load your site, open DevTools > Network, and confirm the Google Tag and Google Ads hits go to your path, not
www.googletagmanager.com. For EEA visitors, GA4 events still go to Google’s regular analytics endpoints. - Preview the site in Tag Assistant and confirm Google Ads hits use the measurement path.
/98a7hfca unless that’s the path you created.
FAQ
The health check doesn't return ok
The health check doesn't return ok
Confirm the DNS record is Proxied and
TAG_ID is the full Google Tag ID.If you used a Worker, confirm the route matches the path (including the * suffix) and check the Worker logs. If you used a Snippet, confirm the filter expression matches the path.I see Error 1027 or the Google Tag stopped loading
I see Error 1027 or the Google Tag stopped loading
This applies to Workers on the Free plan. The account hit the 100,000 requests per day cap. Upgrade to Workers Paid, or wait until midnight UTC when the cap resets. Error 1027 with Fail closed (block) stops the Google Tag from loading. Snippets don’t have this cap.
Geo validation fails
Geo validation fails
Cloudflare must set
X-Forwarded-CountryRegion or X-Forwarded-Country from its own geolocation data. Don’t forward geo headers the browser sent. Redeploy the example and retry /{path}/?validate_geo=healthy.The path is already used by the site
The path is already used by the site
Pick a different unused random path. Update the Worker route or Snippet filter, and the Google Tag Gateway path in every matching Converge destination.
Can I use /gtg or /metrics?
Can I use /gtg or /metrics?
Don’t. Readable paths are easier to guess and more likely to collide with a real page. Invent a random path such as
/98a7hfca and use it in Cloudflare and Converge.I have more than one Google Tag
I have more than one Google Tag
Create one Worker or Snippet and one path per Google Tag ID. Set each destination to the path that matches its tag.
Does this cover Shopify checkout or other hostnames?
Does this cover Shopify checkout or other hostnames?
Only proxied hostnames with a Worker route or Snippet filter serve the tag first-party. Add a route or filter for each hostname that loads the Converge pixel, or pick a path on the storefront domain you already proxy.
Why do EEA GA4 events still go to Google's regular endpoints?
Why do EEA GA4 events still go to Google's regular endpoints?
For visitors in the European Economic Area, Google does not route GA4 events through the Google Tag Gateway path. Those hits go to Google’s regional analytics endpoints instead. This is Google’s privacy behavior, not a Converge setting. The Google Tag and Google Ads hits still use your first-party path.
Does Google Tag Gateway replace Consent Mode?
Does Google Tag Gateway replace Consent Mode?
No. The Google Tag still respects Consent Mode. Set Consent Mode before the Converge pixel loads. See Implementing Consent Mode.