# customerPrivacy Provides access to the [customerPrivacy API](/api/web-pixels-api/pixel-privacy#customer-privacy-api) to track whether or not customers have given consent. ### Accessing Standard Api ```js import {register} from '@shopify/web-pixels-extension'; register(({analytics, init, customerPrivacy}) => { // Use the init.customerPrivacy object to get the initial customer privacy status let customerPrivacyStatus = init.customerPrivacy; // Use the customerPrivacy Standard API to subscribe to consent collected events and update the status customerPrivacy.subscribe('visitorConsentCollected', (event) => { customerPrivacyStatus = event.customerPrivacy; /** * { * "analyticsProcessingAllowed": boolean, * "marketingAllowed": boolean, * "preferencesProcessingAllowed": boolean, * "saleOfDataAllowed": boolean, * } */ }) // Every product added to cart event will have the most up to date customer privacy status analytics.subscribe("product_added_to_cart", event => { const payload = { eventName: event.name, customerPrivacyStatus: customerPrivacyStatus, }; fetch('https://example.com/pixel', { method: 'POST', body: JSON.stringify(payload), keepalive: true, }); }); }); ``` ```js let customerPrivacyStatus = init.customerPrivacy; // Use the customerPrivacy Standard API to subscribe to consent collected events and update the status api.customerPrivacy.subscribe('visitorConsentCollected', (event) => { customerPrivacyStatus = event.customerPrivacy; /** * { * "analyticsProcessingAllowed": boolean, * "marketingAllowed": boolean, * "preferencesProcessingAllowed": boolean, * "saleOfDataAllowed": boolean, * } */ }) // Every product added to cart event will have the most up to date customer privacy status analytics.subscribe("product_added_to_cart", event => { const payload = { eventName: event.name, customerPrivacyStatus: customerPrivacyStatus, }; fetch('https://example.com/pixel', { method: 'POST', body: JSON.stringify(payload), keepalive: true, }); }); ``` ## Properties ### CustomerPrivacySubscribe ### subscribe ### Name The name of the customer event string