feat(M2-10150): Add comprehensive Mixpanel tracking for MFA events#2193
Open
feat(M2-10150): Add comprehensive Mixpanel tracking for MFA events#2193
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
- Add 7 new MFA-specific Mixpanel events for setup, login, and recovery flows - Modify existing login events to include MFA-related properties - Implement user profile property updates for MFA state tracking - Add updateProfile() method to Mixpanel utility for user property management - Centralize Mixpanel mock in setupTests.ts for test consistency - Update .env.example with REACT_APP_MIXPANEL_TOKEN configuration
sricharan-varanasi
requested changes
Jan 26, 2026
Contributor
sricharan-varanasi
left a comment
There was a problem hiding this comment.
Requirements specify, specific userId property tracking as part of 'MFA Challenge Presented' and 'Login Successful'. Can this be reviewed and added
src/modules/Dashboard/features/AccountSettings/RemoveMFA/useRemoveMFA.ts
Outdated
Show resolved
Hide resolved
Add userId identification to Mixpanel profile updates for MFA operations
- "MFA Enabled", "MFA Enrolled At", and "MFA Last Updated At" were only - sent as user profile updates (mixpanel.people.set) but missing from the - track events themselves. QA expected these properties on the events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Ticket
https://mindlogger.atlassian.net/browse/M2-10150
Summary
This PR implements comprehensive Mixpanel analytics tracking for all MFA (Multi-Factor Authentication) events across the admin panel. The implementation covers the complete MFA user journey from setup to login verification.
Key Changes:
LoginSuccessful,LoginBtnClick) to include MFA propertiesupdateProfile()methodMFA Used,MFA Method Used,Auth Method,Failure Stage)setupTests.ts.env.examplewithREACT_APP_MIXPANEL_TOKENconfigurationMixpanel Events Implemented
MFA Setup Events
MFA Setup StartedMFA Enabled SuccessfullyMFA Enabled,MFA Enrolled At,MFA Last Updated AtMFA DisabledMFA Enabled,MFA Last Updated AtRecovery Codes ViewedLogin Events
[Admin] Login Button clickAuth Method: 'Password'[Admin] MFA Challenge Presented[Admin] Cant Access Auth App Click[Admin] Login SuccessfulMFA Used,MFA Method Used[Admin] Login FailedFailure Stage,MFA Method UsedEvent Properties
MFA Usedtrue/falseLogin SuccessfulMFA Method Used'Authenticator App'/'Backup Codes'/nullLogin Successful,Login FailedAuth Method'Password'Login Button clickFailure Stage'Credentials'/'MFA'Login FailedUser Profile Properties
MFA EnabledMFA Enrolled AtMFA Last Updated AtFiles Changed
Mixpanel Core
src/shared/utils/mixpanel/mixpanel.types.tssrc/shared/utils/mixpanel/mixpanel.tsupdateProfile()method for user property managementMFA Account Settings
src/modules/Dashboard/features/AccountSettings/MFASetup/useMFASetup.tsMFA Setup Started,MFA Enabled Successfully+ profile updatessrc/modules/Dashboard/features/AccountSettings/RemoveMFA/useRemoveMFA.tsMFA Disabled+ profile updatessrc/modules/Dashboard/features/AccountSettings/ViewRecoveryCodes/useViewRecoveryCodes.tsRecovery Codes ViewedLogin Flow
src/modules/Auth/features/Login/LoginForm/LoginForm.tsxMFA Challenge Presented,Login Failed(credentials), modifiedLogin Successful&Login Button clicksrc/modules/Auth/features/Login/MFAForm/MFAForm.tsxCant Access Auth App Clicksrc/modules/Auth/features/Login/MFAForm/useMFAVerification.tsLogin Successful(with MFA),Login Failed(MFA stage)Test Infrastructure
src/setupTests.tsupdateProfilemethod.env.exampleREACT_APP_MIXPANEL_TOKENconfigurationTests
Environment Configuration
.env.example Update
Verification Checklist
updateProfile()method added to Mixpanel utilitysetupTests.ts.env.exampleupdated with Mixpanel tokenEvent Tracking Flow