Google Tag Gateway: CloudFlare Setup Example

Google Analytics BCS 1 days ago 51 Views 0 Comments

Update time: June 11, 2025

What is Google Tag Gateway

Google Tag Gateway is a name change from First-Party Mode (FPM). It loads the GTM tracking code from your own domain name and forwards it to the GA4 server disguised as a first-party request. (This method is called CNAME deployment in Adobe Analytics).

 

Requirements

There are two requirements for using Google Tag Gateway:

  • A Google tag or Tag Manager container.
  • A content delivery network (CDN) or load balancer that can forward requests to external endpoints.(Google Tag Gateway has built-in support for CloudFlare. It is recommended to use CloudFlare‘s CDN. CloudFlare will be used as an example to demonstrate how to set it up.)

 

Advantages

  • Privacy Compliance: First-party cookies are less likely to be blocked by browsers like Safari and Firefox, improving tracking reliability.
  • Longer Cookie Lifespan: First-party cookies set by the server avoid ITP’s 7-day expiration, allowing longer-term user tracking.
  • Enhanced Trust: Data collection appears to originate from your domain, aligning with user expectations for privacy.

Disadvantages

  • DNS Configuration: Setting up CNAME and Route traffic

CloudFlare Setup Example

Prerequisite: The website uses CloudFlare‘s CDN; the GA administrator account and the CloudFlare administrator account are the same.

There are two entrances to set up Google Tag Gateway:

  • In GTM,click「Admin」——「Google tag gateway」
  • In the GA4 Web stream details,click「Configure tag settings」——「Admin」——「Google tag gateway」

You can see the settings interface of Google Tag Gateway:

Click「Continue」 to start the setup.

Step 1:Your Google tag will be updated

This step is to set the path for GTM loading and GA4 data sending. I set it to /gtm:

Step 2:Your Cloudflare account will be connected

This step is to link the account:

After logging in, you will be prompted to authorize, just click「Allow」:

After authorization, it will return and you can see that the authorization has been successful:

Step 3:Your website domains will be activated

This step is to select the CloudFlared domain:

Finally, click 「Complete Setup」.

 

Step 4:Update the GTM scripts on the website

The last step is to update the loading address of the GTM code that has been installed on the website. The specific path depends on the path set in the Step 1.

Step 5:Test and Verify

In the browser developer tools, under Network, filter by GTM, you can see that the GTM tracking code is loaded from your own domain:

The data is sent to your own domain:

This is how Google Tag Gateway is set up

 

SST VS CST VS FPM

For more comparisons of GA4 tracking methods, Read More:Understanding GA4 Tracking Methods: SST、CST、FPM


If you don't understand, You can leave a comment below.
Like (0)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website