Skip to main content

Consent Mode

Shopify Consent Mode v2 and GDPR: Customer Privacy API, UET and GTM without double banners

How EU Shopify stores connect the Customer Privacy API, Google Consent Mode v2 and Microsoft UET through one banner without GTM or pixels firing before consent.

Published
Reviewed on
Reading time
5 min read
By
Limes
On this page

The short answer

EU Shopify stores running Google Ads and Google Analytics 4 repeatedly run into the same three failures: two cookie banners stacked on top of each other, missing updates to Shopify's Customer Privacy API (leaving checkout Web Pixels unaware of the shopper's choice), or Google Tag Manager firing before the visitor clicks Accept.

A clean setup drives all three layers from one banner: Limes loads directly below <head> in theme.liquid, sets Google Consent Mode v2 and Microsoft UET Consent Mode defaults to denied, holds Google Tag Manager back in Basic mode until consent, and forwards every choice to Shopify's Customer Privacy API. See also the Shopify cookie banner overview.

Why Shopify consent setups fail under GDPR and § 25 TDDDG

Under § 25(1) TDDDG (implementing Art. 5(3) ePrivacy) and Art. 6(1)(a) GDPR, analytics and marketing cookies require prior opt-in. For EEA, UK and Swiss traffic, Google (since March 2024 for Consent Mode v2) and Microsoft (since May 2025 for UET) also enforce explicit consent signals.

  • Double banners: Shopify's built-in cookie banner stays enabled while a third-party CMP also runs, presenting shoppers with two conflicting dialogs.
  • Checkout blind spot: Theme scripts do not execute on Shopify Checkout pages. Only when your CMP passes the choice via setTrackingConsent into Shopify's Customer Privacy API do checkout Web Pixels and the native Google & YouTube channel honour the visitor's consent.
  • GTM firing before consent: Hardcoding gtm.js in theme.liquid or via an app contacts Google servers before any click. In 2025, the Administrative Court of Hanover ruled that loading Google Tag Manager requires prior consent (see Google Tag Manager consent).

How one choice updates every tracking interface

When a shopper makes a choice in the Limes banner or later withdraws consent, the same selection drives Google, Microsoft and Shopify together:

Mapping between Limes, Google Consent Mode v2, Microsoft UET and Shopify

Limes categoryGoogle Consent Mode v2Microsoft UETShopify Customer Privacy API
Necessarysecurity_storage: grantedNo ad cookiesCart & checkout stay active
Preferences (optional)functionality_storage, personalization_storageUnchangedpreferences
Statisticsanalytics_storageUnchangedanalytics
Marketingad_storage, ad_user_data, ad_personalizationad_storagemarketing, sale_of_data

Step-by-step setup in Shopify Admin and theme.liquid

The Limes SDK calls window.Shopify.customerPrivacy.setTrackingConsent automatically whenever Shopify's API is already present on the page. Because Shopify storefronts often load consent-tracking-api asynchronously via window.Shopify.loadFeatures and inject window.Shopify inside {{ content_for_header }}, adding the short bridge below ensures reliable sync for both first-time decisions and returning visitors.

  1. Duplicate your live theme as a backup under Online Store > Themes > Duplicate.
  2. Open Settings > Customer privacy: configure EEA, UK and Switzerland regions to collect data only after consent, and disable Shopify's built-in cookie banner so shoppers never see two banners.
  3. Open Online Store > Themes > Edit code > Layout > theme.liquid and paste the Limes script plus bridge directly below the opening <head> tag, ahead of {{ content_for_header }} and any manual tracking tags.
  4. If you use Google Tag Manager, enter your GTM container ID in Limes in the default Basic mode (see basic vs advanced mode) and remove the old GTM snippet from theme.liquid. If you rely on Shopify's official Google & YouTube channel instead, it reads consent straight from the Customer Privacy API.
  5. Add a "Cookie settings" link in your footer (Sections > footer.liquid) with onclick="window.Limes?.openSettings(); return false;" so shoppers can withdraw consent any time under Art. 7(3) GDPR.
Layout/theme.liquid (directly below <head>)

The bridge avoids timing races with {{ content_for_header }} and syncs stored choices on returning visits as reliably as fresh clicks and withdrawals.

<script src="https://cdn.uselimes.com/v1/YOUR-SITE-ID.js"></script>
<script>
  function syncShopifyConsent(state) {
    if (!state || !state.hasDecision) return;
    var s = state.selection;
    var payload = {
      analytics: Boolean(s.statistics),
      marketing: Boolean(s.marketing),
      preferences: Boolean(s.preferences),
      sale_of_data: Boolean(s.marketing)
    };
    function hasApi() {
      return Boolean(
        window.Shopify &&
        window.Shopify.customerPrivacy &&
        typeof window.Shopify.customerPrivacy.setTrackingConsent === 'function'
      );
    }
    function apply() {
      if (hasApi()) {
        window.Shopify.customerPrivacy.setTrackingConsent(payload, function () {});
      }
    }
    function run() {
      if (hasApi()) {
        apply();
      } else if (window.Shopify && typeof window.Shopify.loadFeatures === 'function') {
        window.Shopify.loadFeatures([{ name: 'consent-tracking-api', version: '0.1' }], function (err) {
          if (!err) apply();
        });
      }
    }
    if (hasApi() || (window.Shopify && typeof window.Shopify.loadFeatures === 'function')) run();
    else if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', run, { once: true });
    }
  }
  function bindLimesShopify() {
    window.Limes.on('change', syncShopifyConsent);
    syncShopifyConsent(window.Limes.getState());
  }
  if (window.Limes) bindLimesShopify();
  else window.addEventListener('limes:ready', bindLimesShopify, { once: true });
</script>

Verify with Tag Assistant, Customer Privacy API and the scanner

After publishing your theme change, verify every path in a private browser window:

  1. Open the store with Google Tag Assistant connected and click nothing in the banner: all four Consent Mode v2 signals must read denied, and in Basic mode gtm.js must not have loaded.
  2. Inspect DevTools Cookies and Network before choosing: no analytics or marketing cookies such as _ga, _fbp or _uetvid should appear.
  3. Click Accept and run window.Shopify.customerPrivacy.currentVisitorConsent() in the console to confirm analytics and marketing report yes, while Tag Assistant records a granted consent update.
  4. Open the footer link, withdraw consent, and verify that Google Consent Mode v2, Microsoft UET and setTrackingConsent flip back to denied.
Limes scan report with the last scan, violations, undeclared storage and registered services for example.com
Scan report in the Limes app listing pre-consent violations and declared services (sample data for example.com).

Keep watch as new Shopify apps are added

Every newly installed Shopify app can add app embeds or Web Pixels that introduce new cookies. Check your storefront homepage any time without an account in the free cookie scan: Chromium loads the page without clicking and lists every cookie and third-party host firing before consent.

Inside Limes, the cookie scanner checks all five consent states including reject and withdrawal: monthly on Free (2,500 sessions a month, €0) and weekly with drift alerts from Professional (€29/month billed annually). Because Limes bills on monthly sessions rather than product URLs, large Shopify catalogues pay no subpage surcharge (see pricing).

Frequently asked questions

Why use an external CMP like Limes instead of Shopify's built-in banner?

Shopify's built-in banner covers Shopify's own analytics and Customer Privacy API apps, but it does not run an automated pre-publish compliance check on button parity and contrast, does not offer consent-rate A/B testing, does not store SHA-256 sealed proofs in Frankfurt, and does not automatically block manual theme scripts.

Does Limes consent carry into Shopify Checkout pages?

Yes, through the window.Shopify.customerPrivacy.setTrackingConsent(...) handoff shown above. Because theme scripts do not run inside Shopify Checkout, storing the choice via the Customer Privacy API ensures checkout Web Pixels and the Google & YouTube channel read the same consent state.

Should I use Basic or Advanced Google Consent Mode v2 on Shopify in the EU?

In Germany and strict EU setups, Basic mode is the conservative default because gtm.js loads only after consent and sends nothing to Google pre-consent. Limes defaults to Basic mode; enable Advanced mode only if your data protection adviser approves cookieless pings.

Does every product page view on Shopify count as a separate session?

No. Limes counts cookie-free sessions per visit. A shopper browsing twelve product pages and the cart counts as one session, not twelve page views.

Sources

  1. Consent mode overview(opens in a new tab) Google for Developers developers.google.com The four signals ad_storage, analytics_storage, ad_user_data and ad_personalization plus basic vs. advanced mode.
  2. Troubleshoot consent mode with Tag Assistant(opens in a new tab) Google for Developers developers.google.com Verifying consent default before the first tag and consent update after a choice.
  3. Section 25 TDDDG, protection of privacy in terminal equipment(opens in a new tab) German Federal Ministry of Justice gesetze-im-internet.de Prior consent for non-essential cookies and terminal device access.
  4. Universal Event Tracking(opens in a new tab) Microsoft Learn learn.microsoft.com Microsoft Advertising UET consent mode for EEA, UK and Swiss traffic.
  5. Regulation (EU) 2016/679 (GDPR)(opens in a new tab) EUR-Lex eur-lex.europa.eu Art. 6(1)(a) and Art. 7 (proof of consent and withdrawal).
  6. Ruling on manipulative cookie banner: Reject All button is mandatory, Press Release No. 08/2025(opens in a new tab) Data Protection Authority of Lower Saxony (LfD Niedersachsen) lfd.niedersachsen.de 20 May 2025 Administrative Court of Hanover on prior consent for loading Google Tag Manager.

Cookie banner for Shopify with the Customer Privacy API

Topic overview

Set up a banner where reject stays equal.

The Free plan includes a banner for one domain with Google Consent Mode v2 and consent proofs.