Skip to content

Commit 54b58db

Browse files
authored
feat: Add MetaMetrics event for "Use different login method" click during social login rehydration (#37349)
## **Description** This PR adds MetaMetrics tracking for when users click the "Use a different login method" button during social login rehydration flow **What is the reason for the change?** We need to track when users decide to switch login methods during the rehydration phase **What is the improvement/solution?** Added a new MetaMetrics event `UseDifferentLoginMethodClicked` that fires when: - User is in social login flow - Onboarding is not completed (rehydration phase) - User clicks "Use a different login method" on the welcome back screen [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37349?quickstart=1) ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/SL-241 ## **Manual testing steps** 1. Start a social login import flow (Google or Apple) 2. Complete authentication with the provider 3. Navigate to the unlock/rehydration screen (welcome back screen) 4. Click "Use a different login method" button 5. Verify the `UseDifferentLoginMethodClicked` event is tracked with `account_type: 'social'` ## **Screenshots/Recordings** ### **Before** No MetaMetrics event tracked when clicking "Use a different login method" during rehydration ### **After** `UseDifferentLoginMethodClicked` event tracked with proper account_type property ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds a new MetaMetrics event and tracking on the unlock page for clicks to use a different login method during social login rehydration. > > - **Analytics (MetaMetrics)**: > - Add `UseDifferentLoginMethodClicked` to `MetaMetricsEventName` in `shared/constants/metametrics.ts`. > - **UI**: > - Track `UseDifferentLoginMethodClicked` in `ui/pages/unlock-page/unlock-page.component.js` when in social login rehydration (onboarding not completed) before redirecting to `onboarding_welcome`, with `properties.account_type = 'social'`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 96edf3a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent f3f9bcf commit 54b58db

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

shared/constants/metametrics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ export enum MetaMetricsEventName {
842842
RehydrationPasswordAttempted = 'Rehydration Password Attempted',
843843
RehydrationCompleted = 'Rehydration Completed',
844844
RehydrationPasswordFailed = 'Rehydration Password Failed',
845+
UseDifferentLoginMethodClicked = 'Use Different Login Method Clicked',
845846
// BEGIN:ONLY_INCLUDE_IF(build-flask,build-experimental)
846847
WatchEthereumAccountsToggled = 'Watch Ethereum Accounts Toggled',
847848
// END:ONLY_INCLUDE_IF

ui/pages/unlock-page/unlock-page.component.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,15 @@ class UnlockPage extends Component {
391391
// in `onboarding_unlock` route, if the user is on a social login flow and onboarding is not completed,
392392
// we can redirect to `onboarding_welcome` route to select a different login method
393393
if (!isOnboardingCompleted && isSocialLoginFlow) {
394+
// Track when user clicks "Use a different login method" during rehydration
395+
this.context.trackEvent({
396+
category: MetaMetricsEventCategory.Onboarding,
397+
event: MetaMetricsEventName.UseDifferentLoginMethodClicked,
398+
properties: {
399+
account_type: 'social',
400+
},
401+
});
402+
394403
await this.props.loginWithDifferentMethod();
395404
await this.props.forceUpdateMetamaskState();
396405
history.replace(ONBOARDING_WELCOME_ROUTE);

0 commit comments

Comments
 (0)