Set up Google tag gateway for advertisers

This document is for users who want to deploy the Google tag gateway for advertisers. We recommend Google tag gateway for advertisers for the most durable tag configuration.

Overview

Google tag gateway for advertisers lets you deploy a Google tag using your own first-party infrastructure, hosted on your website's domain. This infrastructure sits between your website and Google's services. The setup in this documentation will help you better measure your website. You can set it up using your existing content delivery network (CDN), load balancer, or web server.

In standard Google tag setups, your web page requests a Google tag from a Google domain. When the tag fires, it sends measurement requests directly to the Google product. With Google tag gateway for advertisers, your website loads the Google tag from your first-party domain. When the tag fires, some measurement requests will be sent to Google using your first-party domain.

This diagram represents the information flow in Google tag gateway for advertisers:

Google tag gateway for advertisers architecture information flow.

Before you begin

This guide assumes that your website is already configured with:

To get started, pick your setup type.

How it works

This feature adds the Google tag or Tag Manager container to the very top of your web page, before all other scripts.

If you are setting up your tag for the first time on your website, a gtag('config') or gtm.init event will be automatically added on-page. However, if your website is already using the tag, Google tag gateway for advertisers will honor the on-page setting you already configured for the tag. You can control this behavior in the Cloudflare settings for Google tag gateway for advertisers.

Fill in the following to populate the examples throughout this document.

Your domain: example.com
Measurement path: /metrics

How to set up Google tag gateway for advertisers

Step 1 of 5: Navigate to the Google tag gateway for advertisers settings

  1. Access your Google tag screen or your Google Tag Manager container.
  2. Go to the Admin tab.
  3. Click Google tag gateway.

Step 2 of 5: Choose a measurement path

By default, the measurement path is a combination of four alphanumeric characters to reduce the likelihood of conflicting with a path already on your website.

To customize the measurement path:

  1. Expand the measurement path card by clicking the arrow icon.
  2. Enter your custom path in the input field: /metrics.

Step 3 of 5: Sign in with Cloudflare

After choosing a measurement path, click the Sign into Cloudflare button. Log into your Cloudflare account to grant the Google tag access to deploy Google tag gateway for advertisers.

Granting access allows the Google tag to:

  • See your account information such as account details, analytics, and memberships.
  • Read your account zones.
  • Read, edit, and publish Google tags in Google tag gateway for advertisers on your site.
  • Perform authorized actions in the background without your presence.

Step 4 of 5: Review and select your domains

After logging in to Cloudflare, all sites running the Google tag and Cloudflare will be listed and selected by default in the "Your website domains will be activated" card. Refer to the following steps to add or remove domains from the default list:

  1. Click the edit icon in the "Your website domains will be activated" card.
  2. In the "Choose website domains" panel, expand the following sections to select your preferred domains:
    • Tagged domains: This section shows the domains that already have the current tag. All domains in this section will be selected by default.
    • Other domains: This section shows the domains that either have a different tag or are untagged. All domains in this section will be deselected by default. If a domain is untagged, the "Tags" column will display "None".
    • Activated domains: This section shows the domains that are running Google tag gateway for advertisers manually, or have already enabled Google tag gateway for advertisers with a different tag. The domains under this section can't be selected. Click Edit manually or Edit in Cloudflare to manage these domains.
  3. Click Done.

If no domains are listed in the "Your website domains will be activated" card, the Choose domains button will appear. Click the Choose domains button to select domains from the Other domains section.

Step 5 of 5: Enable Google tag gateway for advertisers

Before enabling Google tag gateway for advertisers, check that the Cloudflare zones listed match your expectations and that your measurement path is not already in use.

After verifying your setup, click the Complete setup button at the bottom of the card to enable Google tag gateway for advertisers for all of your Cloudflare zones.

Manage Google tag gateway for advertisers

Once enabled, you can manage Google tag gateway for advertisers using the Configure button found in the top-right card header. Clicking this button gives you the following options:

  • Pause or Activate: These options disable or enable Google tag gateway for advertisers for all the domains in your Cloudflare account.
  • Configure in Cloudflare: This option opens the Cloudflare dashboard, allowing you to configure each domain independently.

You can manage the domains after you've enabled Google tag gateway for advertisers. In the Google tag gateway configuration screen, click the edit icon in the "Websites" card. After making the necessary changes, click Save.

Test the measurement setup

To test the measurement setup, configure your container to have at least one tag that fires.

  1. Go to Tag Assistant and preview your container.
  2. Navigate through your website to trigger events.
  3. In the Summary > Output > Hits Sent tab, verify that the hits are routed to /metrics.

    Screenshot verifying the setup