From 834b4d822af25d291d52d1d1b1f07c29743da71e Mon Sep 17 00:00:00 2001 From: ghgoodreau Date: Wed, 18 Feb 2026 13:45:10 -0600 Subject: [PATCH 1/3] feat: adds asset picker opened metric event --- packages/bridge-controller/CHANGELOG.md | 4 ++++ .../src/bridge-controller.ts | 1 + .../src/utils/metrics/constants.ts | 1 + .../src/utils/metrics/types.ts | 19 +++++++++++++------ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/bridge-controller/CHANGELOG.md b/packages/bridge-controller/CHANGELOG.md index 30217f37941..2870c735012 100644 --- a/packages/bridge-controller/CHANGELOG.md +++ b/packages/bridge-controller/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add `AssetPickerOpened` unified swap bridge metrics event. ([#7575](https://github.com/MetaMask/core/pull/7575)) + ## [67.0.0] ### Added diff --git a/packages/bridge-controller/src/bridge-controller.ts b/packages/bridge-controller/src/bridge-controller.ts index 1ed63030a80..a2e8dc0c25d 100644 --- a/packages/bridge-controller/src/bridge-controller.ts +++ b/packages/bridge-controller/src/bridge-controller.ts @@ -997,6 +997,7 @@ export class BridgeController extends StaticIntervalPollingController & Omit & @@ -236,14 +239,17 @@ type RequiredEventContextFromClientBase = { /** * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called. - * This combines the event-specific properties from RequiredEventContextFromClientBase - * with an optional `location` property. When `location` is omitted, the controller - * falls back to the value stored via `setLocation()` (defaults to MainView). + * For most events, this combines the event-specific properties from + * RequiredEventContextFromClientBase with an optional `location` property. + * `AssetPickerOpened` is excluded because it uses `location` for + * source/destination in the Segment schema. */ export type RequiredEventContextFromClient = { - [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & { - location?: MetaMetricsSwapsEventSource; - }; + [K in keyof RequiredEventContextFromClientBase]: K extends UnifiedSwapBridgeEventName.AssetPickerOpened + ? RequiredEventContextFromClientBase[K] + : RequiredEventContextFromClientBase[K] & { + location?: MetaMetricsSwapsEventSource; + }; }; /** @@ -298,6 +304,7 @@ export type EventPropertiesFromControllerState = { refresh_count: number; }; [UnifiedSwapBridgeEventName.StatusValidationFailed]: RequestParams; + [UnifiedSwapBridgeEventName.AssetPickerOpened]: null; [UnifiedSwapBridgeEventName.PollingStatusUpdated]: null; }; From d6b157f6fb482540cdac488ddffd4138444bd1af Mon Sep 17 00:00:00 2001 From: ghgoodreau Date: Wed, 18 Feb 2026 13:51:46 -0600 Subject: [PATCH 2/3] fix: property --- .../src/utils/metrics/types.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/bridge-controller/src/utils/metrics/types.ts b/packages/bridge-controller/src/utils/metrics/types.ts index 46be22c376c..2f185519499 100644 --- a/packages/bridge-controller/src/utils/metrics/types.ts +++ b/packages/bridge-controller/src/utils/metrics/types.ts @@ -219,7 +219,7 @@ type RequiredEventContextFromClientBase = { refresh_count: number; }; [UnifiedSwapBridgeEventName.AssetPickerOpened]: { - location: 'source' | 'destination'; + asset_location: 'source' | 'destination'; }; [UnifiedSwapBridgeEventName.PollingStatusUpdated]: TradeData & Pick & @@ -239,17 +239,14 @@ type RequiredEventContextFromClientBase = { /** * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called. - * For most events, this combines the event-specific properties from - * RequiredEventContextFromClientBase with an optional `location` property. - * `AssetPickerOpened` is excluded because it uses `location` for - * source/destination in the Segment schema. + * This combines the event-specific properties from RequiredEventContextFromClientBase + * with an optional `location` property. When `location` is omitted, the controller + * falls back to the value stored via `setLocation()` (defaults to MainView). */ export type RequiredEventContextFromClient = { - [K in keyof RequiredEventContextFromClientBase]: K extends UnifiedSwapBridgeEventName.AssetPickerOpened - ? RequiredEventContextFromClientBase[K] - : RequiredEventContextFromClientBase[K] & { - location?: MetaMetricsSwapsEventSource; - }; + [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & { + location?: MetaMetricsSwapsEventSource; + }; }; /** From edb6e53e8ca0749bc5f84342ac5d34858ae3d24c Mon Sep 17 00:00:00 2001 From: ghgoodreau Date: Wed, 18 Feb 2026 13:56:27 -0600 Subject: [PATCH 3/3] fix: changelog --- packages/bridge-controller/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bridge-controller/CHANGELOG.md b/packages/bridge-controller/CHANGELOG.md index 2870c735012..2432bb407b3 100644 --- a/packages/bridge-controller/CHANGELOG.md +++ b/packages/bridge-controller/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Add `AssetPickerOpened` unified swap bridge metrics event. ([#7575](https://github.com/MetaMask/core/pull/7575)) +- Add `AssetPickerOpened` unified swap bridge metrics event with an `asset_location` property to indicate `'source'` or `'destination'`. ([#7985](https://github.com/MetaMask/core/pull/7985)) ## [67.0.0]