Skip to content

Google Consent Mode v2

Google Consent Mode v2

If your site uses Google Analytics 4, Google Ads or GTM, you should enable Consent Mode v2 — since March 2024 Google requires it for ads personalization and audience features in the EEA.

Enable it under Cookie Consent → Settings → Google Consent Mode. It is off by default, because without a Google tag setup it would only emit unused consent calls.

What the package does

When enabled, the middleware injects a consent default snippet before any Google tags load:

gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'functionality_storage': 'denied',
'personalization_storage': 'denied',
'security_storage': 'granted',
'wait_for_update': 500
});
gtag('set', 'ads_data_redaction', true);
gtag('set', 'url_passthrough', true);

When the visitor makes a choice, the package sends a gtag('consent', 'update', …) with the granted signals.

Category mapping

Consent categories map to Consent Mode signals as follows:

Banner categoryConsent Mode signals
Analyticsanalytics_storage
Marketingad_storage, ad_user_data, ad_personalization
Preferencesfunctionality_storage, personalization_storage
Necessarysecurity_storage (always granted)

Note the mapping is not 1:1 — marketing consent drives three signals, which is exactly what Google’s v2 requirements expect.

Basic vs Advanced mode

Both are supported; the difference is how you load your Google tags:

  • Basic: add your Google tags as managed scripts in a consent category. Tags load only after consent — no data reaches Google before that, not even cookieless pings.
  • Advanced: load Google tags unconditionally (e.g. GTM in your template). Before consent, tags send cookieless pings; after consent, full measurement. Gives Google modelling data but sends some data pre-consent — make a deliberate choice here and document it in your privacy policy.

For most Danish/EU sites Basic mode is the safer default; choose Advanced only if you rely on Google’s conversion modelling.