Skip to content

refactor(analytics): migrate settings thunk MetaMetrics events#44379

Merged
gauthierpetetin merged 1 commit into
mainfrom
refactor/analytics-migrate-orphan-settings-actions
Jul 14, 2026
Merged

refactor(analytics): migrate settings thunk MetaMetrics events#44379
gauthierpetetin merged 1 commit into
mainfrom
refactor/analytics-migrate-orphan-settings-actions

Conversation

@gauthierpetetin

@gauthierpetetin gauthierpetetin commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates remaining legacy MetaMetricsContext.trackEvent / trackMetaMetricsEvent call sites in the Settings (smart account suggestion and smart transactions opt-in thunks) domain to useAnalytics() + createEventBuilder (or trackAnalyticsEvent for Redux thunks).

Part of umbrella tracker #43885 (15g · Settings Redux thunks).

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

  1. Build and load the extension (yarn start).
  2. Exercise the flows touched by this PR (see changed files).
  3. With MetaMetrics debug enabled, confirm events still fire with the same names and properties.

Pre-merge author checklist

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.

Note

Low Risk
Mechanical telemetry refactor with unchanged event names and properties; preference dispatch logic is untouched.

Overview
Continues the analytics migration in Settings Redux thunks by replacing legacy trackMetaMetricsEvent payloads with trackAnalyticsEvent + createEventBuilder in ui/store/actions.ts.

setDismissSmartAccountSuggestionEnabled and setSmartTransactionsPreferenceEnabled still emit SettingsUpdated under the Settings category with the same property keys (dismiss_smt_acc_suggestion_enabled / prev_* and stx_opt_in / prev_stx_opt_in); only the construction path changes. The file now imports createEventBuilder (not just types) from shared/lib/analytics/create-event-builder.

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

Part of analytics migration umbrella #43885 (15g · Settings Redux thunks).
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

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.

@metamask-ci

metamask-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
Builds ready [cdabb3b]
Deprecated Browserify fallback builds
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 8 warn · 🔴 1 fail)

Baseline (latest main): 1716549 | Date: 6/29/2026 | Pipeline: 29225510550 | Baseline logs

Metricschrome-webpackfirefox-webpack
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 1 failure)

Interaction Benchmarks · Samples: 5
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -23%
  • loadNewAccount/total: -23%
  • confirmTx/longTaskCount: +33%
  • confirmTx/longTaskTotalDuration: +30%
  • confirmTx/tbt: +25%
  • confirmTx/inp: +12%
  • bridgeUserActions/bridge_load_page: -36%
  • bridgeUserActions/longTaskCount: +67%
  • bridgeUserActions/longTaskTotalDuration: +45%
  • loadNewAccount/load_new_account: +479%
  • loadNewAccount/total: +479%
  • loadNewAccount/inp: +15%
  • loadNewAccount/fcp: -53%
  • loadNewAccount/lcp: +975%
  • confirmTx/longTaskCount: -100%
  • confirmTx/longTaskTotalDuration: -100%
  • confirmTx/longTaskMaxDuration: -100%
  • confirmTx/tbt: -100%
  • confirmTx/fcp: -53%
  • confirmTx/lcp: +1046%
  • bridgeUserActions/bridge_load_page: +96%
  • bridgeUserActions/bridge_load_asset_picker: +66%
  • bridgeUserActions/longTaskCount: -100%
  • bridgeUserActions/longTaskTotalDuration: -100%
  • bridgeUserActions/longTaskMaxDuration: -100%
  • bridgeUserActions/tbt: -100%
  • bridgeUserActions/total: +20%
  • bridgeUserActions/inp: +12%
  • bridgeUserActions/fcp: -56%
  • bridgeUserActions/lcp: +1154%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 1.8s
  • 🟡 confirmTx/FCP: p75 1.8s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
startupPowerUserHome
[Sentry log · main/release]
🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: +19%
  • startupStandardHome/backgroundConnect: +11%
  • startupStandardHome/firstReactRender: +209%
  • startupStandardHome/numNetworkReqs: +50%
  • startupStandardHome/firstReactRender: +287%
  • startupStandardHome/setupStore: +38%
  • startupStandardHome/fcp: -13%
  • startupPowerUserHome/domInteractive: -13%
  • startupPowerUserHome/backgroundConnect: -19%
  • startupPowerUserHome/firstReactRender: +559%
  • startupPowerUserHome/setupStore: -72%
  • startupPowerUserHome/fcp: -13%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 startupPowerUserHome/INP: p75 232ms
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total
assetDetails
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
solanaAssetDetails
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
importSrpHome
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]
sendTransactions
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
swap
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -16%
  • onboardingImportWallet/doneButtonToHomeScreen: -86%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: -49%
  • onboardingImportWallet/longTaskCount: -80%
  • onboardingImportWallet/longTaskTotalDuration: -94%
  • onboardingImportWallet/longTaskMaxDuration: -91%
  • onboardingImportWallet/tbt: -99%
  • onboardingImportWallet/total: -83%
  • onboardingNewWallet/longTaskCount: -50%
  • onboardingNewWallet/longTaskTotalDuration: -70%
  • onboardingNewWallet/longTaskMaxDuration: -47%
  • onboardingNewWallet/tbt: -95%
  • solanaAssetDetails/assetClickToPriceChart: -61%
  • solanaAssetDetails/total: -61%
  • solanaAssetDetails/inp: -31%
  • importSrpHome/loginToHomeScreen: -14%
  • importSrpHome/openAccountMenuAfterLogin: -20%
  • importSrpHome/homeAfterImportWithNewWallet: -25%
  • importSrpHome/longTaskCount: -44%
  • importSrpHome/longTaskTotalDuration: -46%
  • importSrpHome/longTaskMaxDuration: +19%
  • importSrpHome/tbt: -45%
  • importSrpHome/total: -21%
  • importSrpHome/inp: +12%
  • importSrpHome/lcp: -56%
  • importSrpHome/cls: -47%
  • sendTransactions/openSendPageFromHome: -36%
  • sendTransactions/selectTokenToSendFormLoaded: -58%
  • sendTransactions/reviewTransactionToConfirmationPage: -19%
  • sendTransactions/longTaskCount: -20%
  • sendTransactions/longTaskTotalDuration: -25%
  • sendTransactions/tbt: -47%
  • sendTransactions/total: -18%
  • sendTransactions/inp: -19%
  • sendTransactions/fcp: -10%
  • sendTransactions/cls: -40%
  • swap/openSwapPageFromHome: -34%
  • swap/fetchAndDisplaySwapQuotes: +105%
  • swap/longTaskCount: -100%
  • swap/longTaskTotalDuration: -100%
  • swap/longTaskMaxDuration: -100%
  • swap/tbt: -100%
  • swap/total: +103%
  • swap/cls: -63%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 importSrpHome/INP: p75 296ms
  • 🟡 assetDetails/FCP: p75 2.0s
  • 🟡 solanaAssetDetails/FCP: p75 2.0s
  • 🟡 importSrpHome/FCP: p75 1.9s
  • 🟡 swap/FCP: p75 1.8s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]
Bundle sizes
  • background: 14.22 MiB
  • ui: 17.06 MiB
  • common: 0 Bytes
  • other: 998.07 KiB
  • contentScripts: 1.87 MiB
  • zip: 27.03 MiB
No matching bundle-size baseline was found in the history data, so diff values are omitted.

Copilot AI 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.

Pull request overview

Migrates two Settings-related Redux thunks from legacy trackMetaMetricsEvent usage to the newer analytics event builder (createEventBuilder) and trackAnalyticsEvent, aligning with the broader AnalyticsController migration effort.

Changes:

  • Replaces trackMetaMetricsEvent payload objects with createEventBuilder(...).addCategory(...).addProperties(...).build() for settings-updated events.
  • Updates imports to pull in createEventBuilder alongside analytics event types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/store/actions.ts
Comment thread ui/store/actions.ts
@gauthierpetetin
gauthierpetetin marked this pull request as ready for review July 13, 2026 12:17
@gauthierpetetin gauthierpetetin self-assigned this Jul 13, 2026
@gauthierpetetin
gauthierpetetin added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit 5dd78eb Jul 14, 2026
218 of 219 checks passed
@gauthierpetetin
gauthierpetetin deleted the refactor/analytics-migrate-orphan-settings-actions branch July 14, 2026 01:57
@metamaskbot metamaskbot added the release-13.41.0 Issue or pull request that will be included in release 13.41.0 label Jul 14, 2026
DDDDDanica pushed a commit that referenced this pull request Jul 14, 2026
## **Description**

Migrates remaining legacy `MetaMetricsContext.trackEvent` /
`trackMetaMetricsEvent` call sites in the **Settings (smart account
suggestion and smart transactions opt-in thunks)** domain to
`useAnalytics()` + `createEventBuilder` (or `trackAnalyticsEvent` for
Redux thunks).

Part of umbrella tracker #43885 (**15g · Settings Redux thunks**).

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes:

## **Manual testing steps**

1. Build and load the extension (`yarn start`).
2. Exercise the flows touched by this PR (see changed files).
3. With MetaMetrics debug enabled, confirm events still fire with the
same names and properties.

<!--
## **Screenshots/Recordings**
### **Before**
### **After**
-->

## **Pre-merge author checklist**

- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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**

- [ ] 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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical telemetry refactor with unchanged event names and
properties; preference dispatch logic is untouched.
> 
> **Overview**
> Continues the analytics migration in **Settings Redux thunks** by
replacing legacy `trackMetaMetricsEvent` payloads with
`trackAnalyticsEvent` + `createEventBuilder` in `ui/store/actions.ts`.
> 
> **`setDismissSmartAccountSuggestionEnabled`** and
**`setSmartTransactionsPreferenceEnabled`** still emit `SettingsUpdated`
under the Settings category with the same property keys
(`dismiss_smt_acc_suggestion_enabled` / `prev_*` and `stx_opt_in` /
`prev_stx_opt_in`); only the construction path changes. The file now
imports `createEventBuilder` (not just types) from
`shared/lib/analytics/create-event-builder`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
cdabb3b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This was referenced Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-13.41.0 Issue or pull request that will be included in release 13.41.0 risk:medium size-S team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants