Skip to content

Conversation

@PatrykLucka
Copy link
Contributor

@PatrykLucka PatrykLucka commented Dec 3, 2025

Description

This PR updates the Network Switched analytics event to include additional properties: to_network (chain ID) and custom_network (boolean indicating if the destination network is custom).

The changes ensure that when users switch networks, we track:

  1. The destination chain ID (to_network)
  2. Whether the destination is a custom network (custom_network) - i.e., not a built-in, featured RPC, or multichain network

This applies to three network switching scenarios:

  • Network list menu selection
  • Network manager handlers
  • Confirmation page network switches

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-213

Manual testing steps

  1. Open MetaMask extension
  2. Switch networks using the network list menu
  3. Verify the Network Switched event is tracked with to_network (chain ID) and custom_network properties
  4. Test switching to a built-in network (e.g., Ethereum Mainnet) - custom_network should be false
  5. Test switching to a custom network - custom_network should be true
  6. Test network switching from the confirmation page
  7. Test network switching via network manager

Screenshots/Recordings

Before

After

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

Enhances NavNetworkSwitched telemetry to include destination chain ID and a custom_network flag across menu, manager, and confirmation flows.

  • Analytics
    • Augment NavNetworkSwitched event with:
      • to_network (destination chain ID) and custom_network (boolean) in:
        • ui/components/multichain/network-list-menu/network-list-menu.tsx
        • ui/components/multichain/network-manager/hooks/useNetworkChangeHandlers.ts
        • ui/pages/confirmations/confirmation/confirmation.js
    • Determine custom_network by checking against BUILT_IN_NETWORKS, FEATURED_RPCS, and MultichainNetworks (non-EVM/EVM-aware via convertCaipToHexChainId).

Written by Cursor Bugbot for commit 944f232. This will update automatically on new commits. Configure here.

@PatrykLucka PatrykLucka self-assigned this Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

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.

@metamaskbot metamaskbot added the team-mobile-ux Mobile UX team label Dec 3, 2025
@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (1 files, +24 -1)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 confirmation/
          • 📄 confirmation.js +24 -1

👨‍🔧 @MetaMask/core-extension-ux (2 files, +60 -1)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 network-list-menu/
          • 📄 network-list-menu.tsx +30 -1
        • 📁 network-manager/
          • 📁 hooks/
            • 📄 useNetworkChangeHandlers.ts +30 -0

@github-actions github-actions bot added the size-S label Dec 3, 2025
@PatrykLucka PatrykLucka force-pushed the TMCU-213-segment-add-props-to-the-network-switched-event branch from ff8a81e to 944f232 Compare December 3, 2025 15:37
@metamaskbot
Copy link
Collaborator

Builds ready [944f232]
UI Startup Metrics (1226 ± 113 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12261038176011312991403
load102287114149410581204
domContentLoaded101686714039310471197
domInteractive2714203262284
firstPaint4608214233889741138
backgroundConnect21619333217221241
firstReactRender26185272843
getState3215112153758
initialActions102112
loadScripts807659116590836977
setupStore1172331219
numNetworkReqs1157017560
BrowserifyPower User HomeuiStartup20021697264622421792395
load992875171012810211265
domContentLoaded981867170312810101253
domInteractive2916120212791
firstPaint54511617193949321210
backgroundConnect262203753123235545
firstReactRender5037125105462
getState207140738105202354
initialActions102112
loadScripts77366514791258001050
setupStore1574261633
numNetworkReqs78651602374148
WebpackStandard HomeuiStartup8507321043708811020
load66058784368694805
domContentLoaded65558383868689796
domInteractive2715113212394
firstPaint20892837127207617
backgroundConnect1165281230
firstReactRender302076103440
getState271459103344
initialActions103112
loadScripts65258183666687788
setupStore1172241318
numNetworkReqs1056715559
WebpackPower User HomeuiStartup15781248216524618252080
load662584101782679849
domContentLoaded654579101182672840
domInteractive3217136253099
firstPaint28297847193313688
backgroundConnect1168628205107570
firstReactRender56469586168
getState18214268055190226
initialActions103112
loadScripts651577100281670832
setupStore1794491543
numNetworkReqs78641652473150
FirefoxBrowserifyStandard HomeuiStartup13971063190316915201685
load1146911144911812301367
domContentLoaded1146911144911712291366
domInteractive70311993992147
firstPaint------
backgroundConnect57223334574136
firstReactRender25185262639
getState135154171224
initialActions102122
loadScripts1111894135210811911300
setupStore136110141238
numNetworkReqs1156516761
BrowserifyPower User HomeuiStartup30871967532586238804701
load1366964284845314032523
domContentLoaded1366964284845314032522
domInteractive132341631184112314
firstPaint------
backgroundConnect2492312353333141143
firstReactRender63371322466125
getState300701052241392814
initialActions2122224
loadScripts1254950271333912972344
setupStore1277971189115616
numNetworkReqs865818334104167
WebpackStandard HomeuiStartup15191300223014715921832
load1252107216099413131429
domContentLoaded1251107216089413131428
domInteractive74292324095134
firstPaint------
backgroundConnect48201612763105
firstReactRender28218383037
getState167174251346
initialActions103122
loadScripts1223105015378912811394
setupStore136103121534
numNetworkReqs1257017763
WebpackPower User HomeuiStartup30892149513775639294464
load15261143268741515092474
domContentLoaded15261143268741515092474
domInteractive136321195198122857
firstPaint------
backgroundConnect2222710953051781043
firstReactRender69403034268134
getState304681044268455853
initialActions616914350
loadScripts14181089264332614362256
setupStore102772315192478
numNetworkReqs865723137100177
📊 Page Load Benchmark Results

Current Commit: 944f232 | Date: 12/3/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±37ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 716ms (±35ms) 🟢 | historical mean value: 727ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±12ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 37ms 1.00s 1.30s 1.07s 1.30s
domContentLoaded 716ms 35ms 696ms 969ms 740ms 969ms
firstPaint 75ms 12ms 56ms 176ms 84ms 176ms
firstContentfulPaint 75ms 12ms 56ms 176ms 84ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 1.18 KiB (0.02%)
  • common: 373 Bytes (0%)

@PatrykLucka PatrykLucka marked this pull request as ready for review December 4, 2025 13:57
@PatrykLucka PatrykLucka requested review from a team as code owners December 4, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants