useCustomerPrivacy
A hook that loads the Customer Privacy API. When using Hydrogen's request handler, the Storefront API proxy is automatically detected and used for consent requests.
You can also listen to a document event for shopifyCustomerPrivacyApiLoaded. It will be emitted when the Customer Privacy API is loaded.
Anchor to useCustomerPrivacy-parametersParameters
- Anchor to propspropspropsCustomerPrivacyApiPropsCustomerPrivacyApiPropsrequiredrequired
CustomerPrivacyApiProps
- checkoutDomain
The production shop checkout domain url.
string - country
Country code for the shop.
CountryCode - locale
Language code for the shop.
LanguageCode - onReady
Callback to be call when customer privacy api is ready.
() => void - onVisitorConsentCollected
Callback to be called when visitor consent is collected.
(consent: VisitorConsentCollected) => void - sameDomainForStorefrontApi
Whether consent libraries can use same-domain requests to the Storefront API. Defaults to true if the standard route proxy is enabled in Hydrogen server.
boolean - storefrontAccessToken
The storefront access token for the shop.
string - withPrivacyBanner
Whether to load the Shopify privacy banner as configured in Shopify admin. Defaults to true.
boolean
VisitorConsentCollected
- analyticsAllowed
boolean - firstPartyMarketingAllowed
boolean - marketingAllowed
boolean - preferencesAllowed
boolean - saleOfDataAllowed
boolean - thirdPartyMarketingAllowed
boolean