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

If you are building or managing a marketing analytics stack, Consent Mode v2 is one of the most important configurations you can get right. Getting it wrong means your conversion data is systematically incomplete — and the errors are silent. No error logs. Just missing data.

Here is what you need to understand technically.

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 — and 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, you update:

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.

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

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.

Leave a Reply