Your own Cloudflare (Google tag gateway)
Serve Google's tags from your own domain through your own Cloudflare account, with Cloudflare's Google tag gateway. Free, and no server to run.
If your site already runs through your own Cloudflare account, you can serve Google's tags (GA4, Google Ads, Google Tag Manager) from your own domain with Cloudflare's Google tag gateway. Cloudflare fetches the Google tag in the background and serves it from a path on your site, then forwards the measurement requests to Google. The requests look first-party, cookies are set on your domain, and you do not host or pay for a server.
This is Cloudflare's feature and it runs entirely in your Cloudflare account. PixelFox does not host it and does not need to be told about it.
What it does, and what it does not
| It does | It does not |
|---|---|
| Loads the Google tag from your domain instead of a Google domain | Run a Google Tag Manager server container |
| Sends Google measurement requests through your domain | Send events to Meta, TikTok or any other platform |
| Is free and works on any Cloudflare plan | Replace the PixelFox tag, or its server-side sending |
So it improves the Google side of your measurement. Your Meta, TikTok and other conversions still go out server-side from PixelFox, with the same deduplication as before. Use the gateway together with the PixelFox tag, not instead of it. To make the PixelFox tag itself first-party, add a custom ingest endpoint. If you want a GTM server container with your own tags, see shared server-side GTM or forwarding from your own server container.
Before you start
- Your website's domain is proxied through Cloudflare (the orange cloud).
- You have your Google tag ID (for example a
G-orGTM-ID). - Your Cloudflare user has the role the feature requires: Super Administrator, Administrator or Zaraz Admin, or Domain Administrator if you use domain-scoped roles.
- A Google tag or Google Tag Manager container is already on the site.
Set it up
- In the Cloudflare dashboard, open Google tag gateway and select your domain.
- Turn the gateway on.
- Enter your Google tag ID.
- Choose a measurement path: an unused path on your site, such as
/metrics. Tags then load fromhttps://yourstore.com/<path>/.... - Save. Note that saving overrides any existing GTM script on the site.
You can also turn it on from the Google tag settings or from Google Tag Manager, which can connect to your Cloudflare account.
Cloudflare applies the gateway to the whole zone: every hostname and subdomain in it, including custom hostnames. You cannot enable it for a single subdomain. To limit a tag to one subdomain, use a GTM trigger such as a Page Hostname condition.
Check that it works
- Confirm your GTM container has a tag that fires.
- Open Tag Assistant, browse your site, and look under Summary → Output → Hits Sent. Hits should go to your measurement path.
- In Cloudflare, the Google tag gateway screen should show Active.
Cloudflare and PixelFox hostnames
The hostnames you point at PixelFox, such as t.yourstore.com, are CNAMEs that
must stay DNS-only (the grey cloud). The gateway is the opposite: it needs
your main website's domain proxied. They are different hostnames, so both can
be in place on the same Cloudflare zone.
Forward from your own GTM server
One tag in any GTM server container - on Cloud Run, a PixelFox dedicated container, or anywhere - sends every event it processes to PixelFox.
Visitor location (divisions and districts)
Record where visitors are beyond their country, so the dashboard map can show Bangladesh's 8 divisions and 64 districts. Uses MaxMind's free GeoLite2 database.