Does the Hydrogen SDK respect Shopify's Customer Privacy API before tracking?
I am auditing a Hydrogen store before we enable Croct tracking and I need a formal confirmation of the consent behavior. We operate in Germany, so the bar is: no tracking event may leave the browser before the visitor has granted consent.
Specifically, does the Hydrogen SDK check Shopify's Customer Privacy API before sending anything, or does it start tracking on page load and expect me to gate it myself? And is that behavior on by default or something I must configure? I would rather hear the exact mechanics than "it is compliant".
1 answer
Here are the exact mechanics.
The Hydrogen SDK ships with an auto mode for tracking, and auto mode is the default. With the default auto mode, the SDK never tracks events until Shopify's Customer Privacy API reports that tracking is allowed. No event leaves the browser before that point, and there is no extra wiring needed for the consent gate: the SDK subscribes to the Customer Privacy API state on its own.
In other words, the SDK defers to the same consent source your Shopify consent banner writes to, so the visitor's choice is enforced consistently across your store's tracking.
If you need broader control beyond consent, tracking in general is governed by the track option on the plug configuration, which lets you disable automatic event tracking entirely regardless of consent state.
For the audit trail, the behavior is documented in the Hydrogen SDK integration guide.