Correct Shopify Cookie Consent implementation

Highlighted
New Member
5 0 0
According to GDPR shopify can not set statisitc and marketing cookies without prior user consent.
 

When I enable "Limit tracking for customers in Europe” setting - Shopify still places the cookies without consent, but as session cookies. This is still not GDPR compliant - but there is nothing we can do about that at the moment.

When a user gives consent the cookies will, according to Shopify documentation, be upgraded from session cookie to permanent cookie.
But I can not get this to work.

NOTE:
I will not be using shopify api to control other apps, but I'm only trying to control how and when shopify is placing cookies.
 
First question: Do I need to place this code on all pages - and is it correct?

 

 

<script>

window.Shopify.loadFeatures(
[
{
name: 'consent-tracking-api',
version: '0.1',
},
],
error => {
if (error) {
throw error; // if you want to raise
}
new Banner(); // or whatever method your banner uses to initialize
},
);

</script>

 

 

 
Second Question: Is this the correct code to run when a user consent is given?

 

 

<script>
function handleAccept(e) {
window.Shopify.customerPrivacy.setTrackingConsent(true);
document.addEventListener("trackingConsentAccepted", function () {
console.log("trackingConsentAccepted event fired");
});
}
</script>

 

 


I'm implementing this with google tagmanager and metomic cookie consent widget.
The second script will run when a user gives consent.

0 Likes