Skip to content

Google tag gateway

Konstantinos Pappas edited this page Nov 17, 2025 · 3 revisions

With Google tag gateway for advertisers, you can serve a Google tag from your own domain using your CDN, load balancer, or web server. This first-party setup routes measurement requests through your domain, improving data accuracy and privacy compliance.

Note

If you’re setting up the Google tag gateway via a CDN or Tagging server as described in Google’s documentation, you do not need to configure anything in the plugin’s settings.

By default, Google scripts are loaded from Google’s domains, like https://www.googletagmanager.com/. Google tag gateway for advertisers lets you load Google scripts from your own domain.

This helps:

  • Improve conversion measurement accuracy
  • Gain deeper campaign insights
  • Experience added privacy by default

There are multiple ways to set up Google tag gateway for advertisers:

We recommend setting up Google tag gateway for advertisers with a CDN for optimal performance. This is going to look like:

flowchart LR
    %% Nodes
    subgraph WS["https://example.com"]
      WC["Website content"]
      GT["Google tag"]
    end

    CDN["Website CDN"]
    CWS["Customer web server"]
    GM["Google measurement"]

    %% Flows (with directions & labels like the image)
    GT --> CDN
    CDN --> WC
    CDN --> GT

    CWS -- "Website content" --> CDN

    GM -- "Google tag" --> CDN
    CDN -- "Events and conversions" --> GM
Loading

One-click PHP proxy

If you cannot use a CDN or a Tagging server, you can use our one-click PHP proxy to quickly enable the Google tag gateway for advertisers. It runs directly on your own server and requires minimal configuration. This method is ideal for testing or small-scale use, but it may not provide optimal performance, especially for high-traffic websites.

flowchart LR
    %% Nodes
    subgraph CWS["Customer web server"]
      WC["Website content"]
      GT["Google tag"]
      PHP["One-click PHP proxy"]
    end

    GM["Google measurement"]

    %% Google tag goes through the proxy path
    GM -- "Google tag" --> PHP
    PHP -- "Served via /pressidium-cookie-consent-metrics/*" --> GT

    %% Google Measurement
    GT -- "Requests to /pressidium-cookie-consent-metrics/*" --> PHP
    PHP -- "Forwarded events & conversions" --> GM
Loading

Setting it up

Google tag gateway

  1. In your WordPress admin dashboard, go to Cookie Consent → Tag Gateway

  2. Toggle Google tag gateway proxy to on

    This enables the built-in PHP proxy that routes traffic to Google tag gateway

  3. Enter your Google tag ID

    A Google tag ID is an identifier to load a given Google tag (for more information, refer to Finding your Google tag ID)

  4. Click Save to apply your settings

Once enabled, the plugin will automatically serve Google scripts through the following path on your website:

/pressidium-cookie-consent-metrics

You’ll also need to update your Google tag or Google Tag Manager snippet to point to the new measurement path (see below).

Updating your Google tag or Google Tag Manager script

gtag.js

You’ll need to update your Google tag script:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-12345"></script>

to use the new measurement path:

<!-- Google tag (gtag.js) -->
<script async src="/pressidium-cookie-consent-metrics/"></script>

gtm.js

Replace your Google Tag Manager snippet with the following:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'/pressidium-cookie-consent-metrics/?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','');</script>
<!-- End Google Tag Manager -->

Finding your Google tag ID

You can find your Google tag ID in several Google products, such as Google Analytics and Google Tag Manager.

In Google Analytics

  1. Go to https://analytics.google.com/analytics/web/
  2. Sign in to your Google Account
  3. In Admin, under Data collection and modification, select Data Streams
  4. Select the data stream that you want to edit
  5. Under Google tag, click Configure tag settings
  6. Under Your Google tag, click the Google tag (left side of the diagram)
  7. Under Tag details, copy the Google tag ID

In Google Tag Manager

  1. Go to https://tagmanager.google.com/
  2. Sign in to your Google Account
  3. In the Google tags tab, select the Google tag
  4. Under Your Google tag, click the Google tag (left side of the diagram)
  5. Under Tag details, copy the Google tag ID

To learn more, checkout out Google’s official guide on how to Find the Google tag ID.

Verifying setup

Verifying that the PHP proxy is working as expected

  1. In your WordPress admin dashboard, go to Cookie Consent → Tag Gateway

  2. Confirm that the “Status” is “Healthy”

    Healthy status

    This means that the Google tag gateway is reachable and the plugin will route traffic through it.

Verifying that Google scripts are loaded via your own domain

  1. Open your website in a browser

  2. Open Developer Tools (e.g. for Google Chrome use + + J on macOS or Control + Shift + J on Windows/Linux)

  3. Select the Sources tab

  4. Confirm that gtag.js or gtm.js is loaded from /pressidium-cookie-consent-metrics/

    Screenshot of the Sources tab in DevTools

Troubleshooting

The plugin automatically registers custom rewrite rules required for the /pressidium-cookie-consent-metrics/* path. However, if you see an “Unreachable” status, you may have to flush rewrite rules manually.

Unreachable status

To do this:

  1. In your WordPress admin dashboard, go to Settings → Permalinks
  2. Scroll to the bottom of the page (no changes needed)
  3. Click “Save Changes”

This action flushes the rewrite rules, forcing WordPress to recognize the new /pressidium-cookie-consent-metrics/* path.

Once done, go back to Cookie Consent → Tag Gateway, the status should now appear as “Healthy” meaning the Google tag gateway is reachable.

Clone this wiki locally