refactor(analytics): C2 migrate network, accounts, and permissions to useAnalytics#27748
Conversation
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b811c4585
ℹ️ 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".
…cking navigation events
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27748 +/- ##
==========================================
+ Coverage 82.41% 82.46% +0.04%
==========================================
Files 4804 4801 -3
Lines 124015 123794 -221
Branches 27634 27597 -37
==========================================
- Hits 102210 102083 -127
+ Misses 14724 14639 -85
+ Partials 7081 7072 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
AccountActions.tsx is owned by @MetaMask/mobile-core-ux, which would add a second extra code owner to this PR. Deferring to C3 where other mobile-core-ux files are already planned.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |
|
Forgot to add to the approval comment, I just reviewed the Accounts CO files and not the entire PR |




Description
Part of the analytics cleanup effort (#26686). This PR migrates network, accounts, and permissions files from the deprecated
useMetricshook andMetricsEventBuilderto the newuseAnalyticshook andAnalyticsEventBuilder.Renames applied across 24 files:
useMetrics→useAnalyticsMetricsEventBuilder→AnalyticsEventBuilderaddTraitsToUser→identifygetMetaMetricsId→getAnalyticsIdTest mocks updated to match the new API shape (adds
identifymock, usesjest.mocked()pattern).Changelog
CHANGELOG entry: null
Related issues
Refs: #26813
Manual testing steps
N/A — purely mechanical rename with no behavior change. Existing unit tests updated and passing.
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Mostly mechanical analytics API migration; primary risk is missed hook import or mismatched method names causing analytics calls (or tests) to break at runtime.
Overview
Migrates several network, accounts, and permissions UI surfaces from deprecated
useMetrics/MetricsEventBuilderto the neweruseAnalytics/AnalyticsEventBuilder, keeping the same event tracking behavior.Updates places that previously set user traits during network add/update flows to call
identifyinstead ofaddTraitsToUser, and refactors Jest mocks to the new hook shape usingcreateMockUseAnalyticsHook.Written by Cursor Bugbot for commit 861220b. This will update automatically on new commits. Configure here.