Shopify ships a native consent system — window.Shopify.customerPrivacy — and it is the only correct way to control Shopify's own analytics cookies and sandboxed Web Pixels. A consent app that ignores it leaves _shopify_y and _shopify_s running whatever the shopper chose.
What it controls
- Shopify's analytics cookies —
_shopify_y,_shopify_sand the marketing attribution cookies - Web Pixels — pixels installed through Shopify's sandboxed framework only fire for consented purposes
- Checkout tracking — the consent state carries into checkout, where apps cannot inject scripts at all
The call that does the work
window.Shopify.customerPrivacy.setTrackingConsent({
analytics: false,
marketing: false,
preferences: false,
sale_of_data: false
}, callback);
Four keys, matching the categories a banner offers. sale_of_data exists for US-style laws — it is what the “Do Not Sell or Share” link should flip, and it is also the correct response to a Global Privacy Control signal.
What it does not control
Scripts injected directly into the page — a Meta pixel added by an app's script tag, a TikTok snippet pasted into the theme — are invisible to it. Shopify gates what runs inside its own framework; everything outside needs a consent tool doing genuine script blocking. The two mechanisms are complements, not alternatives: write the API for Shopify's side, block scripts for everything else.
Shopify.customerPrivacy.currentVisitorConsent() in the console before and after a consent choice. If it never changes, your banner isn't talking to Shopify.