See all services Shopify Plus Partner
API Developer

Upgrade Hydrogen for Cart Sessions and Page View Events

The 18 August 2026 Hydrogen preview adds cart session attribution, standard page view events, and local HTTPS for Customer Account work. Several of these close gaps headless teams have been patching by hand.

Executive summary

What changed

Cart handlers now accept a customer session. A new cart is created with the signed-in customer's buyer identity, and authenticated cart reads mark the checkout URL so the shopper is not dropped into a guest flow. Login and token refresh attach the customer to the browser cart, logout detaches them, and none of that sync blocks the route's redirect.

Cart attributes gain an order-wide form for data such as a gift message, while line attributes now return in cart queries and count toward line identity, so a variant added twice with different engraving text produces two lines. Separately, ShopifyScripts emits a page view event on first load and on every client-side navigation, tagged with the page template resolved from your routes.

Three changes deserve a closer read before you upgrade. Shopify script traffic now routes through your own domain. Checkout, cart permalinks, and Customer Account handoffs became full document navigations, since a client-side router would otherwise intercept those server redirects. The Shop Pay button renders locally as a custom element with styles sealed in a shadow root, so it no longer waits on a hosted script.

Why it matters

The analytics change carries the clearest commercial value. A Hydrogen storefront previously looked like a single page load to measurement tooling, so funnel reporting, attribution, and performance monitoring all worked from a partial picture. Reporting every navigation puts headless storefronts on the same measurement footing as a themed store without a bespoke tracking layer.

Cart session attribution removes a familiar support ticket: a customer signs in, adds to cart, and still reaches checkout as a guest with none of their saved addresses or payment methods. Routing script traffic through your own domain also helps teams whose third-party services kept verifying the myshopify address instead of the customer-facing one.

Role-specific impact

Use-case example

Real-world scenario

A Plus merchant runs a Hydrogen storefront reporting 3.1 percent checkout conversion against 4.4 percent on their themed sibling site. Part of that gap is measurement. With only first page loads recorded, sessions that landed on a collection page and navigated client-side to a product never registered the intermediate steps. After adopting the page view events and wiring cart session attribution, the team finds roughly one in nine signed-in sessions had been falling into guest checkout. Closing that path is worth more than the reporting fix, but the reporting fix is what made it visible.

Implementation checklist

  1. Pin the preview version deliberately, since releases publish through prerelease mode and a version number names the release it becomes.
  2. Audit your codebase for the removed exports and the deprecated navigation call first.
  3. Pass the customer session into your cart server handlers, hand those back to the Customer Account handlers, then test login, refresh, and logout end to end.
  4. Confirm your analytics destination consumes the page view event, then reconcile a week of data against your previous numbers before trusting the delta.
  5. Re-test the Shop Pay button, especially if your Content Security Policy omits unsafe-inline in style-src, which pins it to its default width.
  6. Register the local HTTPS origin in your Customer Account API settings so the team can test logins without a tunnel.
  7. Verify checkout, cart permalinks, and Customer Account handoffs still behave as full document navigations.

FAQ

Q: Is this safe to run in production?

A: No. This is a developer preview and the surface is still moving between releases. Treat it as a reliable signal about where Hydrogen is heading, validate in staging, and keep revenue-carrying traffic on a stable version.

Q: Do we need to rebuild our analytics setup to benefit?

A: Usually not. The page view event follows the shape a themed store emits, so tooling that already understands Shopify standard events should pick it up. The real work tends to be reconciling historic reporting, not instrumentation.

Resources

Hydrogen developer preview documentation

Need guidance? Talk to Makro.