What is Google Tag Gateway?

Google Tag Gateway (GTG) is a feature that allows advertisers to serve Google tag scripts (such as gtm.js or gtag.js) from their own domain instead of from Google's servers (googletagmanager.com).


For example:

Without GTG: https://www.googletagmanager.com/gtm.js

With GTG: https://yourdomain.com/gtm.js


For full details, refer to Google's official documentation:

https://developers.google.com/tag-platform/tag-manager/gateway

https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide



How GTG affects your consent setup:

When GTG is enabled using one-click CDN injection (for example via Cloudflare or Akamai), the CDN automatically injects the Google tag script at the network level — BEFORE your Mandatly CMP consent script loads. One-click injection therefore takes control of script load order away from you.


This causes a "late consent" situation where Google tags fire before consent defaults are set.


Important: GTG does not bypass user consent. Consent Mode continues to control tag behavior based on user choices. The issue is purely about script load order.

Your consent default command must always fire BEFORE Google tags.



How to verify if your tag is enrolled in GTG:

We recommend checking through Google Tag Manager or another Google property.

This is the most reliable method. Results from other approaches, including

inspecting the browser Network tab or using third-party tools, cannot be relied

upon and we do not recommend them.


Follow these steps to check GTG enrollment:


1. Log in to Google Tag Manager at tagmanager.google.com

2. Open your web container

3. Click Admin in the top navigation

4. Click Google tag settings in the left sidebar

5. Click Google tag gateway

6. Check the status next to your domain:


   First-party     = GTG is active and enrolled

   Not started     = GTG has not been set up

   Pending         = GTG enabled, waiting for traffic

   Paused          = GTG is temporarily disabled


Setup and verification reference:

https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide?setup



What to do if you detect a late consent signal and GTG is enrolled:

A late consent signal means the consent default command loaded after Google tags already fired. To check, open your browser developer console on the page and run:

   MandatlyCookie.Debug()


If the report shows wasSetLate: true AND your tag is enrolled in GTG, you have three options:


Option 1 - Recommended: Use Advanced Consent Mode 


Advanced Consent Mode means Google tags are allowed to load before consent and send anonymous, cookieless signals, which are upgraded once the visitor makes a choice.

Mandatly always sends the consent default as early as possible, so the only setting to check is whether Mandatly is holding tags back.


In Mandatly:

1. Login to your Mandatly account -> Cookie Compliance -> Websites -> click on the website URL.

2. Go to the Banner Configuration tab -> edit the GeoConsent Rule for the region you want to change.

3. Check the "Block Trackers Until Consent is Granted" setting. This option is available when "Default Consent Mode" is set to "No (Opt-out)" or "Custom". For regions set to "Yes (Opt-in)", consent is granted by default, so no blocking applies.

   Unticked = Advanced Consent Mode, Google tags are not blocked before consent

   Ticked   = Basic Consent Mode, Google tags are blocked until consent is given


4. Save and republish the website


On the Google side, review your data transmission and consent default settings in Google tag settings and set them according to your regional needs. These are Google settings and are not part of Mandatly.


Note: if your banner is configured to appear only in certain regions, Mandatly automatically grants consent for visitors from regions where no banner is shown, so measurement is maintained.


Option 2: Migrate all tags into GTM and deploy via GTG


1. Move all your tags into a single GTM container

2. Enable GTG for that container in GTM, Admin, Google tag settings, Google tag gateway

3. Connect your CDN account and select your domain

4. Add the Mandatly CMP tag to the same container, firing on the "Consent Initialization - All Pages" trigger so it runs ahead of every other tag


This gives you full control over script load order inside the container.


Option 3: Set up GTG manually


Configure GTG manually on your server or CDN so you control the exact order scripts load. Your Mandatly consent script must fire before Google tags.


Manual setup guide:

https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide?setup


Why Advanced Consent Mode is recommended for GTG:

Advanced Consent Mode is the recommended approach for sites using GTG-enabled tags because:

  • Compatible with one-click GTG: because the CDN injects the Google tag outside your control, blocking Google tags before consent (Basic Consent Mode) cannot be enforced. Advanced Consent Mode relies on consent signals instead of blocking.
  • Maintains measurement: allows Google to model conversions from users who decline consent
  • Region-aware: when your banner is configured for specific regions only (e.g. EEA), consent is automatically granted for visitors from regions where the banner does not appear (e.g. US visitors)


Setting this up on each integration:

GTG applies however you have installed Mandatly. The consent settings above live in your Mandatly website configuration in every case. Only the installation differs.


Google Tag Manager:

The Mandatly CMP tag must fire on the Consent Initialization - All Pages trigger, so it runs before every other tag in the container.


WordPress plugin:

In WordPress Admin, Mandatly, confirm Enable Google Consent Mode is on. The plugin writes its consent commands inline at the top of the head section, ahead of the banner.


Direct script tag:

The Mandatly script must be the first script in the head section, above every Google tag. It is a synchronous script and must not be given async or defer.


In all three cases, whether tags are blocked before consent is controlled by the Block Trackers Until Consent is Granted setting in the GeoConsent Rule for the relevant region, as described in Option 1.


Still seeing a late consent signal?

Run "MandatlyCookie.Debug()" in the browser console. The report shows:


- whether the developer ID was set, and how early

- whether the consent default was sent, and where it came from

- which banner category each of the seven Google consent types is mapped to, and whether all four required types are declared

- wasSetLate, which must be false


If it still reports true after following the steps above, contact Mandatly support with the console output.


Summary: If your site uses GTG and you detect a late consent signal, use Advanced Consent Mode by leaving "Block Trackers Until Consent is Granted" unticked in the GeoConsent Rule for the relevant region. If you need full control over script load order, use Option 2 or Option 3.



Relevant Resources: