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.
Step 1: Turn on Consent Mode v2
- Open CookieRay → Settings.
- In the Google Consent Mode v2 card, switch on Enable Google Consent Mode v2.
- Save the configuration.
- 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:
| Signal | Default |
|---|---|
ad_storage | denied |
analytics_storage | denied |
ad_user_data | denied |
ad_personalization | denied |
personalization_storage | denied |
functionality_storage | granted (Necessary) |
security_storage | granted (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 allows | Signals set to granted |
|---|---|
| Analytical | analytics_storage |
| Marketing | ad_storage, ad_user_data, ad_personalization |
| Functional | personalization_storage |
A category the visitor refuses stays denied.
Step 2: Verify it works
- Open your site in a private/incognito window with the banner enabled.
- Open the browser developer tools console and inspect
window.dataLayer. You should see aconsentdefaultentry with the denied values. - Click Accept All in the banner. A
consentupdateentry should follow with the granted values. - Repeat with Decline and confirm the values stay denied.
- 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
consentupdatebefore 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.