Skip to content

Commit 03691d8

Browse files
authored
feat: add error_type to RehydrationPasswordFailed event (#37373)
## **Description** Added `error_type` property to the `RehydrationPasswordFailed` analytics event to distinguish between: - `'incorrect_password'`: Wrong password entered - `'unknown_error'`: Other errors This provides better visibility into rehydration failure reasons [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37373?quickstart=1) ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/SL-240 ## **Manual testing steps** 1. Set up a social login account during onboarding 2. Lock the wallet 3. Try to unlock with incorrect password 4. Verify `RehydrationPasswordFailed` event includes `error_type: 'incorrect_password'` ## **Screenshots/Recordings** N/A - Analytics enhancement only ## **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 `error_type` ('incorrect_password' | 'unknown_error') to `RehydrationPasswordFailed` during social rehydration in `unlock-page.component.js`. > > - **Analytics** > - In `ui/pages/unlock-page/unlock-page.component.js`: > - Determine error type from `message` (including `SeedlessOnboardingControllerErrorMessage.IncorrectPassword`). > - Add `error_type` to `RehydrationPasswordFailed` event properties during rehydration (`incorrect_password` or `unknown_error`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 93ffae6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 54b58db commit 03691d8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ class UnlockPage extends Component {
249249
let finalUnlockDelayPeriod = 0;
250250
let errorReason;
251251

252+
// Determine error type for rehydration tracking
253+
const isIncorrectPasswordError =
254+
message === 'Incorrect password' ||
255+
message === SeedlessOnboardingControllerErrorMessage.IncorrectPassword;
256+
const errorType = isIncorrectPasswordError
257+
? 'incorrect_password'
258+
: 'unknown_error';
259+
252260
// Track wallet rehydration failed for social import users (only during rehydration)
253261
if (isRehydrationFlow) {
254262
this.context.trackEvent({
@@ -257,6 +265,7 @@ class UnlockPage extends Component {
257265
properties: {
258266
account_type: 'social',
259267
failed_attempts: this.failed_attempts,
268+
error_type: errorType,
260269
},
261270
});
262271
}

0 commit comments

Comments
 (0)