-
Notifications
You must be signed in to change notification settings - Fork 549
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
base: 06-17-posthog_migration_part_1
Are you sure you want to change the base?
posthog migration: part 2 #7364
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 (
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
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 @@
## 06-17-posthog_migration_part_1 #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
1c17c2e
to
e85d198
Compare
365c8ba
to
2d67599
Compare
2d67599
to
38cb3c9
Compare
e85d198
to
738e9bb
Compare
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.
Bug: Logout Error Blocks Account Deletion Cleanup
The onAccountDeleted
callback in AccountSettingsPage.tsx
calls doLogout()
without error handling. Since this callback executes after the account is deleted on the server, a failed doLogout()
call will prevent subsequent essential local cleanup (e.g., resetAnalytics()
, disconnect()
, router.replace()
). This leaves the user in an inconsistent state, where the account is deleted remotely but they remain logged in locally, contrary to the expected behavior for account deletion. This also introduces an inconsistency in error handling compared to other logout flows.
apps/dashboard/src/app/(app)/account/settings/AccountSettingsPage.tsx#L47-L55
}} | |
onAccountDeleted={async () => { | |
await doLogout(); | |
resetAnalytics(); | |
if (activeWallet) { | |
disconnect(activeWallet); | |
} | |
router.replace("/login"); | |
}} |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Merge activity
|
# 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 email - `useIdentifyTeam`: Identifies teams by their team ID using PostHog's group functionality - Implemented these hooks in the `TeamHeaderLoggedIn` component to track both the current user and team Both hooks include safety checks to ensure PostHog is properly loaded before attempting to identify users or teams. <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on integrating `posthog-js` analytics functionalities into various components of the application, specifically for resetting analytics on logout and identifying users and teams. ### Detailed summary - Added `resetAnalytics` function in `reset.ts` to reset analytics. - Implemented `useIdentifyTeam` hook in `identify-team.ts` for team identification. - Implemented `useIdentifyAccount` hook in `identify-account.ts` for account identification. - Integrated `resetAnalytics` in logout processes across multiple components: - `CustomConnectWallet` - `AccountHeader` - `AccountSettingsPage` - `LoginPage` - `TeamHeaderLoggedIn` - Updated ESLint rules to allow direct imports of `posthog-js` within analytics helpers. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced automatic analytics identification for user accounts and teams within the dashboard. - Added a function to reset analytics data, now triggered on logout, wallet disconnection, and account deletion. - **Chores** - Updated internal configuration to ensure analytics tracking is consistently managed and restricted to designated areas. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
38cb3c9
to
6b24fed
Compare
738e9bb
to
5f2bca8
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