Skip to content

Commit c291d98

Browse files
authored
feat: Add MetaMetrics event for "Use different login method" click during social login rehydration (#21903)
## **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 ## **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 4. Click "Use a different login method" button 5. Verify the `USE_DIFFERENT_LOGIN_METHOD_CLICKED` event is tracked with `account_type: 'social'` ## **Screenshots/Recordings** ### **Before** No MetaMetrics event tracked when clicking "Use a different login method" during rehydration ### **After** `USE_DIFFERENT_LOGIN_METHOD_CLICKED` 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 Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/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 triggers it when users in OAuth rehydration click "Use a different login method". > > - **Analytics** > - Add `USE_DIFFERENT_LOGIN_METHOD_CLICKED` to `EVENT_NAME` and expose via `MetaMetricsEvents` in `app/core/Analytics/MetaMetrics.events.ts`. > - **Login** > - In `app/components/Views/Login/index.tsx`, fire `MetaMetricsEvents.USE_DIFFERENT_LOGIN_METHOD_CLICKED` with `{ account_type: 'social' }` when `handleUseOtherMethod` is used during OAuth onboarding rehydration. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9951208. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 42d139d commit c291d98

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/components/Views/Login/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ const Login: React.FC<LoginProps> = ({ saveOnboardingEvent }) => {
364364
};
365365

366366
const handleUseOtherMethod = () => {
367+
if (isComingFromOauthOnboarding) {
368+
track(MetaMetricsEvents.USE_DIFFERENT_LOGIN_METHOD_CLICKED, {
369+
account_type: 'social',
370+
});
371+
}
367372
navigation.goBack();
368373
OAuthService.resetOauthState();
369374
};

app/core/Analytics/MetaMetrics.events.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ enum EVENT_NAME {
145145
REHYDRATION_PASSWORD_FAILED = 'Rehydration Password Failed',
146146
PASSWORD_CHANGED = 'Password Changed',
147147
FORGOT_PASSWORD_CLICKED = 'Forgot Password Clicked',
148+
USE_DIFFERENT_LOGIN_METHOD_CLICKED = 'Use Different Login Method Clicked',
148149
RESET_WALLET = 'Reset Wallet',
149150

150151
// Account
@@ -767,6 +768,9 @@ const events = {
767768
),
768769
PASSWORD_CHANGED: generateOpt(EVENT_NAME.PASSWORD_CHANGED),
769770
FORGOT_PASSWORD_CLICKED: generateOpt(EVENT_NAME.FORGOT_PASSWORD_CLICKED),
771+
USE_DIFFERENT_LOGIN_METHOD_CLICKED: generateOpt(
772+
EVENT_NAME.USE_DIFFERENT_LOGIN_METHOD_CLICKED,
773+
),
770774
RESET_WALLET: generateOpt(EVENT_NAME.RESET_WALLET),
771775
SWITCHED_ACCOUNT: generateOpt(EVENT_NAME.SWITCHED_ACCOUNT),
772776
BROWSER_OPENED: generateOpt(EVENT_NAME.BROWSER_OPENED),

0 commit comments

Comments
 (0)