Consent Mode
Shopify Consent Mode v2 and GDPR: Customer Privacy API, UET and GTM without double banners
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
setTrackingConsentinto 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.jsintheme.liquidor 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 category | Google Consent Mode v2 | Microsoft UET | Shopify Customer Privacy API |
|---|---|---|---|
| Necessary | security_storage: granted | No ad cookies | Cart & checkout stay active |
| Preferences (optional) | functionality_storage, personalization_storage | Unchanged | preferences |
| Statistics | analytics_storage | Unchanged | analytics |
| Marketing | ad_storage, ad_user_data, ad_personalization | ad_storage | marketing, 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.
- Duplicate your live theme as a backup under
Online Store > Themes > Duplicate. - 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. - Open
Online Store > Themes > Edit code > Layout > theme.liquidand paste the Limes script plus bridge directly below the opening<head>tag, ahead of{{ content_for_header }}and any manual tracking tags. - 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. - Add a "Cookie settings" link in your footer (
Sections > footer.liquid) withonclick="window.Limes?.openSettings(); return false;"so shoppers can withdraw consent any time under Art. 7(3) GDPR.
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:
- 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 modegtm.jsmust not have loaded. - Inspect DevTools Cookies and Network before choosing: no analytics or marketing cookies such as
_ga,_fbpor_uetvidshould appear. - Click Accept and run
window.Shopify.customerPrivacy.currentVisitorConsent()in the console to confirmanalyticsandmarketingreportyes, while Tag Assistant records agrantedconsent update. - Open the footer link, withdraw consent, and verify that Google Consent Mode v2, Microsoft UET and
setTrackingConsentflip back to denied.
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
- Consent mode overview(opens in a new tab) The four signals ad_storage, analytics_storage, ad_user_data and ad_personalization plus basic vs. advanced mode.
- Troubleshoot consent mode with Tag Assistant(opens in a new tab) Verifying consent default before the first tag and consent update after a choice.
- Section 25 TDDDG, protection of privacy in terminal equipment(opens in a new tab) Prior consent for non-essential cookies and terminal device access.
- Universal Event Tracking(opens in a new tab) Microsoft Advertising UET consent mode for EEA, UK and Swiss traffic.
- Regulation (EU) 2016/679 (GDPR)(opens in a new tab) Art. 6(1)(a) and Art. 7 (proof of consent and withdrawal).
- Ruling on manipulative cookie banner: Reject All button is mandatory, Press Release No. 08/2025(opens in a new tab) Administrative Court of Hanover on prior consent for loading Google Tag Manager.