Skip to content

chore(analytics): migrate MetricsEventBuilder→AnalyticsEventBuilder and useMetrics→useAnalytics (web3auth/onboarding files)#31250

Merged
NicolasMassart merged 2 commits into
mainfrom
analytics/pr2-web3auth
Jun 9, 2026
Merged

chore(analytics): migrate MetricsEventBuilder→AnalyticsEventBuilder and useMetrics→useAnalytics (web3auth/onboarding files)#31250
NicolasMassart merged 2 commits into
mainfrom
analytics/pr2-web3auth

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates all web3auth and onboarding files from the legacy analytics system (useMetrics, MetricsEventBuilder) to the new system (useAnalytics, AnalyticsEventBuilder).

Part of the analytics migration cleanup series. All changes are in files owned by the web3auth/onboarding team.

Files migrated:

  • AccountBackupStep1, AccountBackupStep1B, ManualBackupStep1-3, ImportFromSecretRecoveryPhrase, Onboarding, ChoosePassword, WalletCreationError/SRPErrorScreen

Changelog

CHANGELOG entry: null

Related issues

Refs: #26686

Manual testing steps

N/A — analytics-only refactor, no behaviour change.

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.

Made with Cursor


Note

Low Risk
Mechanical import/API rename across onboarding analytics with no wallet or auth logic changes; main risk is test/mock drift if event payloads diverge from the legacy builder.

Overview
This PR continues the analytics migration in web3auth/onboarding screens by swapping MetricsEventBuilder for AnalyticsEventBuilder (util/analytics) everywhere onboarding events are built before trackOnboarding.

Touched flows include account backup steps, manual backup, import-from-SRP, choose password, onboarding root, and wallet-creation error. Runtime behavior is intended to stay the same—same events, properties, and trackOnboarding wiring; only the builder import and class name change.

Tests are aligned with the new stack: mocks target AnalyticsEventBuilder instead of MetricsEventBuilder, legacy MetaMetrics singleton mocks are dropped where useAnalytics already covers the surface, and addTraitsToUser expectations become identify. Onboarding tests drop withMetricsAwareness HOC wiring in favor of the useAnalytics mock.

Reviewed by Cursor Bugbot for commit 33d3acd. Bugbot is set up for automated code reviews on this repo. Configure here.

…and useMetrics->useAnalytics (web3auth files)

Migrates 9 web3auth-owned files from MetricsEventBuilder to AnalyticsEventBuilder
with legacy-properties audit, plus 1 useMetrics->useAnalytics migration in Onboarding
test and 2 addTraitsToUser->identify renames.

Files:
- Onboarding/index.tsx (MetricsEventBuilder->AnalyticsEventBuilder)
- Onboarding/index.test.tsx (useMetrics->useAnalytics + identify rename)
- WalletCreationError/SRPErrorScreen.tsx
- ManualBackupStep2/index.js
- ManualBackupStep3/index.js + index.test.tsx
- ChoosePassword/index.tsx + index.test.tsx
- AccountBackupStep1/index.js
- AccountBackupStep1B/index.js
- ImportFromSecretRecoveryPhrase/index.js
- ManualBackupStep1/index.test.tsx (identify rename)

Co-authored-by: Cursor <cursoragent@cursor.com>
@NicolasMassart NicolasMassart self-assigned this Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f49ae5cff1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/components/Views/Onboarding/index.tsx
@NicolasMassart NicolasMassart enabled auto-merge June 9, 2026 13:01

@grvgoel81 grvgoel81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:medium AI analysis: medium risk labels Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokeSeedlessOnboarding, SmokeAccounts
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 12 changed files are part of a refactoring that replaces MetricsEventBuilder (from app/core/Analytics/MetricsEventBuilder) with AnalyticsEventBuilder (from app/util/analytics/AnalyticsEventBuilder) across onboarding-related views. The API is identical — only the import path and class name changed. No functional logic was modified.

Affected components:

  • AccountBackupStep1, AccountBackupStep1B: SRP backup step 1 screens
  • ManualBackupStep2, ManualBackupStep3: SRP backup confirmation and completion screens
  • ImportFromSecretRecoveryPhrase: SRP import flow
  • ChoosePassword: Password creation during onboarding
  • Onboarding: Main onboarding screen
  • WalletCreationError/SRPErrorScreen: Error screen during wallet creation
  • Test files: Updated mocks to match new import paths and cleaned up old mock patterns (removed withMetricsAwareness, renamed addTraitsToUseridentify)

Tag selection rationale:

  • SmokeWalletPlatform: Covers wallet lifecycle analytics tracking for new wallet creation and SRP import events — directly exercises the changed analytics tracking code in ChoosePassword, Onboarding, and ManualBackupStep3.
  • SmokeSeedlessOnboarding: Covers the full onboarding lifecycle including password creation, MetaMetrics opt-in, and wallet home arrival — exercises ChoosePassword, Onboarding, and SRPErrorScreen changes. The test mock cleanup (removing withMetricsAwareness, addTraitsToUseridentify) in Onboarding/index.test.tsx is particularly relevant here.
  • SmokeAccounts: Covers SRP export flows and wallet backup steps — exercises AccountBackupStep1, ManualBackupStep2, ManualBackupStep3, and ImportFromSecretRecoveryPhrase changes.

Risk is low because this is a pure refactoring (same API, renamed class), but the onboarding flow is critical enough to warrant validation that the analytics tracking still fires correctly through the new import path.

Performance Test Selection:
This is a pure refactoring of analytics event builder imports with no functional logic changes. No UI rendering, data loading, state management, or critical user flow performance characteristics are affected. Performance tests are not warranted.

View GitHub Actions results

@NicolasMassart NicolasMassart added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit bb6f304 Jun 9, 2026
172 of 174 checks passed
@NicolasMassart NicolasMassart deleted the analytics/pr2-web3auth branch June 9, 2026 14:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.82.0 Issue or pull request that will be included in release 7.82.0 label Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.82.0 Issue or pull request that will be included in release 7.82.0 risk:high AI analysis: high risk size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants