The EU Cookie Law requires you to obtain the user’s consent before saving any cookies to their browser (which both Google Analytics and Facebook Pixel do). Shopify instructs you to use their integrations of Google Analytics/Pixel, because they’re already fully integrated with their eCommerce. So somehow we have to stop Shopify from triggering analytics cookies before we get the user’s consent.
I can’t figure out how it is possible to do this.
As near as I can tell analytics is triggered by a variable called trekkie within {{ content_for_header }}, which is loaded in the head of theme.liquid
I can stop analytics all together if I just comment out {{ content_for_header }}, but that stops a heap of other important code from running as well, so it’s not a viable solution.
Any thoughts on how to stop Shopify from running analytics, and then to trigger it later once I’ve gained the user’s consent to use cookies?
2
Answers
I found that enabling ‘Use Enhanced Ecommerce.’ resolved it for me.
Tanks @Piers
(Themes > Preference) there is a checkbox with the label ‘Use Enhanced Ecommerce.’ Tick this option, then clear the cookies in your browser (in Google Chome you can do this using right-click > Inspect > Applications > Cookies, then right-click on your domain name and select Clear) and refresh. –