ReviewOS

stacks/ts-analytics

Avg time on site is structurally wrong — bounces count as 0s; departure pings unused for sessions

#167
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Headline avgTime = last-hit minus first-hit per session (stats.ts), so every bounce is 0s (probed: avgTime 00:00 at 100% bounce). The tracker already sends Fathom-style departure pings with real timeOnPage but they only feed the engagement panel. Also engSent never resets and SPA route changes don't reset engStart/engMax — SPA time undercounted and misattributed. Fix: ADD activeTime into the session via incrementMetrics on the engagement branch; compute avgTime from it; reset engagement state on SPA nav.

From the production-readiness audit (docs/research/production-readiness.md, eacf996). Verified with live probes where stated.

Sign in to comment on this issue.