Personalize a PDP hero from what the shopper viewed earlier in the session?
On my Hydrogen store I want the product-page hero to reflect what a visitor browsed earlier in the same session. For example, if they kept looking at pages in one category, I would like the hero to lean into that category.
I am not sure which signals the storefront events actually give me to build that audience. What is the right way to express "has been looking at X" in a condition?
2 answers
The auto events from Shopify storefront analytics cover exactly this: product views, cart views, cart updates, and collection and search views. Those feed the behavioral signals your audiences read, and audiences evaluate in real time, so the PDP reacts within the same session.
For "kept viewing this category" the cleanest form is the page-view condition:
user has viewed a page with path "/collections/running"Build the audience around that, point the PDP hero slot at it, and because content resolves in the loader server-side there is nothing swapping on the client, the right hero is just there when the page arrives.
That matched on the first try against a session where I had browsed the category. Exactly what I wanted, thank you.
If you want something less tied to one exact path, there is an interest-based variant that reads the same browsing history at a higher level:
user has shown interest in ["running", "trail"]That way a shopper who bounced across a few related collections still lands in the audience without you enumerating every path. I usually keep a specific path rule for the hot categories and an interest rule as the broader catch-all.