Littledata has written a script to integrate TrustArc with Shopify's Customer Privacy API. This makes TrustArc compatible with Shopify's own tracking, and Littledata's enhanced tracking scripts.
How to add use the script
- Change your store settings so that your store waits for the user to grant consent before tracking.
- Install the Cookie Consent Manager as normal.
- Add this code snippet to the Shopify theme layout file.
<!-- TrustArc to Shopify Customer Privacy API integration by Littledata --> <script src="https://master-shopify-tracker.s3.amazonaws.com/trustArc.js"/>
What does the script do?
After the TrustArc PrivacyManager loads, this script registers an event to be triggered when the user updates their preferences.
When that update happens, if the user has consented to 'Functional Cookies' (to analyze site usage so we can measure and improve performance), the
userCanBeTracked field is set to
true and Shopify and Littledata's tracking then starts.
This will also work with any other apps which integrate with Shopify's Customer Privacy API.
If the user later revokes consent to Functional Cookies , then
userCanBeTracked is set to
The full source of the script is available here.