How to Implement Google Consent Mode v2 with GTM and GA4 for Accurate Tracking

Published: (March 13, 2026 at 04:57 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for How to Implement Google Consent Mode v2 with GTM and GA4 for Accurate Tracking

Consent Mode v2 works by pushing consent state into the GTM dataLayer before any tags fire. The two key parameters are:

  • analytics_storage — controls GA4 and analytics tags
  • ad_storage — controls Google Ads conversion tags

You push these via gtag or a dataLayer.push before GTM’s container loads:

window.dataLayer = window.dataLayer || [];

function gtag(){ dataLayer.push(arguments); }

gtag('consent', 'default', {
  analytics_storage: 'denied',
  ad_storage: 'denied',
  wait_for_update: 500
});

When the user grants consent through your banner, update the consent state:

gtag('consent', 'update', {
  analytics_storage: 'granted',
  ad_storage: 'granted'
});

The wait_for_update parameter tells GTM to hold tag firing until the consent update arrives. If your banner takes longer than this window to respond, tags fire before consent is applied — breaking the whole setup.

Configuring Tags in GTM

In Google Tag Manager, configure Consent Settings on each tag—especially GA4 Configuration and Google Ads Conversion tags. Set these tags to require analytics_storage and ad_storage respectively. Without this configuration, the tags ignore the consent state entirely.

Server‑Side Tagging Considerations

For server‑side tagging setups, consent signals need to be passed through the server container as well. SeersAI supports this with direct GTM integration, handling the dataLayer push and update sequence automatically. This removes the risk of implementation errors and keeps you compliant with GDPR and CCPA without manual scripting.

Full implementation walkthrough with attribution context is on the blog.

0 views
Back to Blog

Related posts

Read more »

Travigo

Travel as fast as you speak with Gemini! Where live agents meet immersive storytelling & 3D navigation. This project was created for entering the Gemini Live Ag...

Micro games

Hey Gamers! 👾 As part of the Rapid Games Prototyping module, we are tasked with reviewing a peer's game. The challenge is to analyse a prototype built in just...