Skip to content

Track demo agent interactions in PostHog - #907

Draft
zahlekhan wants to merge 5 commits into
thesysdev:mainfrom
zahlekhan:codex/frontend-posthog-demo-analytics
Draft

Track demo agent interactions in PostHog#907
zahlekhan wants to merge 5 commits into
thesysdev:mainfrom
zahlekhan:codex/frontend-posthog-demo-analytics

Conversation

@zahlekhan

@zahlekhan zahlekhan commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • instrument docs-owned chat transports without changing published packages
  • capture bounded demo_agent_interaction events across all four hosted demos, including one event per visible /compare variant
  • classify composer, starter, and rendered-action turns locally while reporting only canonical model IDs and allowlisted dimensions
  • document counting and privacy rules, plus anonymous-to-authenticated identity attribution

Why

The hosted demos had no shared boundary for observing an accepted user turn. The docs-owned chat transports are invoked once after a user turn is accepted, while /compare captures shared prompts before fanout so its hidden third controller is not counted. The final diff is entirely docs-scoped and does not modify packages/**.

Privacy and identity

Custom event properties exclude prompts, responses, generated UI, action payloads, GitHub usernames, action or tool URLs, thread IDs, user IDs, tool arguments, and raw errors. PostHog may still attach its standard page context.

Demo events use PostHog's existing anonymous distinct ID. The receiver-side bootstrap that preserves that anonymous identity through sign-in is already merged in thesysdev/composition#1609, allowing the console's canonical posthog.identify(user.id) call to merge earlier demo activity into the authenticated profile.

Validation

  • pnpm --filter @openuidev/docs types:check
  • targeted docs ESLint and Prettier checks
  • pnpm install --lockfile-only --frozen-lockfile --offline
  • git diff --check

Known repository baseline

  • docs lint still reports two existing react-hooks/set-state-in-effect errors in unchanged portions of docs/app/demo/github/page.tsx
  • the local docs production build remained in Turbopack's optimized-build phase without progress and was stopped; focused tests and docs typecheck pass

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