refactor(analytics): migrate orphan multichain accounts UI events#44376
Conversation
Part of analytics migration umbrella #43885 (15c · Accounts multichain UI).
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (4 files, +60 -54)
👨🔧 @MetaMask/core-extension-ux (7 files, +136 -125)
|
|
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. |
Builds ready [48db0a0]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)
Bundle sizes
|
There was a problem hiding this comment.
Pull request overview
This PR migrates remaining legacy MetaMetrics UI event tracking in the multichain Accounts domain (account details, import account, import NFTs) from MetaMetricsContext.trackEvent / trackMetaMetricsEvent to the newer useAnalytics() + createEventBuilder pattern, aligning these call sites with the AnalyticsController-backed tracking pipeline.
Changes:
- Replaced
MetaMetricsContextusage withuseAnalytics()in multichain account-related UI components. - Converted inline event payload objects into
createEventBuilder(...).addCategory(...).addProperties/...addSensitiveProperties(...).build()calls. - Standardized event tracking calls in account details and import flows to the new analytics API.
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/components/multichain/import-nfts-modal/import-nfts-modal.js | Migrates “NFT imported/TokenAdded” tracking to useAnalytics() + event builder with sensitive properties. |
| ui/components/multichain/import-account/import-account.js | Migrates import-account success/failure tracking to the new analytics builder API. |
| ui/components/multichain/account-list-item/account-list-item.js | Migrates “account detail menu opened” tracking to useAnalytics() + event builder. |
| ui/components/multichain/account-details/account-details.tsx | Migrates “key export canceled” tracking to the new analytics API. |
| ui/components/multichain/account-details/account-details-section.tsx | Migrates “key export selected” tracking to the new analytics API. |
| ui/components/multichain/account-details/account-details-display.js | Migrates “account renamed” tracking to useAnalytics() + event builder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ccharly
left a comment
There was a problem hiding this comment.
LGTM!
NOTE (for us): It seems ui/components/multichain/account-details is actual dead code now, we might have missed that during our BIP-44 cleanup, we should consider removing that at some point
Builds ready [c5bcc3b]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 10 warn · 🔴 0 fail)
Bundle size diffs
|
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Builds ready [e859e8d] [reused from c5bcc3b]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 10 warn · 🔴 0 fail)
Bundle size diffs
|
Builds ready [7303f58]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 9 warn · 🔴 1 fail)
Bundle size diffs
|



Description
Migrates remaining legacy
MetaMetricsContext.trackEvent/trackMetaMetricsEventcall sites in the Accounts (account details, import account/NFTs) domain touseAnalytics()+createEventBuilder(ortrackAnalyticsEventfor Redux thunks).Part of umbrella tracker #43885 (15c · Accounts multichain UI).
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
yarn start).Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Analytics-only refactor with no product logic changes; tests were updated to match the new event builder output.
Overview
Replaces
MetaMetricsContextwithuseAnalytics()andcreateEventBuilderfor MetaMetrics in multichain account details, account list, import account, and import NFTs flows. Event names and property keys are unchanged; call sites now use the builder pattern (e.g.AccountRenamed,KeyExportSelected/KeyExportCanceled,AccountDetailMenuOpened, import success/failure,TokenAdded).For custom NFT import,
TokenAddedsensitive fields (contract address, symbol, token id, etc.) are sent viaaddSensitivePropertiesinstead of inline on the legacy payload.import-account.test.tsxmocksuseAnalyticsdirectly and asserts the built event shape (name,properties,sensitiveProperties) instead of wiring metrics through the render helper.Reviewed by Cursor Bugbot for commit 7303f58. Bugbot is set up for automated code reviews on this repo. Configure here.