Consent Management Integrations
Ensure Shoplift respects visitor privacy preferences by integrating with Shopify's Customer Privacy API or your custom consent management platform.
Overview
Shoplift is designed to work seamlessly with privacy regulations like GDPR, CCPA, and other data protection laws. By default, Shoplift automatically integrates with Shopify's Customer Privacy API to respect visitor consent preferences. For stores using third-party consent management platforms, Shoplift provides the setAnalyticsConsent()
method to manually sync consent status.
This integration ensures that:
Visitor data is only collected when appropriate consent is given
Test assignments respect privacy preferences
Analytics tracking aligns with consent status
Your store remains compliant with privacy regulations
How Consent Works in Shoplift
Default Behavior: Shopify Customer Privacy API
For most Shopify stores, no additional configuration is needed. Shoplift automatically:
Listens to Shopify's consent signals via the Customer Privacy API
Respects consent preferences before collecting any analytics data
Stores test assignments but only tracks analytics when consent is granted
Updates tracking status if visitors change their consent preferences
How Test Assignment Works with Consent
Understanding the distinction between test assignment and analytics tracking is crucial:
Test Assignment: Always occurs to ensure consistent user experience
Analytics Tracking: Only occurs when consent is granted
Data Collection: Respects consent preferences in real-time
This means visitors always see the correct test variant, but their data is only included in analytics when they've consented to tracking.
Custom Consent Management Platforms
If you're using a third-party consent management platform that doesn't integrate with Shopify's Customer Privacy API, use the setAnalyticsConsent()
method to manually manage consent status.
The setAnalyticsConsent Method
window.shoplift.setAnalyticsConsent(consent: boolean): Promise<void>
Parameters:
consent
(boolean):true
to enable analytics tracking,false
to disable
Returns
Promise that resolves when consent preference is updated
Basic Implementation Pattern
// Generic implementation for any consent platform
function syncConsentWithShoplift(hasConsent) {
if (window.shoplift && window.shoplift.setAnalyticsConsent) {
window.shoplift.setAnalyticsConsent(hasConsent)
.then(() => {
console.log('Shoplift consent updated:', hasConsent);
})
.catch(error => {
console.error('Failed to update Shoplift consent:', error);
});
} else {
// Retry if Shoplift isn't loaded yet
setTimeout(() => syncConsentWithShoplift(hasConsent), 100);
}
}
// Example: Listen for consent changes from your platform
window.addEventListener('consentUpdated', (event) => {
const hasAnalyticsConsent = event.detail.analytics || event.detail.statistics;
syncConsentWithShoplift(hasAnalyticsConsent);
});
Understanding Consent Categories
Different consent platforms use various category names. Map these to Shoplift's analytics consent:
Analytics
✅ Enable tracking
Performance measurement and analytics
Marketing
❌ Not required
Shoplift doesn't do remarketing
Functional
❌ Not required
Test assignment works regardless
Necessary
❌ Not required
Core functionality always available
Important Notes
Test variants always display correctly regardless of consent status
Only analytics data collection is affected by consent
Consent can be updated at any time during the session
No retroactive data is collected when consent is granted later
Best Practices
Set consent early: Update consent status as soon as it's available
Handle consent changes: Listen for updates throughout the session
Be transparent: Clearly communicate what data is collected
Test thoroughly: Verify behavior with consent both granted and denied
Document your setup: Keep track of how consent categories map to Shoplift
Last updated
Was this helpful?