Skip to main content

Adapting your AdOpt configuration for Google Tag Gateway (GTG)

Are you using Google Tag Gateway (GTG)? Learn about its impact on consent and how to adapt your AdOpt configuration.

Written by AdOpt Support

What is Google Tag Gateway and what is its impact on consent?

Google Tag Gateway (GTG) is a mechanism offered by Google that allows Google tags (`gtag.js`, `gtm.js`) to be served from your own domain instead of `googletagmanager.com`. In practice, GTG turns third-party scripts into first-party scripts.

Activation is done in one click from the Google Tag Manager interface: Google then injects a CDN configuration that changes the source of the script loaded on the site.

Once GTG is enabled, a tag that was previously loaded from:

is now loaded from:


What is GTG for?

GTG offers a lightweight alternative to server-side tracking for sites that want to:

  • Bypass adblockers that block requests to `googletagmanager.com`

  • Improve performance by reducing third-party DNS lookups

  • Strengthen tracking resilience against browser restrictions (ITP, ETP)

Unlike server-side tagging (which requires a dedicated GTM server), GTG is activated in one click from the GTM interface.


Impact on consent: the risk of late consent

For AdOpt to work correctly, two signals must be emitted before Google tags execute:

  1. The Consent Mode default command: `gtag('consent', 'default', {...})`

  2. The TCF stub (`window.__tcfapi`), for sites subject to the IAB TCF v2.2 framework

If this is not the case — meaning the default command and/or the TCF stub load after Google tags have already started — this is called late consent.

When consent is late, the first events sent by Google tags may be sent without the user's chosen consent state being taken into account, which violates Consent Mode implementation requirements.

This issue can occur independently of GTG, particularly in the following situations:

  • Manual AdOpt integration via script, if AdOpt is not positioned before GTM in the HTML

  • Use of the AdOpt GTM tag template without the "Consent Initialization - All Pages" trigger

  • Integration via CMS plugin, depending on how the plugin injects the script

If you have followed our integration recommendations — both for the AdOpt integration method and for Consent Mode v2 configuration — the default command is emitted before Google tags: GTG then has no impact on your configuration.

💡 Tip: GTG can amplify this existing issue: by serving `gtm.js` from your own domain, the script potentially loads faster (no external DNS resolution), which reduces tolerance for script loading order issues. GTG acts as a **magnifier**: it makes visible an issue that may have gone unnoticed until now.


What GTG does not do

  • GTG does not bypass user consent choices. Consent Mode continues to adapt tag behavior based on the consent signaled by AdOpt.

  • GTG does not collect any additional data compared to `gtag.js` / `gtm.js`. GTG only changes how the script is loaded, not what it does once loaded.


How to verify if you are using GTG?

⚠️ Important: GTG activation verification must be performed manually by you. AdOpt detects symptoms (late consent) but it is up to you to correlate this with GTG using the steps below.

Option 1 — In the page source code

  1. Open the relevant page in a browser

  2. View the page source (`right-click → View page source` or `Ctrl+U` / `Cmd+Option+U`)

  3. Search for the `<script>` tag that loads `gtm.js` or `gtag/js`

Tag served via GTG:

html

<script async src="https://your-domain.com/gtm.js?id=GTM-XXXXXX"></script>

Tag not served via GTG:

html

The verification criterion is the script source domain: it should be yours (e.g. `https://example.com/gtm.js`) and not `https://www.googletagmanager.com/gtm.js`.

Option 2 — In the browser Network tab

  1. Open browser developer tools (`F12` or `Cmd+Option+I`)

  2. Go to the **Network** tab

  3. Filter on `gtm.js` or `gtag`

  4. Reload the page

  5. Inspect the Domain / Initiator column for each request

Result

Meaning

`your-domain.com/gtm.js?id=…`

✅ Tag served via GTG

❌ Tag not served via GTG

Option 3 — In the Google Tag Manager interface

Containers deployed via GTG display a badge or dedicated label in the container's Admin section. Refer to the Google Tag Manager Help Center for exact labels.


What to do with this result?

  • None of your Google tags are served via GTG → no action needed. Continue using AdOpt as today.

  • Some tags are served via GTG and you see a late consent warning → proceed to the section below.


If you are using GTG

AdOpt helps you detect late consent issues

  • Browser console warnings — when late consent is detected, AdOpt displays a warning directly in your browser console.

gtag('config') has already been set before Consent Mode default command

⚠️ This warning is only visible when debug mode is enabled. To activate it, open your browser console on the page where AdOpt is installed and run:

js

sendAdoptCommand('debug')

Then reload the page. Debug mode is now active and console warnings will appear.

To deactivate it:

js

localStorage.removeItem('debug')

This tool does not detect GTG directly, but it identifies problematic symptoms (late consent, missing signals).

What to do if AdOpt detects late consent and GTG is enabled?

Late consent issues related to GTG are caused by a tag loading order that is outside AdOpt's control. These issues must be resolved in your tag configuration or deployment strategy.

💡 Tip: If you have followed AdOpt's integration recommendations and do not observe late consent — no action is required, your configuration is compliant.

Three resolution options are available, in order of decreasing recommendation:


Option A — Switch to advanced consent mode (Recommended)

Switch to advanced consent mode: Google tags fire immediately, sending cookieless pings (limited measurement). Once consent is obtained, full measurement resumes; if consent is denied, only cookieless pings are retained.

⚠️ Important: Behavioral modeling eligibility: your GA4 property must reach a minimum of 1,000 consenting visitors per day (for at least 7 of the past 28 days). Below this threshold, modeling will not activate.

Enable Data Transmission Controls in your Google tag settings as needed — Google documentation.

Why this option is recommended:

  • It is the mechanism explicitly recommended by Google for GTG deployments

  • Basic consent mode relies on strict loading order control — GTG can highlight this existing fragility

For the detailed setup of advanced Consent Mode with AdOpt, see:


Option B — Migrate all tags to GTM and deploy via GTG

For sites not using GTM (manual script in `<head>` or AdOpt CMS plugin).

  1. Centralize all marketing/analytics tags in a single Google Tag Manager container

  2. Enable GTG at the container level, not tag by tag

  3. Configure AdOpt with the "Consent Initialization - All Pages" trigger to guarantee loading order


Option C — Manual GTG setup

Set up GTG manually: host the redirect to Google's CDN yourself on your own server/CDN and explicitly control the script import order in the HTML.

Requires technical skills on the server/CDN side. Loading order is entirely your responsibility — a misconfiguration can reintroduce the issue.

See the Google documentation for manual setup.


Quick decision matrix

Situation

Recommended option

You want the most robust and easiest to maintain solution

Option A

Advanced mode

You are not using GTM and want to regain control of loading order

Option B

Migrate to GTM via GTG

You have a technical team and want full control

Option C

Manual GTG

You are not sure where to start

Option A

recommended by Google and AdOpt


References

AdOpt documentation

Google documentation

⚠️ Imporant: In case of discrepancy between this article and Google's pages, Google's pages take precedence.

Did this answer your question?