How to calculate bounce rate from Vercel Web Analytics drain data

Problem

I’ve set up a Web Analytics drain to Axiom and I’m trying to replicate the bounce rate metrics I see in the Vercel dashboard, but I’m running into issues.

Data Available in Drain

The drain sends pageview events with these relevant fields:

  • sessionId: Always 0 for real traffic (only populated with test data)
  • deviceId: Persists across visits, so it’s a device identifier, not a session identifier
  • referrer: The traffic source (e.g. https://www.google.com)
  • path: The page viewed
  • timestamp

Current Issues

Since sessionId is always 0, I can’t group pageviews into sessions. And deviceId spans across multiple visits over days, so grouping by deviceId treats a returning visitor’s entire history as one session — which massively undercounts bounces.

For example, the Vercel UI shows 57% bounce rate for a page, but my drain-based calculation shows 93.5% (using deviceId + first page via arg_min).

I know from the docs that Vercel defines bounce rate as (Single-Page Sessions / Total Sessions) × 100 and that visitors are identified by a daily-rotating hash. But this visitor/session logic isn’t exposed in the drain data.

What I’ve Tried

  • Grouping by deviceId: Overcounts session depth since it spans days/visits
  • Grouping by deviceId + time gaps (30min inactivity): Haven’t implemented yet but seems fragile

Questions

  1. Is sessionId being 0 a bug, or is session grouping intentionally not included in the drain?
  2. Is there a recommended way to reconstruct sessions from drain data to match the dashboard metrics?
  3. Any plans to expose the visitor hash or session boundaries in the drain payload?
1 Like