add posthog analytics for llm usage and auth events

Captures per-LLM-call token usage tagged by feature (copilot chat,
track block, meeting note, knowledge sync), plus sign-in / sign-out
and identity. Renderer and main share one PostHog identity so events
from either process resolve to the same user.

See apps/x/ANALYTICS.md for the event catalog, person properties,
use-case taxonomy, and how to add new events.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ramnique Singh 2026-04-28 19:53:40 +05:30
parent d42fb26bcc
commit 43c1ba719f
31 changed files with 625 additions and 36 deletions

13
apps/x/pnpm-lock.yaml generated
View file

@ -404,6 +404,9 @@ importers:
pdf-parse:
specifier: ^2.4.5
version: 2.4.5
posthog-node:
specifier: ^4.18.0
version: 4.18.0
react:
specifier: ^19.2.3
version: 19.2.3
@ -6471,6 +6474,10 @@ packages:
posthog-js@1.332.0:
resolution: {integrity: sha512-w3+sL+IFK4mpfFmgTW7On8cR+z34pre+SOewx+eHZQSYF9RYqXsLIhrxagWbQKkowPd4tCwUHrkS1+VHsjnPqA==}
posthog-node@4.18.0:
resolution: {integrity: sha512-XROs1h+DNatgKh/AlIlCtDxWzwrKdYDb2mOs58n4yN8BkGN9ewqeQwG5ApS4/IzwCb7HPttUkOVulkYatd2PIw==}
engines: {node: '>=15.0.0'}
postject@1.0.0-alpha.6:
resolution: {integrity: sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==}
engines: {node: '>=14.0.0'}
@ -15203,6 +15210,12 @@ snapshots:
query-selector-shadow-dom: 1.0.1
web-vitals: 4.2.4
posthog-node@4.18.0:
dependencies:
axios: 1.13.2
transitivePeerDependencies:
- debug
postject@1.0.0-alpha.6:
dependencies:
commander: 9.5.0