refactor(analytics): migrate orphan Web3Auth onboarding events#44377
Conversation
Part of analytics migration umbrella #43885 (15d · Web3Auth onboarding gaps).
|
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. |
✨ Files requiring CODEOWNER review ✨🔐 @MetaMask/web3auth (2 files, +113 -35)
|
Builds ready [6a2cbca]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 7 warn · 🔴 0 fail)
Bundle sizes
|
…tests Mock useAnalytics in reveal-recovery-phrase tests to avoid useSegmentContext errors with the partial react-router-dom mock, and apply oxfmt formatting. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates remaining legacy MetaMetrics UI call sites in the Web3Auth onboarding domain (SRP reveal, passkey troubleshooting, marketing consent, change-password, basic configuration) to the newer useAnalytics() + createEventBuilder tracking API, aligning these flows with the ongoing analytics refactor effort.
Changes:
- Replaced
MetaMetricsContext.trackEventusage withuseAnalytics().trackEvent(createEventBuilder(...).build())across several onboarding-related UI components. - Updated SRP reveal unit tests to mock
useAnalytics(to avoid real analytics wiring during tests). - Updated the passkey troubleshoot modal support-link tracking to explicitly include page-title context via
useSegmentContext.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/pages/onboarding-flow/recovery-phrase/reveal-recovery-phrase.tsx | Migrates SRP export tracking events to useAnalytics + event builder. |
| ui/pages/onboarding-flow/recovery-phrase/reveal-recovery-phrase.test.tsx | Mocks useAnalytics for SRP reveal tests. |
| ui/components/app/passkey-troubleshoot-modal/passkey-troubleshoot-modal.tsx | Migrates modal view/CTA/support-link events to event builder; injects page title via segment context. |
| ui/components/app/metametrics-consent/metametrics-consent-container.tsx | Migrates marketing consent selection tracking to event builder. |
| ui/components/app/change-password/change-password.tsx | Migrates passkey/password change analytics events to event builder. |
| ui/components/app/basic-configuration-modal/basic-configuration-modal.tsx | Migrates settings-updated tracking to event builder for onboarding vs settings contexts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Builds ready [a6e4068]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 6 warn · 🔴 0 fail)
Bundle sizes
|
Mock useAnalytics in basic-configuration-modal tests to avoid background connection console warnings, and assert SRP export analytics events in reveal-recovery-phrase tests. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Builds ready [47b7b93]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 7 warn · 🔴 1 fail)
Bundle sizes
|



Description
Migrates remaining legacy
MetaMetricsContext.trackEvent/trackMetaMetricsEventcall sites in the Web3Auth (recovery phrase, passkey, consent, password) domain touseAnalytics()+createEventBuilder(ortrackAnalyticsEventfor Redux thunks).Part of umbrella tracker #43885 (15d · Web3Auth onboarding gaps).
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
yarn start).Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Analytics instrumentation refactor only; no changes to wallet, auth, or password/passkey business logic beyond how events are emitted.
Overview
Replaces remaining
MetaMetricsContexttrackEventusage in Web3Auth-related UI (basic functionality modal, change password, marketing consent, passkey troubleshoot, reveal SRP) withuseAnalytics()andcreateEventBuilder().build(), keeping the same event names and properties.Passkey troubleshoot now pulls page title for support-link events from
useSegmentContextinstead of the legacy second-argument context merge.Tests for reveal recovery phrase (and related setup) mock
useAnalyticsand asserttrackEventreceives the built payload shape (name,properties,sensitiveProperties) on SRP export success and failure paths.Reviewed by Cursor Bugbot for commit 47b7b93. Bugbot is set up for automated code reviews on this repo. Configure here.