Documentation

Google Tag Manager

Google Consent Mode v2 decides what Google's tags may do before and after a visitor answers your banner. FlexyConsent drives it either from the page directly, or — if you manage your tags in Google Tag Manager — from our tag in the Community Template Gallery.

Which setup do you need?

If the FlexyConsent snippet is in your page source (the placement we recommend, see Installing FlexyConsent), Consent Mode already works. Enable it in your project settings and the script sets the defaults and updates them from the visitor's choice. You need nothing in GTM.

Add our GTM tag when you want Tag Manager itself to hold your other tags behind consent, using Google's own consent APIs and Tag Manager's own ordering guarantees — or when the GTM container is the only thing installed on the site and you want it to load FlexyConsent too.

Installing the tag

  1. In Tag Manager: Templates → Tag Templates → Search Gallery, find FlexyConsent CMP, and Add to workspace.
  2. Tags → New → FlexyConsent CMP.
  3. Paste your script ID (or the whole script URL) from the dashboard install snippet.
  4. Set the trigger to Consent Initialization – All Pages.

The trigger is not "All Pages"

This is the step people get wrong. Consent Initialization is a separate trigger that Tag Manager fires before everything else in the container, precisely so a consent tool can set defaults before any tag reads them. On All Pages the tag would run after tags that have already decided what they may do.

If the FlexyConsent snippet is already in your page source, untick Load the FlexyConsent script from this tag. The tag then only wires consent to Google's tags, and the script keeps its head placement — which is what lets it block trackers from the first byte.

Settings

Default consent state

What Google's tags may do before the visitor has answered. Each row is a set of regions and the seven consent types. Leave the table empty and everything is denied except functionality_storage — the same safe baseline the page script uses.

Wait for update

How long Google's tags hold their events waiting for the visitor's answer before acting on the defaults. 500 ms is enough for a returning visitor, whose stored choice is replayed as soon as the FlexyConsent script parses. Raise it towards 2000 if your tags fire before the banner on a first visit.

Ads data redaction and URL passthrough

Google's two Consent Mode options, passed straight through: redact ad identifiers while ad_storage is denied, and carry ad-click and session information in URLs instead of cookies.

What the tag does

  1. Applies the ads_data_redaction and url_passthrough options.
  2. Calls setDefaultConsentState once per region row, each carrying your wait for update grace period.
  3. Subscribes to the visitor's consent through the FlexyConsent publisher API.
  4. Calls updateConsentState on their decision — and again on every later change, including a withdrawal made without reloading the page.
  5. Loads the FlexyConsent script, if you asked it to.

It uses Tag Manager's native consent APIs, never the gtag('consent', …) command. Google asks templates not to use that command because gtag calls queue behind every other pending message and can be processed after the next event has already begun.

Checking it

Use Preview in Tag Manager and open the Consent tab on the Consent Initialization event. Before you answer the banner you should see your defaults with the grace period; after you accept or reject, an update carrying exactly the categories you chose. Google Tag Assistant shows the same from the tag's side.

In the browser console, window._fc_gcm is the computed consent state the tag reads — the seven types, exactly as the page worked them out.

What happens if consent never arrives

If the tag cannot find FlexyConsent on the page — the snippet is missing and you did not ask the tag to load it — the defaults are still applied and a message says so in Tag Manager's debug console. Nothing silently runs unconsented; your tags simply stay at the defaults.

← Installing FlexyConsentPublisher consent API →