-
Notifications
You must be signed in to change notification settings - Fork 5
Replace Amplitude with PostHog for product metrics (#227) #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Migrates backend analytics from Amplitude HTTP API to PostHog Node SDK. Adds new feature interaction events for tickets, honeypot, reactji, spam detection, and bot install/uninstall tracking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Summary
|
Preview environment removedThe preview for this PR has been cleaned up. |
✅ E2E Tests PassedTested against: https://237.euno-staging.reactiflux.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the backend analytics infrastructure from Amplitude HTTP API to PostHog Node SDK, modernizing the product metrics stack to align with the frontend implementation. The migration replaces synchronous HTTP API calls with the official PostHog SDK, adds proper client lifecycle management, and introduces comprehensive feature tracking for tickets, honeypot, reactji, spam detection, and bot installation events.
Key Changes:
- Replaces Amplitude HTTP API with PostHog Node SDK for backend analytics
- Adds 10 new feature interaction events for comprehensive product usage tracking
- Implements graceful shutdown handling to ensure metrics are flushed before process termination
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds posthog-node dependency, removes unused query-string package |
| package-lock.json | Updates dependency tree with PostHog packages and removes Amplitude-related dependencies |
| app/helpers/metrics.ts | Core migration - replaces Amplitude API with PostHog client, adds singleton pattern, implements shutdown handler, and defines 10 new feature tracking events |
| app/helpers/env.server.ts | Updates environment variables from AMPLITUDE_API_KEY to POSTHOG_KEY and POSTHOG_HOST |
| app/discord/reactjiChanneler.ts | Adds reactjiTriggered event tracking when messages are forwarded |
| app/discord/onboardGuild.ts | Adds guildRemoved event tracking for bot uninstalls |
| app/discord/honeypotTracker.ts | Adds honeypotTriggered event tracking when honeypot channels detect spam |
| app/discord/gateway.ts | Implements graceful shutdown handlers for SIGTERM/SIGINT to flush metrics |
| app/discord/automod.ts | Adds spamDetected and spamKicked event tracking for automod actions |
| app/commands/track.tsx | Adds userTracked event when moderators track users |
| app/commands/setupTickets.ts | Adds ticketChannelSetup, ticketCreated, and ticketClosed event tracking |
| app/commands/setupReactjiChannel.ts | Adds reactjiChannelSetup event tracking |
| app/commands/setupHoneypot.ts | Adds honeypotSetup event tracking |
| .github/workflows/cd.yml | Adds POSTHOG_KEY and POSTHOG_HOST environment variables to production and staging deployments |
| .env.example | Documents new PostHog backend environment variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix GuildDelete to skip unavailable guilds and verify DB record - Add userId to honeypotTriggered and spamDetected for proper attribution - Remove unused guildResurrected event 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrates backend analytics from Amplitude HTTP API to PostHog Node SDK. Adds new feature interaction events for tickets, honeypot, reactji, spam detection, and bot install/uninstall tracking.
🤖 Generated with Claude Code