GTM Consent Mode v2 Template

Add Google Consent Mode v2 to your site with one click via our tag template for Google Tag Manager. Sets default consent denied for ad_storage, analytics_storage, ad_user_data, and ad_personalization, with optional IAB TCF (__tcfapi) bridge.

Get the template

The template lives in the gtm-template folder of this project. You can import template.tpl directly in GTM (Templates → New → Import) or publish it to your own GitHub repo and submit to the Gallery. See gtm-template/README.md for submission steps.

What it does

  • Default consent: All four Consent Mode v2 types denied; wait_for_update 500 ms. For a deeper dive on the default denied configuration, see our guide.
  • IAB TCF (optional): Listens to __tcfapi. When the user accepts or rejects, updates consent automatically.

Your GA4, Google Ads, and other consent-aware tags in GTM will respect these states. Fire this tag before any Google tags.

FAQ

What does the Consent Mode v2 GTM template do?
It sets default consent denied for ad_storage, analytics_storage, ad_user_data, and ad_personalization, with optional IAB TCF (__tcfapi) bridge. Fire it before any Google tags so Consent Mode is initialized before gtag/GTM runs.
When should the Consent Mode tag fire?
On Consent Initialization – All Pages (or equivalent), so it runs before any other Google tags. The consent default must be set before gtag.js or GTM loads tracking.
Do I need GTM for Consent Mode?
No. You can use a snippet in the page head (before gtag.js). We have a snippet generator for sites without GTM.
How do I verify Consent Mode is working?
Run a browser-based scan that simulates first visit, reject consent, and accept consent. Our free scan checks whether Consent Mode v2 is set correctly and whether tracking fires before consent. See our Consent Mode validation guide for details.

Official Google Consent Mode documentation →