Skip to content

PostHog events for what visitors wait for on the analysis page - #335

Merged
ashtonanderson merged 2 commits into
mainfrom
claude/engine-analytics
Nov 5, 2026
Merged

ashtonanderson merged 2 commits into
mainfrom
claude/engine-analytics

Conversation

@ashtonanderson

Copy link
Copy Markdown
Member

Adds PostHog events that show what real visitors wait for on the analysis page, and when it dies, so that #334 and later changes can be judged on real devices rather than emulated ones.

Events

  • analysis_engine_load: one per visit, for the first position: Maia, the chart, Stockfish's first depth, d12, d18, lines settled, search done.
  • analysis_engine_steps: a summary of the moves stepped through, sent when the page is hidden or left, and every 30 moves: medians, and how many reached each stage.
  • analysis_page_ended_unexpectedly: the last analysis page in this tab was never left, as when a phone runs out of memory, with whether it was on screen.
  • stockfish_engine_ready and _failed: now also give engine and memory_retries.
  • maia_engine_ready and _failed: new here, with restarts. The tracking functions existed but were never called.

All the timing events are split by engine, engine_build, is_phone, cores, release and PostHog's own $os and $browser.

LOADING.md, round 11, explains how to read them and has SQL for PostHog's editor: crash rate, what visitors wait for, and Stockfish before and after #334.

Things to know

  • Before and after Stockfish 19's small net, and the best line first #334: only stockfish_engine_ready, stockfish_engine_failed, $web_vitals and $exception existed before it went live. The new events have no "before", so they compare later changes against it.
  • Crashes are undercounted: a crash is reported only when the visitor comes back to an analysis page in that tab.
  • release: it relies on Vercel exposing NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA. That isn't confirmed; locally it's empty.
  • Not checked yet: events reaching the real PostHog project. I have no PostHog access, so please look at Activity on this preview.

Testing

  • Unit tests: npm test (85), npx tsc --noEmit and npm run lint pass.
  • In a browser, with PostHog's requests captured: the events and values arrive. A normal reload reports no crash, and a page that loses its exit handlers is reported on the next load with was_visible true. This run found and fixed a bug where every normal reload would have counted as a crash.
  • Speed, 6 paired loads per device against the same code without the events: no slowdown within the noise. Test browsers' events are dropped by PostHog, so sending itself isn't counted.
  • Not run on a real iPhone.

🤖 Generated with Claude Code

ashtonanderson and others added 2 commits November 5, 2026 03:56
…n it dies

Three PostHog events, so that round 10 and later changes can be judged on real
visitors, by engine, build, device and release:

- analysis_engine_load: the first position of a visit (Maia, the chart,
  Stockfish's first depth, d12, d18, lines settled, search done).
- analysis_engine_steps: a summary of the positions moved to after it, sent when
  the page is hidden or left: medians, and how many reached each stage. d18 now
  means the best line, so "lines settled" is what compares across round 10.
- analysis_page_ended_unexpectedly: the last analysis page in this tab was never
  left, as when a phone runs out of memory, and whether it was on screen.

stockfish_engine_ready and _failed also give the engine and its memory retries,
and Maia's start is reported as maia_engine_ready and _failed, with its restarts.

Nothing reads the page: a few timestamps per engine update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
maia-platform-frontend Ready Ready Preview Nov 5, 2026 4:10am UTC

Request Review

@ashtonanderson
ashtonanderson marked this pull request as ready for review November 5, 2026 04:11
@ashtonanderson
ashtonanderson merged commit c7f1611 into main Nov 5, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 3366784c Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant