Privacy API and external CMP

Hello,

I tried to implement the Privacy API with our consent management platform.

I followed the documentation and created a script to update consent based on users interactions on our cookie widget, using this documentation : https://shopify.dev/docs/api/consent-tracking

It worked fine on several websites, but it won’t work on this website : https://www.blue-cult.com/

Even if I select the option “Collected after consent” in the preferences, the object “Shopify.customerPrivacy” is undefined.

I put it back on “Collected before consent” for now to prevent data loss.

Did I miss something ?

Best regards

HI LoicAxeptio,

A few things could cause this issue where the object “Shopify.customerPrivacy” is undefined on the website:

  1. The Customer Privacy API is not loaded properly: Ensure that you have correctly loaded the Customer Privacy API. You can do this by invoking the Shopify.loadFeatures function as described in the documentation.

  2. The script is executing before the API has finished loading: It’s important to remember that the API load is asynchronous. If your script is running before the API has fully loaded, Shopify.customerPrivacy could be undefined. Ensure that your code is wrapped inside the callback of loadFeatures or is running after the API has loaded.

  3. Conflicts with other scripts: If you have other JavaScript running on your site, there could be conflicts that are causing issues with the Customer Privacy API. You might want to check and debug any other scripts you have running.

  4. The website is using a cached version of the page: Clear the cache and cookies of your browser and try again.

Try out the above and let us know if you’re still experiencing issues,

1 Like

What about on checkout where Shopify.loadFeatures is not defined? I currently have to parse the _tracking_consent cookie which really screws up the whole idea of having a Javascript API.