Skip to content

Conversation

@gauthierpetetin
Copy link
Contributor

@gauthierpetetin gauthierpetetin commented Jan 28, 2026

Description

Add platform (browser type) and install_type (installation source) as user traits sent via identify() instead of as properties on every event. This is the appropriate approach for static installation properties.

  • Add initInstallType() to cache install type from browser.management API
  • Add Platform and InstallType to MetaMetricsUserTrait enum
  • Update _buildUserTraitsObject to include these traits
  • Update unit test expectations

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

  1. Lauch Extension
  2. Enable metametrics
  3. Get your metametricsId
  4. Go to MixPanel
  5. Search user with your metametricsId
  6. Confirm it has platform and install_type defined in its user profile properties

Screenshots/Recordings

Screenshot 2026-01-28 at 15 39 35 Screenshot 2026-01-28 at 15 40 08

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

Medium Risk
Medium risk because it touches analytics trait generation and Sentry error-tagging, plus adds an early background initialization side-effect via browser.management.getSelf() (albeit fire-and-forget). Functionality is additive but could impact telemetry correctness and startup behavior across browsers.

Overview
Adds platform and install_type as new MetaMetrics user traits (via identify()), and wires MetaMetricsController._buildUserTraitsObject to populate them using getPlatform() and a new cached getInstallType().

Introduces a dedicated install-type helper (with initInstallType() + cached value) and initializes it early in both background.js startup and Sentry setup; Sentry reports now tag/include installType via the cache rather than an inline async fetch. Updates shared constants/types to formalize Platform/InstallType and adjusts MetaMetrics controller tests accordingly.

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

Add platform (browser type) and install_type (installation source) as
user traits sent via identify() instead of as properties on every event.
This is the appropriate approach for static installation properties.

- Add initInstallType() to cache install type from browser.management API
- Add Platform and InstallType to MetaMetricsUserTrait enum
- Update _buildUserTraitsObject to include these traits
- Update unit test expectations
@github-actions
Copy link
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.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Jan 28, 2026

Builds ready [74448f0]
UI Startup Metrics (1388 ± 119 ms)
PlatformBuildTypePageMetricTest Title (ms)Persona (ms)Mean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--13881118164711914781572
load--1179944145111812521384
domContentLoaded--1173937144211812461374
domInteractive--2917103192584
firstPaint--1717633770212312
backgroundConnect--24822629215253282
firstReactRender--19124062134
initialActions--104113
loadScripts--941715120711710181141
setupStore--1464261724
numNetworkReqs--221582171572
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--251315409336128623805404
load--1149933179516312351491
domContentLoaded--1128928170815812211471
domInteractive--37191352537118
firstPaint--217751495252244443
backgroundConnect--60228157707814622567
firstReactRender--26156192947
initialActions--106112
loadScripts--88971014511519841221
setupStore--1564061726
numNetworkReqs--1295328152160231
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--8466821069889111028
load--69960192375764820
domContentLoaded--69459891574760813
domInteractive--251696172373
firstPaint--1136133360148279
backgroundConnect--39191412343102
firstReactRender--16103861733
initialActions--104112
loadScripts--69159690973757806
setupStore--1264251324
numNetworkReqs--221583181575
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--1338873242925615141754
load--74463712981227451027
domContentLoaded--73263012891237321020
domInteractive--40202203538130
firstPaint--1596858097208400
backgroundConnect--17213657685162481
firstReactRender--24174342734
initialActions--102011
loadScripts--72962712811227301011
setupStore--1454351622
numNetworkReqs--1455030556170257
19--------
FirefoxBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--15281223212317716041933
load--12301060182712412961439
domContentLoaded--12301059182612412961439
domInteractive--903539155132175
firstPaint--------
backgroundConnect--76253856397215
firstReactRender--14114651322
initialActions--103122
loadScripts--11901044179610812421346
setupStore--13665131058
numNetworkReqs--241292191980
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29212130881186929713887
load--13521074270527413931979
domContentLoaded--13511074270527413921979
domInteractive--153471363171132387
firstPaint--------
backgroundConnect--44312053395855231074
firstReactRender--22155462433
initialActions--206123
loadScripts--12961051268425113121828
setupStore--15891018194184622
numNetworkReqs--843725647100215
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--16601375244317317711991
load--14071172176111314861630
domContentLoaded--14071172176111314861630
domInteractive--982923041131148
firstPaint--------
backgroundConnect--64272514488159
firstReactRender--14102721518
initialActions--103122
loadScripts--1373115416949614121561
setupStore--186191321265
numNetworkReqs--231286191879
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29742066777882331374766
load--15911247614856015742505
domContentLoaded--15911247614856015742505
domInteractive--12032970123133219
firstPaint--------
backgroundConnect--44910228674335771221
firstReactRender--21156162430
initialActions--203122
loadScripts--15371225602853715372320
setupStore--14791061217132700
numNetworkReqs--83382894790204
19--------
📊 Page Load Benchmark Results

Current Commit: 74448f0 | Date: 1/28/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±48ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 722ms (±63ms) 🟢 | historical mean value: 717ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 87ms (±127ms) 🟢 | historical mean value: 76ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 48ms 1.01s 1.41s 1.07s 1.41s
domContentLoaded 722ms 63ms 697ms 1.28s 755ms 1.28s
firstPaint 87ms 127ms 60ms 1.35s 88ms 1.35s
firstContentfulPaint 87ms 127ms 60ms 1.35s 88ms 1.35s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 196 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 397 Bytes (0%)

@gauthierpetetin gauthierpetetin marked this pull request as ready for review January 28, 2026 17:03
@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Jan 29, 2026
Copy link
Contributor

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thoughts on enforcing + documenting the range of platform and install types with types?

gauthierpetetin and others added 2 commits January 29, 2026 19:46
Add type-safe constants and types for platform and install_type user
traits instead of using plain strings. This provides compile-time
validation and better IDE support.

- Add PLATFORM and INSTALL_TYPE const objects in shared/constants/app.ts
- Export Platform and InstallType types derived from these objects
- Update getPlatform() and getInstallType() to use proper return types
- Update MetaMetricsUserTraits to use typed fields

Co-authored-by: Cursor <[email protected]>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Remove duplicated install type fetching logic from setupSentry.js
and use the shared functions from util.ts instead. This ensures
a single source of truth for install type caching and eliminates
redundant API calls to browser.management.getSelf().

Co-authored-by: Cursor <[email protected]>
Move install type caching logic to a separate lightweight module
(install-type.ts) that only imports webextension-polyfill and constants.
This prevents the sentry bundle from pulling in heavy dependencies like
reselect through util.ts, which was causing browserify parsing errors.

- Create app/scripts/lib/install-type.ts with initInstallType/getInstallType
- Update setupSentry.js to import from install-type instead of util
- Re-export from util.ts for backward compatibility
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Jan 30, 2026

Builds ready [f526ca5]
UI Startup Metrics (1378 ± 117 ms)
PlatformBuildTypePageMetricTest Title (ms)Persona (ms)Mean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--13781165182811714461585
load--1184990160811312311418
domContentLoaded--1177974160111312271412
domInteractive--261584162476
firstPaint--166661146122202333
backgroundConnect--23421628713238265
firstReactRender--18103652030
initialActions--106113
loadScripts--958761136411310131191
setupStore--1263651427
numNetworkReqs--211581171571
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--20281681247415021142302
load--11731038187714311611533
domContentLoaded--11581026186714311451525
domInteractive--37191502636111
firstPaint--200711661172247381
backgroundConnect--33029246232345388
firstReactRender--23175562535
initialActions--103011
loadScripts--91079515011278901248
setupStore--1665871825
numNetworkReqs--1265026055154250
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--86367711501169581079
load--7355931076118812988
domContentLoaded--7305881071118806982
domInteractive--261698172375
firstPaint--1096326045136207
backgroundConnect--3317137194069
firstReactRender--15103851826
initialActions--103112
loadScripts--7275861069117798979
setupStore--1163551221
numNetworkReqs--221585171573
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--1234875183522713801721
load--68658810561126801004
domContentLoaded--6775821047112670997
domInteractive--36172003234110
firstPaint--1476351191183361
backgroundConnect--16714337242164302
firstReactRender--22173432330
initialActions--102111
loadScripts--6755801039111668990
setupStore--1141631215
numNetworkReqs--1255026258158257
19--------
FirefoxBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--15691306203916816751872
load--13321133185414614471561
domContentLoaded--13311133184814614471561
domInteractive--76322704897169
firstPaint--------
backgroundConnect--69291744081159
firstReactRender--1291821315
initialActions--102012
loadScripts--12911111181912713741483
setupStore--1156881129
numNetworkReqs--221283171873
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29652212431846031603952
load--16201254250230817482333
domContentLoaded--16191254250130717482333
domInteractive--14338936165117552
firstPaint--------
backgroundConnect--20596830110245404
firstReactRender--19147072025
initialActions--203123
loadScripts--15681229247429616972308
setupStore--1398725193133601
numNetworkReqs--70351854294178
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--16511390237716817601960
load--14231208209913414991653
domContentLoaded--14221208209913414941653
domInteractive--963043555131162
firstPaint--------
backgroundConnect--66222504663184
firstReactRender--14112421518
initialActions--102022
loadScripts--13861195197311714401588
setupStore--155158201236
numNetworkReqs--231286181879
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--30122227475650630764322
load--16221330284733716302519
domContentLoaded--16211329284733716302519
domInteractive--12336787126113532
firstPaint--------
backgroundConnect--3031141396251293938
firstReactRender--23167582534
initialActions--203123
loadScripts--15711308275431015692314
setupStore--1858831235282736
numNetworkReqs--70342354465173
19--------
📊 Page Load Benchmark Results

Current Commit: f526ca5 | Date: 1/30/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±38ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±35ms) 🟢 | historical mean value: 721ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±11ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 38ms 1.01s 1.31s 1.08s 1.31s
domContentLoaded 733ms 35ms 700ms 989ms 757ms 989ms
firstPaint 78ms 11ms 60ms 168ms 84ms 168ms
firstContentfulPaint 78ms 11ms 60ms 168ms 84ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 198 Bytes (0%)
  • ui: 1 Bytes (0%)
  • common: 1.2 KiB (0.01%)

@gauthierpetetin gauthierpetetin marked this pull request as draft January 30, 2026 07:40
MajorLift
MajorLift previously approved these changes Jan 30, 2026
Copy link
Contributor

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice LGTM!

@gauthierpetetin gauthierpetetin marked this pull request as ready for review February 2, 2026 12:46
@gauthierpetetin gauthierpetetin marked this pull request as draft February 2, 2026 12:47
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 2, 2026

Builds ready [cbb9c64]
UI Startup Metrics (1355 ± 87 ms)
PlatformBuildTypePageMetricTest Title (ms)Persona (ms)Mean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--1355115016498714241478
load--116597014318712411291
domContentLoaded--116096514208612361283
domInteractive--2615117202284
firstPaint--151631152123188322
backgroundConnect--23021227413235262
firstReactRender--17103441927
initialActions--106114
loadScripts--94573611958710151072
setupStore--1262851423
numNetworkReqs--221583181575
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--19531631238714720392273
load--11391020169913711311507
domContentLoaded--11231009169013411141497
domInteractive--36191502536106
firstPaint--1716946684236317
backgroundConnect--32327949836331399
firstReactRender--24156082445
initialActions--102112
loadScripts--88677714081228781229
setupStore--1564151923
numNetworkReqs--1284825355150245
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--88167611931119451080
load--7416071092107811951
domContentLoaded--7366031084106806945
domInteractive--2616105182379
firstPaint--1056223043122196
backgroundConnect--3718149264381
firstReactRender--16113561731
initialActions--102112
loadScripts--7336011082106801942
setupStore--1163541221
numNetworkReqs--221588181575
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--1264831191022214141718
load--71261011041087091022
domContentLoaded--70260210961086971016
domInteractive--34181402434103
firstPaint--15968967117196289
backgroundConnect--16212934247161288
firstReactRender--22163232429
initialActions--103111
loadScripts--69960010881066951007
setupStore--1243441417
numNetworkReqs--1254926458156258
19--------
FirefoxBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--17281452234819418312117
load--14391221181914115561764
domContentLoaded--14381220181914115561763
domInteractive--72332314093147
firstPaint--------
backgroundConnect--842823850123174
firstReactRender--13102521416
initialActions--103122
loadScripts--13921178173612414681663
setupStore--2362674314116
numNetworkReqs--231288191879
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29602205512353730524126
load--15711232263930416842306
domContentLoaded--15711232263330316832306
domInteractive--11824720116118367
firstPaint--------
backgroundConnect--3171151411271317905
firstReactRender--18142621922
initialActions--213122
loadScripts--15231209249327216202163
setupStore--1298790198109648
numNetworkReqs--72381874299179
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--16901406225217618022057
load--14541227196313415121685
domContentLoaded--14541226196313415121684
domInteractive--883120341130152
firstPaint--------
backgroundConnect--68242223985145
firstReactRender--14112821517
initialActions--103122
loadScripts--14171207183111914671652
setupStore--184232301469
numNetworkReqs--231283191979
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29242212429344730734111
load--16131259264931217552382
domContentLoaded--16131259264931217552381
domInteractive--12031943144103510
firstPaint--------
backgroundConnect--3161051383259319939
firstReactRender--22156572429
initialActions--2045423
loadScripts--15621240257028417112216
setupStore--1879890238287760
numNetworkReqs--70352054387182
19--------
📊 Page Load Benchmark Results

Current Commit: cbb9c64 | Date: 2/2/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 723ms (±36ms) 🟢 | historical mean value: 719ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±12ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.01s 1.31s 1.08s 1.31s
domContentLoaded 723ms 36ms 699ms 975ms 756ms 975ms
firstPaint 76ms 12ms 56ms 176ms 84ms 176ms
firstContentfulPaint 76ms 12ms 56ms 176ms 84ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 205 Bytes (0%)
  • ui: 10 Bytes (0%)
  • common: 1.19 KiB (0.01%)

@MajorLift MajorLift linked an issue Feb 2, 2026 that may be closed by this pull request
9 tasks
@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Feb 2, 2026
@gauthierpetetin gauthierpetetin added this pull request to the merge queue Feb 2, 2026
Merged via the queue into main with commit 4da8cf9 Feb 2, 2026
180 checks passed
@gauthierpetetin gauthierpetetin deleted the feat/track-platform-in-segment-2 branch February 2, 2026 17:52
@github-project-automation github-project-automation bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Feb 2, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2026
@metamaskbot metamaskbot added the release-13.18.0 Issue or pull request that will be included in release 13.18.0 label Feb 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.18.0 Issue or pull request that will be included in release 13.18.0 size-M team-extension-platform Extension Platform team

Projects

Archived in project

5 participants