Skip to content

Conversation

@vcarl
Copy link
Member

@vcarl vcarl commented Jan 2, 2026

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

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>
@what-the-diff
Copy link

what-the-diff bot commented Jan 2, 2026

PR Summary

  • Introduction of PostHog Analytics Configuration
    The example environment file has been updated to incorporate a new PostHog analytics setup for both front and back ends, improving application-wide data tracking.

  • Modification of Workflow Environment Variables
    In the continuous deployment workflow, POSTHOG_KEY and POSTHOG_HOST environment variables are now defined, making the PostHog integration possible.

  • Added Event Tracking within Command Files
    Event tracking has been expanded throughout the app/commands directory - a feature integrated into numerous command files. This results in highly detailed data, such as ticket creation statistics and honeypot setups, being consistently monitored.

  • Expanded User Activity Monitoring
    Monitor user actions like setting up honeypots, configuring ticket channels, and spam detection have been enhanced for increased security and better user experience.

  • Upgraded metrics.ts with New Event Types
    The metrics.ts file now includes new event types specifically for tracking user behavior and interactions with ticketing systems, honeypots, and reactji channels.

  • Transition from Amplitude to PostHog
    The transition from Amplitude to PostHog for metrics tracking adds tangible changes and benefits to the system's event emissions. This move accounts for more comprehensive and secure data management.

  • Addition of posthog-node Package
    Package listings have been updated to include the posthog-node package, streamlining project dependencies and enhancing efficiency.

  • Feedback Message Adjustment in Commands
    A series of feedback messages within setupTickets.ts have been adjusted for more consistent user engagement and better communication.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

Preview environment removed

The preview for this PR has been cleaned up.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

✅ E2E Tests Passed

View Report · View Run

Tested against: https://237.euno-staging.reactiflux.com

@vcarl vcarl requested a review from Copilot January 2, 2026 22:26
@vcarl vcarl linked an issue Jan 2, 2026 that may be closed by this pull request
8 tasks
Copy link
Contributor

Copilot AI left a 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.

vcarl and others added 4 commits January 4, 2026 00:07
- 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>
@vcarl vcarl merged commit 374f8d0 into main Jan 6, 2026
5 of 6 checks passed
@vcarl vcarl deleted the vc-posthog-metrics branch January 6, 2026 20:40
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.

Posthog

2 participants