/
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 content

Shopify Sync With Usercentrics CMP V3
Shopify Sync With Usercentrics CMP V3
More like this
Shopify Sync With Usercentrics CMP v2
Shopify Sync With Usercentrics CMP v2
More like this
Shopify Consent Sync with Shopify's Customer Privacy API
Shopify Consent Sync with Shopify's Customer Privacy API
More like this
Shopify Consent Tracking API
Shopify Consent Tracking API
Read with this
[Waiting for Revision] Shopify App Sync With Usercentrics CMP V2
[Waiting for Revision] Shopify App Sync With Usercentrics CMP V2
More like this
How do I set the language of the Usercentrics CMP version 2?
How do I set the language of the Usercentrics CMP version 2?
Read with this

Usercentrics - PUBLIC