Set up Google Consent Mode v2 with GA4 and GTM

CookieRay Team
•
3 min read

Set up Google Consent Mode v2 with GA4 and GTM

This guide walks through enabling Google Consent Mode v2 in CookieRay for a site that already uses Google Analytics 4 (GA4) or Google Tag Manager (GTM), then checking that the signals are firing.

Before you start

  • Your Google tag must already be on the site — a GA4 tag, a Google Ads tag, or a GTM container. CookieRay sends the consent signals; it does not install Google tags for you. (CookieRay Pro can add a GTM container for you — see Integrations.)
  • Decide your blocking mode. Consent Mode works in either mode.
  1. Open CookieRay → Settings.
  2. In the Google Consent Mode v2 card, switch on Enable Google Consent Mode v2.
  3. Save the configuration.
  4. Make sure the banner is enabled under Settings → Show Cookie Consent Banner.

What CookieRay sends

Before the visitor chooses, CookieRay sets a default consent state ahead of your Google tags:

SignalDefault
ad_storagedenied
analytics_storagedenied
ad_user_datadenied
ad_personalizationdenied
personalization_storagedenied
functionality_storagegranted (Necessary)
security_storagegranted (Necessary)

It also sets wait_for_update to 500 ms so Google tags give the banner a moment to report a stored choice.

After the visitor chooses, CookieRay sends an update based on the categories they allowed:

Visitor allowsSignals set to granted
Analyticalanalytics_storage
Marketingad_storage, ad_user_data, ad_personalization
Functionalpersonalization_storage

A category the visitor refuses stays denied.

Step 2: Verify it works

  1. Open your site in a private/incognito window with the banner enabled.
  2. Open the browser developer tools console and inspect window.dataLayer. You should see a consent default entry with the denied values.
  3. Click Accept All in the banner. A consent update entry should follow with the granted values.
  4. Repeat with Decline and confirm the values stay denied.
  5. Optionally use Google’s Tag Assistant to confirm your tags read the consent state.

Things to know

  • Signals are sent in the visitor’s browser. CookieRay makes no server-side calls to Google.
  • How GA4, Ads or GTM tags behave when consent is denied depends on your Google account and tag configuration, not on CookieRay.
  • If a theme or analytics plugin also pushes its own consent update before the visitor has chosen, CookieRay holds back premature “granted” updates until the visitor has made a choice.
  • In Strict mode, GA4/GTM scripts are also delayed until the matching category is allowed. In Log Only mode, Google tags load straight away and rely on Consent Mode to limit what they do.

Was this article helpful?

Your response is saved on this device.