Shopify and Consent Mode Challenges
Shopify stores have specific complexities for Consent Mode v2 implementation:
- The checkout is hosted on checkout.shopify.com (a different domain from your store) in most plans
- Shopify's own tracking (order status page, Shopify Analytics) runs independently of GTM
- Shopify has a built-in Customer Privacy API for GDPR markets
- Some CMPs integrate directly with Shopify themes while others require custom theme code
Shopify's Built-in Customer Privacy API
Shopify provides a built-in consent framework via the Customer Privacy API. This API:
- Shows a consent banner for visitors from GDPR regions
- Stores consent choices in a Shopify-managed cookie
- Provides a JavaScript API (
window.Shopify.customerPrivacy) that your theme code can query for consent status
If you use Shopify's Customer Privacy API, you need to connect it to Google Consent Mode by reading the consent status and calling gtag('consent', 'update') accordingly. Shopify does NOT do this automatically — custom code or a Shopify app is required.
GTM on Shopify
Add GTM to Shopify by editing the theme's theme.liquid file. The GTM snippet goes in the <head> (script) and immediately after <body> (noscript). The Consent Mode default tag must fire before GTM loads — add the default consent code before the GTM snippet:
// In theme.liquid, before GTM snippet:
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'analytics_storage': 'denied',
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'wait_for_update': 500
});
Checkout Tracking on Shopify
For Shopify Plus plans, GTM can be added to the checkout via the checkout.liquid template. For non-Plus plans, GTM cannot be added to the checkout, but you can add it to the order status page (the post-checkout confirmation page) via Settings → Checkout → Additional Scripts.
The order status page is where purchase events fire. Ensure the Consent Mode update happens before the purchase event fires on this page.
Recommended CMP Apps for Shopify
- CookieYes (has Shopify-specific GTM integration)
- Pandectes GDPR Compliance (Shopify app with Consent Mode support)
- Consentik (Shopify-native CMP)
Choose a CMP that supports Shopify's architecture and provides a ready-made Consent Mode integration.
Summary
Shopify Consent Mode v2 implementation requires: adding the Consent Mode default code to theme.liquid before the GTM snippet, connecting your CMP to gtag('consent', 'update') when users make choices (either via a Shopify CMP app or custom Shopify Customer Privacy API integration), and handling the checkout domain separately (Shopify Plus: checkout.liquid; non-Plus: order status page only). Always verify in GTM Preview that consent signals flow correctly including on the order status page.
See our Consent Mode v2 Implementation service for Shopify setup.
Need Consent Mode v2 set up on Shopify? Contact Adslytics.
Need expert tracking setup?
Our Google Tag Manager experts have delivered 500+ tracking setups with a 98% success rate.
Get a Free Consultation →