Skip to content

refactor(analytics): C3-d migrate Bridge hook analytics from useMetrics to useAnalytics#27985

Merged
NicolasMassart merged 2 commits into
mainfrom
refactor/26686_c3_bridge-hook
Mar 27, 2026
Merged

refactor(analytics): C3-d migrate Bridge hook analytics from useMetrics to useAnalytics#27985
NicolasMassart merged 2 commits into
mainfrom
refactor/26686_c3_bridge-hook

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Description

Replaces the deprecated useMetrics hook with the new useAnalytics hook in useGoToPortfolioBridge.ts.

This is part of the broader C3 analytics migration (#26686) that standardises all analytics calls across the mobile app to use the new useAnalytics abstraction instead of useMetrics. The hook interface is identical (trackEvent, createEventBuilder), so no behaviour changes.

Changelog

CHANGELOG entry: null

Related issues

Refs: #26814

Manual testing steps

N/A

Screenshots/Recordings

Before

N/A

After

N/A

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
Low risk: swaps analytics hook wiring and adds legacy action/name properties to the emitted event, without changing navigation or URL-building logic.

Overview
Updates useGoToPortfolioBridge to use the new useAnalytics hook instead of deprecated useMetrics for BRIDGE_LINK_CLICKED tracking.

Also explicitly adds legacy action and name properties to the tracked event payload to preserve existing analytics fields during the migration.

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

@NicolasMassart NicolasMassart self-assigned this Mar 26, 2026
@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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Mar 26, 2026
@NicolasMassart NicolasMassart changed the title refactor: migrate Bridge hook analytics from useMetrics to useAnalytics refactor(analytics): C3d migrate Bridge hook analytics from useMetrics to useAnalytics Mar 26, 2026
@NicolasMassart NicolasMassart changed the title refactor(analytics): C3d migrate Bridge hook analytics from useMetrics to useAnalytics refactor(analytics): C3-d migrate Bridge hook analytics from useMetrics to useAnalytics Mar 26, 2026
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Mar 26, 2026
@NicolasMassart NicolasMassart marked this pull request as ready for review March 27, 2026 10:44
@NicolasMassart NicolasMassart requested a review from a team as a code owner March 27, 2026 10:44

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/UI/Bridge/hooks/useGoToPortfolioBridge.ts
Comment thread app/components/UI/Bridge/hooks/useGoToPortfolioBridge.ts
chatgpt-codex-connector[bot]

This comment was marked as outdated.

@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change in useGoToPortfolioBridge.ts is a focused analytics refactoring:

  1. Switches from useMetrics to useAnalytics hook for event tracking
  2. Adds two legacy properties (action: 'Bridge' and name: 'Bridge') to the BRIDGE_LINK_CLICKED analytics event

The hook is used in the Bridge navigation flow (navigating to the MetaMask Portfolio Bridge webpage). The functional behavior (URL construction, browser tab navigation, chain ID handling) is completely unchanged. Only the analytics tracking mechanism is updated.

Grep confirmed this hook is only referenced in its own file and a unit test file - no broad component usage.

SmokeTrade is selected because it covers cross-chain bridging flows. SmokeConfirmations is included as required by SmokeTrade's tag description (bridge flows require transaction confirmations).

No performance tests are needed as this is a pure analytics hook change with no impact on rendering, data loading, or app startup performance.

Performance Test Selection:
The change is a pure analytics hook swap (useMetrics → useAnalytics) with no impact on UI rendering, data loading, state management, or any performance-sensitive code paths. No performance tests are warranted.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Mar 27, 2026
@NicolasMassart NicolasMassart added this pull request to the merge queue Mar 27, 2026
Merged via the queue into main with commit dfc0f64 Mar 27, 2026
96 checks passed
@NicolasMassart NicolasMassart deleted the refactor/26686_c3_bridge-hook branch March 27, 2026 17:56
@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 Mar 27, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-low Low testing needed · Low bug introduction risk size-XS team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants