-
Notifications
You must be signed in to change notification settings - Fork 565
posthog migration: part 2 #7364
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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Skipped Deployments
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes introduce new analytics integration and control in the dashboard application. Custom React hooks for identifying user accounts and teams with PostHog are added. A helper for resetting analytics state is implemented and invoked during logout and account deletion flows. ESLint rules are updated to restrict direct PostHog usage to analytics helpers. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI_Component
participant AnalyticsHelpers
participant PostHog
User->>UI_Component: Triggers logout/disconnect/account deletion
UI_Component->>doLogout: Call logout logic
doLogout-->>UI_Component: Logout complete
UI_Component->>AnalyticsHelpers: Call resetAnalytics()
AnalyticsHelpers->>PostHog: posthog.reset()
AnalyticsHelpers-->>UI_Component: Analytics reset complete
UI_Component->>Wallet: Disconnect wallet (if applicable)
UI_Component->>Router: Refresh or redirect
sequenceDiagram
participant UI_Component
participant AnalyticsHooks
participant PostHog
UI_Component->>AnalyticsHooks: useIdentifyAccount({accountId, email})
AnalyticsHooks->>PostHog: posthog.identify(accountId, {email})
UI_Component->>AnalyticsHooks: useIdentifyTeam({teamId})
AnalyticsHooks->>PostHog: posthog.group("team", teamId)
Possibly related PRs
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
3eebe81
to
3d8eba4
Compare
8ac2523
to
ab980d8
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7364 +/- ##
=======================================
Coverage 52.35% 52.35%
=======================================
Files 939 939
Lines 63161 63161
Branches 4217 4217
=======================================
Hits 33070 33070
Misses 29984 29984
Partials 107 107
🚀 New features to boost your workflow:
|
size-limit report 📦
|
3d8eba4
to
a681035
Compare
Add PostHog Analytics Identification for Accounts and Teams
This PR adds analytics tracking capabilities to identify users and teams in PostHog:
Created two new hooks:
useIdentifyAccount
: Identifies users by their account ID and optional emailuseIdentifyTeam
: Identifies teams by their team ID using PostHog's group functionalityImplemented these hooks in the
TeamHeaderLoggedIn
component to track both the current user and teamBoth hooks include safety checks to ensure PostHog is properly loaded before attempting to identify users or teams.
PR-Codex overview
This PR primarily focuses on enhancing analytics by integrating
posthog-js
functionality into various components, allowing for better user tracking and analytics reset capabilities during logout processes.Detailed summary
resetAnalytics
function inreset.ts
to reset PostHog analytics.useIdentifyTeam
hook inidentify-team.ts
for team identification.useIdentifyAccount
hook inidentify-account.ts
for account identification.resetAnalytics
in multiple components during logout:CustomConnectWallet
AccountHeader
AccountSettingsPage
LoginPage
TeamHeaderLoggedIn
posthog-js
within analytics helpers.Summary by CodeRabbit
New Features
Chores