DOCS / FEATURES
Product analytics
The API records six product events (sign-ups, new orgs, members joining, checkouts, subscription changes and API keys) in the app's own database. Superadmins see them as weekly numbers, and you can forward them to PostHog.
There are no page views, no browser script and no cookies. The API records each event at a point where it already writes an audit event or a notification. Events hold ids and plan names only, never an email, a name or an address. Since nothing is set in the browser, it needs no consent banner.
api/src/analytics/
├── mod.rs # Event (the catalog), Analytics::track, the Destination seam,
│ # forward (the analytics.forward job)
├── posthog.rs # PostHog: the only file that knows the vendor
├── repo.rs # analytics_events: insert, read, purge, the weekly counts
└── routes.rs # GET /api/admin/analytics
web/src/features/admin/AnalyticsPage.tsx # the dashboard
web/src/routes/_app/admin/analytics.tsx # its route, /admin/analytics[ full guide ]
The rest of this guide comes with the repo.
- The events
- The built-in sink
- The dashboard
- Forwarding to PostHog
- Consent
- Tests