Issue:
Shopify Collabs records orders but not sessions on our Hydrogen storefront. Orders show in Collabs, but session/journey data is missing.
Current Setup:
-
Hydrogen storefront using React Router v7
-
Using @shopify/hydrogen Analytics.Provider component
-
Customer Events API via Hydrogen’s built-in analytics
-
createHydrogenContext with automatic storefrontHeaders extraction
-
Consent management configured with Customer Privacy API
-
CSP configured
Implementation Details:
// app/root.tsx
<Analytics.Provider
cart={data.cart}
shop={data.shop}
consent={data.consent}
cookieDomain='grecogum.com'
>
{/* Components */}
</Analytics.Provider>
We’re using analytics components like:
-
<Analytics.ProductView />
-
<Analytics.CartView />
-
<Analytics.CollectionView />
-
<Analytics.SearchView />
What We’ve Verified:
-
Network requests: Seeing requests to monorail-edge.shopifysvc.com (status 200 OK)
-
Discount route: /discount/$code route preserves query parameters (including dt_id)
-
Storefront headers: Automatically handled via createHydrogenContext with request object
-
Cookies: _shopify_y and _shopify_s cookies are set correctly
-
Orders: Collabs successfully tracks conversions/orders
Questions:
-
Does Analytics.Provider automatically publish page_viewed events on route changes, or do we need to explicitly publish them?
-
Should we use analytics.publish(‘page_viewed’, …) manually in a route change handler?
-
Are there specific requirements for page view events to work with Shopify Collabs?
-
Should page view events include the full URL with query parameters (like dt_id)?
-
Is there a difference between how Hydrogen handles page views vs. product/cart views?
Thanks in advance!