feat: add PostHog telemetry with privacy-focused tracking

Integrate optional PostHog telemetry to track page views, RDAP queries,
user interactions, and errors while maintaining user privacy.

Key features:
- Type-safe event tracking with discriminated unions
- Automatic source map upload for production error tracking
- Privacy protections (query targets excluded from successful lookups)
- Do Not Track (DNT) header support
- Optional telemetry (disabled by default without environment variables)
- Error boundary with automatic error tracking
- Context-based telemetry integration throughout UI components

Environment variables required for telemetry:
- NEXT_PUBLIC_POSTHOG_KEY: PostHog project API key (client-side)
- NEXT_PUBLIC_POSTHOG_HOST: PostHog API endpoint (client-side)
- POSTHOG_PERSONAL_API_KEY: Source map upload key (server-side)
This commit is contained in:
2025-10-23 18:00:24 -05:00
parent 5fcf9dd94b
commit 5fde7d249f
15 changed files with 858 additions and 17 deletions

View File

@@ -169,6 +169,14 @@ To self-host:
pnpm build
```
## Privacy & Telemetry
The hosted demo at [rdap.xevion.dev][live-demo] collects optional telemetry to improve the service. Self-hosted deployments have no telemetry by default.
**What's tracked:** Page views, query metadata (type, success/failure, timing), user interactions, and errors.
**Privacy protections:** Successful query targets are never logged—only the query type and timing. Failed queries may include targets for debugging. Copy actions track text length only.
## Contributing
Issues and pull requests are welcome! This project uses: