Knowledge base

GTM setup

Google Consent Mode v2 with GTM: step-by-step setup

Set denied defaults before other GTM tags, connect banner updates, configure consent checks and prove the sequence in Tag Assistant.

Editorial illustration for Google Consent Mode v2 with GTM: step-by-step setup
Editorial illustration by Consentory.

In brief

A working GTM setup depends on timing: the default must exist before any tag that reads consent.

Decide what should happen before a choice

Choose Basic or Advanced behavior with your privacy owner before changing the container. In Basic mode, Google tags are blocked until consent. In Advanced mode, Google tags load with denied defaults and may send cookieless pings. Both require a real banner choice and correct updates.

Before choosing the container behavior, compare Basic and Advanced Consent Mode against your requirements for requests before a visitor’s choice.

  • Document the four signals: ad_storage, analytics_storage, ad_user_data and ad_personalization.
  • Map analytics and advertising categories separately; do not infer permission from a banner being visible.

Set defaults at Consent Initialization

In GTM, use a consent template with Google's consent APIs and fire the default on the Consent Initialization trigger. Set denied for the four signals when no prior choice exists. If you use a CMP template, check its actual trigger and execution order rather than relying on its name.

Do not put a gtag('consent', ...) call in a GTM Custom HTML tag to set the default: GTM's consent APIs are designed to establish state before other tags evaluate it.

  • If a saved choice exists, restore it early and verify what a returning visitor receives.
  • Consider wait_for_update only when your CMP needs a short time to retrieve the choice; it is not a substitute for blocking.

Wire the banner update

On Accept all, Reject all or Save preferences, translate categories into the four Google signals and issue a consent update on that same page. A page reload can hide a broken update path, so test without reloading first.

Consentory's widget maps analytics or performance to analytics_storage and advertising to the three advertising signals. Check the published script order on your site: an asynchronously loaded widget alone cannot guarantee an early GTM default.

Configure tag consent requirements

Google tags have built-in consent behavior. For a tag that must be held entirely until permission, add an appropriate GTM consent requirement or trigger rule. Apply explicit checks to third-party tags; they do not automatically obey Google's built-in signals.

  • Review GA4 configuration and event tags, Google Ads tags, remarketing and custom HTML separately.
  • Publish only after previewing the exact container version you intend to release.

Prove the order in Preview mode

Open a clean browser profile, connect GTM Preview and inspect the earliest consent event in Tag Assistant. The default should be denied before any relevant tag fires. Then accept analytics, reject advertising and confirm only analytics_storage changes to granted. Repeat after withdrawal and on a returning visit.

  • Pass: denied default precedes tags and updates appear immediately after the choice.
  • Fail: a Google request or optional tag fires before the default is visible.

Try it

GTM installation checklist

0 of 5 checked

This checklist stays on this page only. Save your evidence in your own release record.

Continue with a related guide

Primary sources

Reviewed 15 October 2026. Validate product interfaces and requirements for your own implementation.

Check the implementation on your site

Consentory helps teams inspect trackers, configure prior blocking and document consent choices. The guides above give you a test plan before rollout.