Hello,
We’re trying to troubleshoot some issues in connecting our OneTrust implementation, GTM and Shopify Privacy API.
The pattern we’re using seems to work quite well, except for the calls to setTrackingConsent, which seemingly ignore instructions.
window.Shopify.customerPrivacy.setTrackingConsent(
{
marketing: false,
analytics: false,
preferences: false,
sale_of_data: false,
},
(data) => {
if (data?.error) {
console.error('Error setting tracking consent:', data.error);
return;
}
console.log('Tracking consent set');
},
);
Which returns:
Consent event received, updating true {marketing: ‘yes’, analytics: ‘yes’, preferences: ‘yes’, sale_of_data: ‘no’}
followed by:
window.Shopify.customerPrivacy.currentVisitorConsent();
Which returns:
{marketing: 'yes', analytics: 'yes', preferences: 'yes', sale_of_data: 'no'}
In code, this is wrapped inside of the callback for OneTrust consent, but that doesn’t seem relevant considering you can reproduce the problem direct from your console using the above scripts.
I’ve tried this on many of our managed sites as well as some other random shopify (headed) sites and it’s the same situation everywhere I go. What could be preventing a proper update when:
- No VPN
- GPC flag is not enabled
- The call is “successful”