Privacy and compliance

Google Consent Mode v2 on Shopify: Setup and Testing Guide

How Google Consent Mode v2 works on a Shopify store, how your cookie banner’s choice reaches GA4 and Google Ads, and a checklist to test it in Tag Assistant.

On this page

Google Consent Mode v2 on Shopify is how your cookie banner tells Google Analytics 4 and Google Ads what a visitor agreed to, using four consent types: ad_storage, analytics_storage, ad_user_data and ad_personalization. On Shopify, the choice usually travels from a banner connected to Shopify's Customer Privacy API to the Google & YouTube app, or from a banner app that sets consent for your Google tags directly. Either way, default to denied for visitors who must opt in, update the state when they choose, and prove it in Tag Assistant before you trust your reports.

This guide is general information, not legal advice.

Consent mode lets a website adjust how Google tags behave based on the visitor's consent choices (consent mode overview). It is not a banner. Google Ads Help says consent mode receives the choice from your cookie banner or widget and passes it to Google tags (About consent mode).

"v2" refers to Google's November 2023 update, which added ad_user_data and ad_personalization. Google's setup guide for websites asks sites that already used consent mode to upgrade so both signals are sent.

In code, consent mode is two commands: a default on every page before any Google tag sends data, and an update when the visitor chooses.

// Before the Google tag loads
gtag('consent', 'default', {
  ad_storage: 'denied',
  ad_user_data: 'denied',
  ad_personalization: 'denied',
  analytics_storage: 'denied',
  wait_for_update: 500,
});

// After the visitor accepts analytics and marketing
gtag('consent', 'update', {
  ad_storage: 'granted',
  ad_user_data: 'granted',
  ad_personalization: 'granted',
  analytics_storage: 'granted',
});

Order matters: Google warns that defaults won't work if the consent code runs out of order. A banner app or Shopify integration usually writes this code, but you need to know what it should produce to test it.

Google lists seven consent types. GA4 and Google Ads measurement depend on the first four.

Consent typeWhat it covers (Google's definition)Effect when deniedUsual banner category
ad_storageAdvertising storage, such as cookiesNo new advertising cookies are written and existing ones are not readMarketing
ad_user_data (v2)Sending user data to Google for online advertisingPersonal data for advertising is off, including user_id and hashed data for enhanced conversionsMarketing
ad_personalization (v2)Personalized advertisingRemarketing in Google Ads, Display & Video 360 and Search Ads 360 receives no dataMarketing
analytics_storageAnalytics storage, such as measuring visit durationFirst-party analytics cookies are not read or writtenAnalytics
functionality_storageStorage that keeps the site working, such as remembered settingsNot detailed in Google's overviewPreferences or necessary
personalization_storagePersonalization, such as recommendationsNot detailed in Google's overviewPreferences
security_storageAuthentication, fraud prevention and user protectionNot detailed in Google's overviewNecessary

The category column is a common mapping, not a Google rule. Match it to the categories your banner and cookie policy use.

The difference is whether Google tags load before the visitor chooses.

Basic consent modeAdvanced consent mode
Google tags before a choiceBlocked until the visitor interacts with the bannerLoad when the page opens, with consent defaulting to denied
Visitor declinesNothing is sent to Google, not even the consent statusTags send cookieless pings with the consent state and non-identifying information
Google Ads conversion modelingGeneral modelAdvertiser-specific model
GA4 behavioral modelingNot eligible, because Google requires tags to load before the consent dialogPossible once the property meets Google's thresholds

GA4's thresholds are concrete. Google's behavioral modeling article requires at least 1,000 events per day with analytics_storage denied for at least 7 days, and at least 1,000 daily users with it granted for at least 7 of the previous 28 days. A small store may not reach those numbers.

Basic mode has a cost too. Google's EEA consent mode update notes that when tags are blocked until the visitor interacts, Google can't verify consent choices, which may lead to data loss. Whether cookieless pings before consent are acceptable for your store is a legal question for a qualified professional. Whichever you pick, describe it in your Shopify privacy policy.

Google's EU user consent policy covers end users in the European Economic Area (EEA), the UK and Switzerland. It requires consent for cookies or local storage where legally required, and for using personal data to personalize ads. It also asks you to keep consent records, explain how to revoke consent, and identify each party that may collect or use the data.

Google's EEA update adds that advertisers using Google tags for measurement, ad personalization and remarketing must collect consent from EEA users and share consent signals with Google, including for Google Analytics data used in Google Ads. Google also says that since early March 2024, GA4 properties that took no action only include users outside the EEA in audiences for linked advertising products (Verify and update consent settings).

If you run remarketing or GA4 audiences in Google Ads with European traffic, missing ad_user_data and ad_personalization signals cost you audiences and measurement. Consent mode only transmits a choice; collecting a valid one is the banner's job, which our Shopify cookie banner guide covers. For the rest of what stays with you as the merchant, from your privacy policy to data requests, see our guide to Shopify GDPR compliance.

Shopify's Customer Privacy API is the store's record of the visitor's choice. Banners record consent with setTrackingConsent(), code checks it with methods such as marketingAllowed(), and a visitorConsentCollected event fires when it changes. In regions configured to require consent, non-essential purposes stay off until the visitor agrees; elsewhere, all purposes are allowed by default. Our guide to the Shopify Customer Privacy API explains its four purposes, consent regions and how to check them in the browser console.

Shopify's own cookie banner passes consent to this API automatically. With a third-party banner app, Shopify's customer privacy guide says to use the same consent regions in Settings > Customer privacy and in the app, or non-essential data can be processed before consent. Shopify's customer privacy overview adds that event data sent to Google from customers such as those in the EEA won't be used for personalized advertising unless Consent Mode v2 is active and valid consent is obtained.

The choice then reaches Google in one of three common ways.

SetupWhat sets Google consentWhat to watch
Google & YouTube app with a banner connected to the Customer Privacy APIThe app's Google tags, from Shopify's consent stateConfirm the default and update values in Tag Assistant
Google tag or Tag Manager loaded by the theme, with a banner app that sets consentThe banner appThe default must run before the Google tag, from one source only
Tag Manager inside a Shopify custom pixelYour own pixel codeConsent code is your responsibility, and Tag Assistant's tag troubleshooter can't see it

Setup 1: the Google & YouTube app

Google's page Set up Shopify to obtain user consent says to use a consent tool that integrates with Shopify's Customer Privacy API. With the Google & YouTube app handling conversion tracking, consent mode should then work automatically, and with Shopify's built-in banner it is enabled once the banner is on.

The pages we checked don't say whether the app uses basic or advanced mode, so check what it sends in Tag Assistant. Google's Shopify tag setup article also tells you to remove legacy and duplicate tags. An old GA4 snippet in the theme plus the app means double counting and two sources setting consent; the Shopify GA4 conversion tracking checklist covers the clean-up.

When a Google tag or Tag Manager container loads from the theme or an app embed, the banner app must set the default before the tag runs. For example, on the Advanced plan Cookify sends Consent Mode v2 signals to GA4 and Google Ads in basic mode. Before Google tags load, it sets the four core types plus functionality_storage and personalization_storage to denied, or to the visitor's saved choice. After the choice, analytics controls analytics_storage, marketing controls the three ad types and preferences controls the other two. The choice is also passed to Shopify's Customer Privacy API.

Setup 3: Google Tag Manager in a custom pixel

Shopify says a custom web pixel needs a code snippet to activate Consent Mode v2. It documents adding Tag Manager as a custom pixel under Settings > Customer events, where it runs in Shopify's sandbox. The example code sets all four consent types to granted, and Shopify warns it may not match what your store needs, so don't ship it unchanged.

Each custom pixel has a Permission setting, Required or Not required, for marketing, analytics and preferences. Set the purposes the pixel needs to Required, or read the visitor's real choice with init.customerPrivacy and the visitorConsentCollected subscription in Shopify's pixel privacy docs. Tag Assistant's Troubleshoot tag feature doesn't detect Google tags in a custom pixel, so test this setup with GA4 DebugView and your browser's network panel. Our guide to Shopify customer events and custom pixels covers each pixel privacy setting and how to test a pixel with Shopify's Pixel Helper.

Write down the expected result first, so a pass or fail is obvious.

ScenarioTag Assistant consent stateGA4 DebugView
Page loads, no choice yetDefault: denied for all four typesNo events
Visitor rejects allStays deniedNo events
Visitor accepts allUpdate: granted for all four typesEvents appear
Visitor allows analytics onlyanalytics_storage granted, ad types deniedDepends on how your banner loads GA4

Google's DebugView article confirms that events don't show in debug mode when consent mode is in place and the visitor hasn't consented to analytics cookies. Then work through the checks:

  1. List every source of Google tags: the Google & YouTube app, theme code, app embeds, Tag Manager and custom pixels. Remove duplicates.
  2. Start a clean session inside a consent region. Use a private window and a location inside your banner regions, for example through a VPN. Google's Tag Assistant troubleshooting guide suggests simulated locations in Chrome for regional defaults.
  3. Check the default before touching the banner. In Tag Assistant, open the earliest Consent event. ad_storage, ad_user_data, ad_personalization and analytics_storage should be set, with the On-page Default column showing denied. An empty Consent tab means consent mode isn't running on that page.
  4. Watch the network panel before the choice. Basic mode should show no Google tag requests yet. In advanced mode, requests carry consent parameters; Google says gcs transmits ad_storage and analytics_storage.
  5. Reject all. Nothing should switch to granted, and DebugView (Admin > Data display > DebugView in GA4) should stay empty.
  6. Accept all in a new private window. The On-page Update column should show granted, the Tags tab should show tags firing, and your events should appear in DebugView.
  7. Test partial choices and withdrawal. Allow analytics only, then marketing only, then reopen the preferences and reject. Google says visitors must be able to move consent both ways.
  8. Move through the store and checkout. Each new page should start from the saved choice; Google warns that a missing update on a transition page can drop key data. Place one test order with consent accepted and one with it rejected.
  9. Cross-check Shopify's record. In the browser console, run window.Shopify.customerPrivacy.currentVisitorConsent() where the API is loaded. It returns yes, no or an empty value per purpose, which should match the banner.
  10. Repeat from outside your consent regions, where Shopify allows all purposes by default.
  11. Check Google's status a few days later. A Google Ads conversion action's Diagnostics tab should show "Consent mode is implemented", which can take 48 hours (Verify consent mode implementation). In GA4, open Admin > Data collection and modification > Consent settings; Google says notifications there can take 48 to 72 hours to refresh.

Most failures show up in steps 3, 8 and 9: a default set after a tag already ran, two sources setting the default, or banner regions that don't match Shopify's. Rerun the list after any banner, theme or Google change. Consent Mode v2 is on Cookify's Advanced plan; see the pricing page for what each plan includes.

Frequently asked questions

Google's Shopify consent page says consent mode is enabled automatically once you turn on Shopify's built-in banner, and that it should work automatically for Google & YouTube app conversion tracking. Shopify describes its banner as governing Shopify-specific tools, including Shopify Pixels, so check separately any Google tag your theme loads directly.

Google's EU user consent policy covers visitors from the EEA, the UK and Switzerland. Without that traffic it may not apply, but other privacy laws might, so ask a qualified professional what covers your store.

Shopify warns that collecting data only after consent can show up as fewer sessions and changed conversion rates. GA4's behavioral modeling only fills that gap for properties using advanced mode that meet Google's thresholds.

Sources