Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setup GTG via Cloudflare

Use the direct Cloudflare dashboard method when the GTM → Cloudflare OAuth connection fails with an "Access denied" error.

Google tag gateway (GTG)

Category: Tracking setup · Reading level: Intermediate · Reading time: ~5 minutes

Google Tag Gateway (GTG) loads your Google tags (GTM, GA4, Google Ads) from your own domain instead of directly from Google's servers. That gives you:

  • Better data quality — fewer blocks by browser extensions

  • First-party tracking — tags load as first-party content

  • Higher conversion accuracy — Google reports ~11% more signal on average

When do you use this method?

The standard way to set up GTG is via GTM → Sign in to Cloudflare. But this OAuth connection can fail with:

This happens when:

  • You were invited as a member on a client's Cloudflare account

  • Account-wide API access is disabled (default on non-Enterprise accounts)

  • The Cloudflare account owner can't complete the link themselves in GTM

In that case, use the direct Cloudflare dashboard method below — no GTM OAuth required.

Requirements

Requirement
Details

Cloudflare plan

Free or higher

Cloudflare role

Super Administrator, Administrator, or Zaraz Admin

GTM container

Installed on the website

Google Tag ID

GTM-XXXXXXX (top-right in GTM)

Step-by-step setup

1

Open Google Tag Gateway in Cloudflare

Log in to dash.cloudflare.com as the account owner (or as an invited member with sufficient rights). Select the domain you want to enable GTG on. In the left sidebar, scroll to Web tag management → Google tag gateway.

2

Configure Google Tag Gateway

Click Configure and fill in:

  • Google tag ID* — the website's GTM container ID, e.g. GTM-AB123456. Found top-right in the GTM interface.

  • Measurement path* — a path on the website that isn't in use yet, e.g. /metrics, /gtm, /analytics, or a random combination of letters/numbers (recommended).

  • Set up tag — leave off if the website already has a GTM snippet in the source code; turn on if Cloudflare should inject the tag automatically (no GTM snippet yet).

Click Save.

3

Activate the toggle

After saving, a toggle appears on the Google Tag Gateway page. Turn it on.

Cloudflare now automatically injects the adjusted GTM snippet on the fly into every page on the domain — no source code changes needed.

Verifying your setup

Method 1 — Check the page source Go to the website → right-click → View Page Source (or Cmd+U / Ctrl+U) → search for the measurement path (e.g. /metrics). You should see a GTM snippet pointing to yourdomain.com/[path] instead of googletagmanager.com.

Method 2 — Browser DevTools Open DevTools (F12) → Network tab → reload the page → filter on your measurement path. Requests now run through your own domain ✅.

Method 3 — Tag Assistant (most reliable) Go to tagassistant.google.com → enter the website URL → Connect → navigate the site to trigger tags → Summary → Output → Hits Sent → confirm hits are sent via your measurement path.

Common issues

"Access denied" on the GTM OAuth link Cause: Cloudflare API access is disabled for your member account — an Enterprise-only Cloudflare setting. Fix: Use the direct Cloudflare dashboard method described above.

GTM status stays "Not started" after Cloudflare setup Cause: GTM and Cloudflare aren't linked via OAuth, so GTM never receives a status update. Fix: This is expected with the direct Cloudflare method. Validate via Tag Assistant or DevTools instead — if requests run through your domain, it's working correctly.

Tags load on admin pages (e.g. WordPress /wp-admin) Cause: Cloudflare injects the snippet on every page on the domain. Fix: Set up a Cloudflare Configuration Rule to exclude the measurement path on admin URLs.

GTM OAuth vs. Cloudflare dashboard method

GTM OAuth
Cloudflare dashboard

Automatic GTM configuration

✅ Yes

❌ No (not needed)

Snippet injection by Cloudflare

✅ Automatic

✅ Automatic

Website source code changes

❌ Not needed

❌ Not needed

Works as a member of a client account

❌ Often not

✅ Yes

GTM status visible in the interface

✅ "Active"

⚠️ May show "Not started"

Was this helpful?