Every visit's path — and an AI connector that can read it

PathGuide: Shopper Journey Analytics

Store analytics a merchant can simply ask questions of.

The problem

Shopify stopped setting the cookies that identified a visit, and about 99% of visits disappeared overnight.

Most store analytics answer "how many". Merchants want to know "which path": where shoppers land, what they look at next, where they give up, and which traffic — including the growing share sent by ChatGPT, Perplexity and Gemini — actually buys. Answering that means following one visitor from the storefront through checkout, across two very different sandboxes, only after they consent, and without letting bots, crawlers or one store's data bleed into another's. The platform does not hold still while you do it: in September 2026 Shopify stopped setting the identity cookies every tracker relied on, and anything keyed on them silently lost nearly every visit.

reports
29reports
AI tools (MCP)
15AI tools (MCP)
Shopify extensions
3Shopify extensions
route modules
61route modules
Sidekick tools
11Sidekick tools

How it works

PathGuide is a Remix app embedded in Shopify admin, with capture split across a theme app embed on the storefront and a web pixel in checkout, and Supabase Postgres holding visits, events and rollups. The two capture paths share one identity resolver, so a visitor who browses and then buys is one journey. Ingest is ordered and idempotent: the visit row is written before its events, and every resend is a harmless upsert. Reports read pre-aggregated rollups through database functions with their own timeouts. The AI connector is the newest layer and was designed not to be a second product: one report catalog serves every admin page's data through that page's own code, a fresh MCP server is built per request and bound to the shop the OAuth grant names, and a CI check fails when a new admin page is not exposed to it.

Engineering decisions

The non-obvious calls — where the straightforward approach fails, and what it cost to find that out.

01

One identity resolver, because the platform changed underneath

Why it breaks

Around September 25, 2026, Shopify stopped setting its visitor and session cookies. Every part of the pipeline keyed on them kept running without errors — and silently dropped about 99% of visits.

What I did

All identity now goes through one resolver: Shopify's IDs from its Server-Timing header first, then first-party visitor and session cookies, then the checkout pixel's client ID (waiting briefly for it), then a generated UUID. One fallback chain, in one file, used by both the storefront and checkout.

02

Googlebot made two stores share a visit

Why it breaks

Googlebot's renderer pins the clock and seeds the random number generator, so it produced byte-identical visit IDs on every store it crawled. Because inserts ignore conflicts, one store's page views attached themselves to another store's visit.

What I did

The server never accepts a client-supplied visit ID that belongs to another shop — it derives a stable shop-scoped ID instead — and the client now builds IDs from a cryptographic UUID.

03

Order of writes, not speed of writes

Why it breaks

The visit row and its events were written concurrently to save time. Events reference the visit by foreign key, so whenever the events won the race the insert failed — about 43% of tracking requests were returning errors.

What I did

The visit is written first, then its events. Only work that is genuinely independent — a second, session-keyed write, and the queue publishers — still runs in parallel.

04

Never silently fall back to the slow path

Why it breaks

When a rollup function failed, the code quietly switched to scanning raw events. Those scans took minutes, kept running after the gateway had given up on them, and held the database at 95% CPU.

What I did

Aggregates run as database functions with their own statement timeouts. Only a missing function may fall back; a timeout or any other error is raised. The rule written into the read layer is "never throw, never guess": return nothing and let the caller decide, rather than show a different number.

05

Do not wait for the page to close

Why it breaks

Sending a visit once, when the page is hidden, loses every visit where that event never fires — crawlers, killed tabs, some phones — and some clients' beacon requests never arrive at all.

What I did

The whole visit is re-sent every five seconds as well as on page hide, using fetch with keepalive. The server merges by key, so a repeat send changes nothing.

Correctness in production

What keeps it right once nobody is watching it run.

Consent before capture

Nothing is written or sent until the shopper allows analytics. Page views recorded before consent wait in memory and are dropped if consent never comes; withdrawing consent clears the IDs. The checkout pixel runs in Shopify's strict sandbox and declares analytics, not marketing.

Bots are labelled, conservatively

Detection uses named crawlers, headless browsers and HTTP libraries plus a datacenter check that whitelists iCloud Private Relay — never heuristics, after a real phone was once misflagged. Bot visits are stored and labelled so they can be reported, not silently removed.

Ingest that abuse cannot reshape

Writes happen only for installed shops and never create a shop from a request — a rule added after a vulnerability scanner's injection strings turned into "shops". Hourly ceilings drop excess traffic with a 200, because the tracker retries anything else.

An AI connector that can only read one store

OAuth 2.1 with PKCE, hashed codes and tokens, rotating refresh tokens with reuse detection, and a grant bound to the shop Shopify vouched for. Read-only scope, rate limits, an audit row per call, contact details masked in answers, and every grant revoked on uninstall.

Outcome

Merchants see the paths behind their numbers — where visits start, where they stall, and which sources, AI assistants included, bring buyers — and can ask about it in plain language from Claude, ChatGPT or Sidekick and get the same figures the admin shows, with a link to the page that proves them.

Ready to upgrade your store's infrastructure?

Whether you want this exact architecture deployed to your store, or a completely bespoke solution built from scratch.

I want this exact solution.

Skip the R&D. I can deploy the PathGuide: Shopper Journey Analytics architecture directly to your operations in days, not months.

I need something custom.

Have a unique workflow? Let's build a bespoke app tailored perfectly to your complex business needs.