Let GTM Kit see consent from a banner that runs inside Google Tag Manager

Last updated ·

GTM Kit 2.22 or later. Free.

Some consent banners run entirely inside your Google Tag Manager container, as a tag template, with no WordPress plugin on the site. Google’s tags see the visitor’s answer, but WordPress does not, so GTM Kit cannot either.

GTM Kit uses that answer in two places:

  • Customer details on the purchase event. When Include customer data is on (GTM Kit → Commerce → WooCommerce: User Data), GTM Kit adds the buyer’s email, phone and address to the purchase event only if the visitor has granted ad_storage and ad_user_data.
  • GTM Kit Premium. The consent stored with each order decides whether the server-side purchase webhook may include hashed customer details, and the event deferral queue waits for consent before it releases events.

The GTM Kit Consent Bridge is a small tag for your container that reads the consent state from Google Tag Manager and passes it to GTM Kit on the page.

Do you need it?

Install the bridge only when both are true:

  • your consent banner runs inside Google Tag Manager as a template (for example Cookiebot, CookieYes or Usercentrics set up as a GTM tag), and
  • no WordPress plugin passes consent to your site. If you use a consent plugin that supports the WP Consent API, or GTM Kit’s own Consent Mode settings, you do not need the bridge.

Do not install it on a site without a consent banner. Google Tag Manager reports a consent type that nobody has set as granted, so on such a site the bridge would tell GTM Kit that every visitor had consented.

Install it

  1. In WordPress, open GTM Kit → GTM Templates (the Template Assistant).
  2. Select GTM Kit Consent Bridge under Consent Bridge, together with anything else you want in the container, and download the container file.
  3. In Google Tag Manager, go to Admin → Import Container, choose the file, pick your workspace and choose Merge.
  4. Check that the tag [GTM Kit] Consent Bridge fires on Initialization – All Pages. Then preview and publish.

The bridge reads consent on Initialization – All Pages. Your consent banner’s tag must fire earlier, on Consent Initialization – All Pages, which is how the major banner templates are set up.

If your banner fires later, the customer details on the purchase stay safe but arrive slower: when the bridge reads a “granted” state before your banner has set its defaults, GTM Kit does not trust it straight away and waits up to three seconds before it adds them. Move the banner’s tag to Consent Initialization so every visitor’s consent is read correctly from the first moment.

Check that it works

  1. Open your site with Preview in Google Tag Manager and accept the consent banner.
  2. In your browser’s console, run:
window.gtmkit.consentBridge.state

You should see each consent type as "granted". After rejecting the banner, ad_storage and ad_user_data show "denied".

  1. With Include customer data on, place a test order: the purchase event in the data layer contains customer details only when you accepted.

With GTM Kit Premium, open the order in WooCommerce. The GTM Kit Attribution box shows Consent at order time for each consent type, with Source: GTM Kit consent bridge when the consent came from the bridge.

What the bridge does not do

The bridge only reads. It does not set consent defaults, does not change the visitor’s choice, does not send anything to Google and pushes nothing to the data layer. Your consent banner stays in charge of Consent Mode.

← Previous

Previous article

Next →

Next article