Logo

How We Handle Google Consent Mode V2

How SlideRule Analytics’s GA4 Shopify integration handle Google Consent Mode V2

·2 minutes reading
Cover Image for How We Handle Google Consent Mode V2

Google released Consent Mode V2 early in 2024. SlideRule Analytics’s Shopify GA4 integration implemented Consent Mode V2 on April 24th, 2024.

There are many good posts (in particular this one) about how Consent Mode V2 affects Google products, in particular, Google Analytics 4, Google Tag Manager and Google Ads.

The main effect for Google Analytics 4, however, is the two new consent signals, ad_user_data and ad_personalization. These two signals should only affect users that integrate GA4 with Google Ads.

Here’s how we handle it in SlideRule’s GA4 app.

First, we continue to rely on Shopify’s Customer Privacy API to determine cookie consent. As before, if analytics consent is not granted, we do not load GA4.

When analytics consent is granted, we load GA4 immediately.

Now, when analytics consent is granted, we also send a consent hit to GA4 like so

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

Here’s how we determine the status of each signal using Shopify’s Customer Privacy API.

If the cookie banner is not required (because the user is not in a privacy region like the EU), then all four signals are set to granted.

analytics_storage - if analytics consent is set to ‘yes’ in the Customer Privacy API, then analytics_storage is set to true.

ad_storage - if marketing consent is set to ‘yes’ in the Customer Privacy API, then ad_storage is set to true.

ad_user_data - if and only if the cookie banner is not required, the ad_user_data is set to true. If the banner is required and the user consents to marketing, we still set ad_user_data to false.

ad_personalization - if and only if the cookie banner is not required, the ad_personalization is set to true. If the banner is required and the user consents to marketing, we still set ad_personalization to false.

The Shopify Customer Privacy API does not yet have the required language for granting ad_user_data and ad_personalization, so we cannot set the signals until Shopify provides that.

The result is that all shoppers in the EU will always have ad_user_data and ad_personalization set to false in GA4, whereas all shoppers in regions without cookie banner requirements will always have them set to true.