Section H
Analytics & consent
ShopifyScripts creates the analytics bus at window.Shopify.analytics. Routes publish view events and useCartAnalytics() publishes cart deltas. A custom consent banner syncs choices to Customer Privacy. Destinations receive nothing until consent allows it, and buffered events then replay.
Page, product, cart & checkout events
Live log from a destination registered with addDestination(). Navigate the store in another tab or use the buttons, then watch events arrive.
- Hydrogen API
ShopifyScriptsAnalyticsEventuseCartAnalyticsStorefrontAnalytics.addDestination- Data
- Real bus (Shopify delivery disabled in demo)
- Docs
.claude/skills/hydrogen-analytics/SKILL.md
Declining stops delivery: the bus clears its buffer and the inspector receives nothing until you accept. Add something to the bag to see cart delta events from useCartAnalytics().
- No events delivered yet.
Customer privacy consent & consent-gated analytics
consent: { mode: 'custom-banner', setup }. Demo mode simulates Shopify's consentManagement endpoint so the Customer Privacy API works without a store.
- Hydrogen API
ConsentConfigwindow.Shopify.customerPrivacy.setTrackingConsent- Data
- Simulated consent backend in demo
- Docs
.claude/skills/hydrogen-analytics/references/custom-consent.md