/
Shopify App Sync With Usercentrics CMP V2

Usercentrics - PUBLIC

Shopify App Sync With Usercentrics CMP V2

Step 1 - update your list of DPS

  • Open the Usercentrics Shopify App. Go to the 'Technologies' tab and select 'Third-Party Technologies.' Find and remove the 'All My Shopify Trackings' DPS (or any similarly broad DPS related to Shopify Tracking that you have set up).

  • Add three new predefined Data Processing Services:

    • To do this, first select the category where you want your DPS to appear in the 'Categories' section. Then, in the 'Third-Party Technologies' section, add the following technologies:

      • ā€œShopify Analyticsā€ (Template ID: ZQOx-TM97Y3rLe)

      • ā€œShopify Marketingā€ (Template ID: zixK7I8y1mhf1D)

      • ā€œShopify Preferencesā€ (Template ID: T4PQQdTkrEofhd)

      note: it should have the exact same name as listed above)

Screenshot 2024-08-12 at 11.44.22.png

Details about window event usage.

Step 3 - replace the existing consent tracking script with the new one, or add the new script if none currently exists.

  • Navigate to your Shopify layout and open the theme.liquid file.

  • Locate the Shopify Consent Tracking API script within your HTML. You can refer to this old documentation to confirm you've identified the correct script.

  • Remove the old script and replace it with the new script provided below, placing it at the bottom of your <head> section.

<script type="text/javascript"> window.Shopify.loadFeatures( [{ name: 'consent-tracking-api', version: '0.1' }], error => { if (error) throw error console.log('** Shopify Consent Tracking API loaded') const syncTrackingConsent = consentObj => { window.Shopify.customerPrivacy.setTrackingConsent(consentObj, () => { console.log("** UC consent synced with Shopify Customer Privacy API") console.log("- Shopify consent:") console.log(window.Shopify.customerPrivacy.currentVisitorConsent()) console.log("--------------------------") }) } window.addEventListener("ucEvents", function (e) { if (e.detail && e.detail.event == "consent_status") { analyticsConsent = e.detail['Shopify Analytics'] marketingConsent = e.detail['Shopify Marketing'] preferencesConsent = e.detail['Shopify Preferences'] console.log('** Usercentrics consent:') console.log("- action: " + e.detail.action) console.log("- type: " + e.detail.type) console.log("- Analytics: " + analyticsConsent) console.log("- Marketing: " + marketingConsent) console.log("- Preferences: " + preferencesConsent) let consentObj = {} switch (e.detail.action) { case 'onDenyAllServices': consentObj = { analytics: false, marketing: false, preferences: false, sale_of_data: false } break; case 'onAcceptAllServices': case 'onNonEURegion': consentObj = { analytics: true, marketing: true, preferences: true, sale_of_data: true } break; default: consentObj = { analytics: analyticsConsent, marketing: marketingConsent, preferences: preferencesConsent } } syncTrackingConsent(consentObj) } }) } ) </script>

This is what your file will look like:

Screenshot 2024-08-12 at 14.48.23.png

Step 3 - ensure the script is working

  • Visit your Shopify store's website and open the Developer Tools console.

  • Confirm that you see the log message: "** Shopify Consent Tracking API loaded"

  • Open the Usercentrics banner and modify your consent preferences.

  • Verify that the console displays the log: "** UC consent synced with Shopify Customer Privacy API," along with the consent details, ensuring it is properly synced.

Ā 

Ā 

Related pages

Usercentrics - PUBLIC