Files
Tyler Slaton 79181d4d38 feat(shell-docs): re-add markdown_copied + open_in_llm_clicked PostHog events
The original analytics commit (4d67fe269) was reverted because it
also contained a botched BrandNav height change. Re-apply just the
PostHog instrumentation cleanly:

- `MarkdownCopyButton` fires `markdown_copied`
  `{ path: pathname, markdown_url: markdownUrl }` after a successful
  clipboard write. Coexists with the global `cli_command_copied`
  (Benjamin's monkey-patch in `lib/track-command-copy.ts` that
  intercepts every clipboard write at the navigator level); the
  dedicated event lets the dashboard distinguish page-content copies
  from CLI copies (which classify under the existing tracker as
  `code` — not meaningful for the new docs-as-context surface).
- Each `ViewOptionsPopover` item gains a `target` discriminator
  (`github`, `view-as-markdown`, `windsurf`, `claude-code`, `codex`,
  `chatgpt`, `claude`, `cursor`) and an `onClick` that captures
  `open_in_llm_clicked` `{ target, path }`. PostHog buffers locally
  so the new tab opens without waiting on the network.

Closes Sam's P0 analytics ask from PR #4946 — verified by the QA
audit that every existing CTA + capture (`try_for_free_clicked`,
`talk_to_us_clicked`, etc.) survives intact across the branch.
2026-05-20 21:17:34 -07:00
..