-
Notifications
You must be signed in to change notification settings - Fork 111
Add PostHog #906
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
base: main
Are you sure you want to change the base?
Add PostHog #906
Conversation
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 integrates PostHog analytics into the application to track user behavior and application usage. The integration includes both client-side JavaScript tracking and server-side Ruby event capture.
Changes:
- Added PostHog Ruby gem and client-side JavaScript integration for analytics tracking
- Implemented PosthogService with methods for capturing events and identifying users
- Added analytics tracking for key user actions: signups, sign-ins, settings updates, API key rotation, onboarding flow, and heartbeat submissions
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| Gemfile | Added posthog-ruby gem dependency |
| Gemfile.lock | Locked posthog-ruby version 3.4.0 with concurrent-ruby dependency |
| .env.example | Added PostHog configuration environment variables (API key and host) |
| config/initializers/posthog.rb | Initializes PostHog client with configuration and error handling |
| app/services/posthog_service.rb | Service class providing capture, identify, and capture_once_per_day methods for analytics tracking |
| app/views/layouts/application.html.erb | Embedded PostHog JavaScript snippet for client-side tracking with user identification |
| app/models/user.rb | Added analytics tracking for new user signups |
| app/controllers/users_controller.rb | Added tracking for settings updates, API key rotation, and onboarding steps |
| app/controllers/sessions_controller.rb | Added tracking for sign-ins (HCA, Slack, email), GitHub linking, and sign-outs |
| app/controllers/api/hackatime/v1/hackatime_controller.rb | Added daily tracking for heartbeat submissions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(For analytics!)