TrustArc Cookie Consent Manager provides a way to manage users' cookie preferences, and ensure GDPR cookie compliance.

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

  1. Change your store settings so that your store waits for the user to grant consent before tracking.
  2. Install the Cookie Consent Manager as normal.
  3. 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"/> 
                

4. [optional] Install Littledata's Shopify to Google Analytics or Shopify to Segment connection

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 false.

The full source of the script is available here.