Access Customer Privacy API during checkout

Shopify Partner
19 1 14

We're using Shopify's own cookie consent banner app, and have successfully hooked in to the Customer Privacy API on the storefront to stop tracking pixels from firing unless the user has given consent via the banner. We need to do the same on the order confirmation page, but Shopify.loadFeatures() doesn't exist so we can't load the consent tracking api to query whether the user has granted consent.

How can we verify (either via JS or liquid) on the order confirmation page that the user has accepted tracking cookies?

Reply 1 (1)

Shopify Partner
1 0 0

It looks like you can access this via the globally available api.init.customerPrivacy web pixel object.

    analyticsProcessingAllowed: true,
    marketingAllowed: true,
    preferencesProcessingAllowed: true,
    saleOfDataAllowed: true