martech cookbookSearch recipes & patternsSign up
Recipe·Updated 23 September 2026

Cross-session state surfacing

Show returning visitors what they had going, last-viewed products, cart contents, loyalty progress, without making them sign in or start over

01Problem

A returning visitor has a history the site usually ignores. They viewed three products last week, left two items in a cart, and are halfway to a loyalty tier, and on return they see a homepage that knows none of it. The information exists, scattered across a cookie, a cart table, and a loyalty balance, but it is not assembled and surfaced, so the visitor restarts cold and the site forfeits the easiest personalization there is: showing people what they already had going.

These used to be treated as three separate features (last-viewed recall, cart persistence, loyalty status display), each built once and maintained separately, which is why they tend to be inconsistent: the cart persists but the last-viewed does not, or the loyalty status shows when logged in but vanishes for the recognized-but-anonymous visitor. They are one capability: carry the visitor's relevant state across sessions and surface it, gated on consent, with clean merge behavior and a sensible default when there is nothing to carry.

This recipe treats cross-session state as one surface rather than three disconnected features.

02Outcome

Returning visitors see their carried-over state (recently viewed, pending cart, loyalty progress) without re-authenticating or re-finding it. The metric is returning-visitor engagement: whether recognized returners re-engage with what they had going, which lifts most in considered-purchase categories where people genuinely return to deliberate and where a pending cart or a viewed product is a live consideration rather than a stale impulse. The size depends on how much of the audience returns within the recognition window, which Safari's cookie limits cap for a meaningful share, so the realistic gain is concentrated in the recognizable, returning portion rather than across all traffic.

The second outcome is consistency: the cart, the last-viewed, and the loyalty status all behave the same way for the same visitor, instead of one persisting and another forgetting.

03Ingredients
  • Persistent visitor identifier
  • Visitor session history
  • Cart contentsOptional
  • Consent state flag
04Equipment

A state store the site can read at request time (CDP, session store, or warehouse-backed profile) plus a personalization layer that surfaces the carried state in the page. Composable stacks suit this because the state lives in one place all surfaces read, which is what makes the cart, last-viewed, and loyalty consistent rather than each maintained in its own silo. The capability that decides whether the experience feels good is request-time rehydration latency: the carried state has to render in the first paint, because state that appears after a flash of the cold page reads as a glitch rather than as the site remembering.

05Staff
  • Product
    CriticalWhere carried-over state appears, the merge behavior, the no-state experience
  • Data engineering
    CriticalPersistent state store, request-time rehydration, the consent gate, cart-merge logic
  • Marketing ops
    SupportingWhich state is worth surfacing and where

Product owns where carried-over state appears, the cart-merge behavior, and the no-state experience, treating the last as a real design rather than an afterthought. Data engineering owns the persistent state store, the request-time rehydration, the consent gate, and the cart-merge logic that reconciles anonymous and authenticated carts. Marketing ops decides which state is worth surfacing where, since surfacing everything is as bad as surfacing nothing. The recipe ships in weeks because the components are standard first-party data; the work is in the cart-merge edge cases and getting the consent gate right, not in anything novel.

06Technique
INPUTSPROCESSACTIVATIONEARLYPersistentvisitor IDVisitorsession historyCart contentsLoyalty balanceConsent state flagConsent-scopedcollectionMerge & rankCarriedsession stateSessionrehydrationFallback contentVisitorpersonalizationOn-sitepersonalization

Work in this order. Cart, history and loyalty are one capability over one store; a site that half-remembers the visitor is worse than one that consistently does not.

  1. Design one state store schema across cart, history and loyalty.
  2. Rehydrate at request time, within the first paint.
  3. Write deterministic cart-merge rules for an anonymous cart meeting a saved one at login, or items duplicate, vanish or overwrite each other.
  4. Rank session history so the page surfaces the relevant part rather than everything.
  5. Gate recognition on consent. Carrying state across sessions is recognition, and a withdrawal has to reach the carried state, not only the raw store.
  6. Set the freshness window and identifier expiry, and size the recognition window to Safari's limits. An aged-out identifier degrades to the no-state experience rather than surfacing stale carryover.
  7. Design the no-state fallback as an experience in its own right.

Session history rehydration covers steps 1 to 4, consent-scoped signal collection step 5, visitor state personalization step 6, and fallback content strategy step 7.

07Gotcha
Failure 01

The first failure is the cart-merge collision. A visitor with items in an anonymous cart who then logs in, where they also have a saved cart, needs deterministic merge rules, or items duplicate, disappear, or silently overwrite. This is the classic edge case that makes cart persistence feel broken, and it has to be designed rather than left to whichever cart loads last.

Failure 02

The second is inconsistency across the surfaced states. If the cart persists but the last-viewed does not, or loyalty status shows only when authenticated, the visitor experiences a site that half-remembers them, which is worse than one that consistently does not. Treating the three as one capability over one state store is what keeps them consistent.

Failure 03

The third is surfacing without consent or beyond freshness. Carrying state across sessions is recognition, subject to the consent captured at first visit, and a persistent identifier that has aged out (Safari's window) should degrade to the no-state experience rather than surfacing stale carryover. The consent gate and the freshness check are what keep the recognition defensible and current.

WorkshopFor your stack·The questions this recipe raises

Eight questions this recipe raises for your stack.

The Workshop works out with your team which of these matter for your stack right now, and what to do first: a 90-minute session with the people who own the decision.

  1. 01State store schema across cart, history, and loyaltyThe one store all three surfaces read from, so they stop behaving differently.
  2. 02Request-time rehydration within the first paintRendering carried state before the cold page flashes, where the latency budget sits.
  3. 03Cart-merge rules for anonymous and authenticated cartsDeterministic reconciliation so items do not duplicate, vanish, or overwrite.
  4. 04Session-history ranking for what to surfaceChoosing the relevant carryover rather than dumping everything the visitor did.
  5. 05Consent gate on recognitionCarrying state only where consent allows, with withdrawal reaching the carried copy.
  6. 06Freshness window and identifier expiryDegrading to the cold experience when the persistent identifier has aged out.
  7. 07No-state fallback as a designed experienceThe clean default for the visitor with nothing to carry, built rather than left blank.
  8. 08Recognition-window sizing against Safari limitsWhere this caps out, and the returning slice you can realistically reach.

If your returning visitors get a cold homepage while their cart, history, and loyalty progress sit unused, the Workshop is where we build the carried-state surface.

The one state store the cart, last-viewed, and loyalty all read from, the cart-merge rules that keep it from breaking, the consent gate that keeps recognition defensible, and the no-state experience as its own design: those are the decisions that turn three inconsistent features into one site that remembers.

take this to the martech workshop→

Did this recipe match your situation?Anonymous response. Sign up to leave a longer note tied to your account.

Related recipes