Skip to content

refactor(analytics): C5 migrate to useAnalytics in PredictGTMModal#27923

Merged
NicolasMassart merged 1 commit into
mainfrom
refactor/26686_c5_predict
Mar 26, 2026
Merged

refactor(analytics): C5 migrate to useAnalytics in PredictGTMModal#27923
NicolasMassart merged 1 commit into
mainfrom
refactor/26686_c5_predict

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Description

Part of the analytics C5 migration phase: replaces useMetrics with the new useAnalytics hook in PredictGTMModal.

The useMetrics hook is being deprecated in favour of useAnalytics, which provides the same trackEvent / createEventBuilder API through a unified interface. This commit updates the component and its unit test to use the new hook and the createMockUseAnalyticsHook test helper.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #27883

Manual testing steps

N/A — pure internal refactor with no user-facing behaviour change. Existing unit tests cover the analytics event firing.

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 internal refactor that swaps the analytics hook used by PredictGTMModal; behavior should be unchanged aside from potential wiring/mocking issues in event tracking.

Overview
Updates PredictGTMModal to use the new useAnalytics hook instead of useMetrics while keeping the same trackEvent/createEventBuilder flow for the modal’s analytics events.

Refactors PredictGTMModal.test.tsx accordingly by mocking useAnalytics and using the shared createMockUseAnalyticsHook helper, plus minor jest mocking cleanup for StorageWrapper.getItem.

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

Migrates PredictGTMModal from useMetrics to useAnalytics hook.
Part of the analytics cleanup workstream (#26686).
@NicolasMassart NicolasMassart self-assigned this Mar 25, 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 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - draft PR

All E2E tests pre-selected.

View GitHub Actions results

@NicolasMassart NicolasMassart changed the title refactor(analytics): migrate useMetrics to useAnalytics in PredictGTMModal refactor(analytics): C5 migrate to useAnalytics in PredictGTMModal Mar 25, 2026
@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

@NicolasMassart NicolasMassart marked this pull request as ready for review March 25, 2026 17:52
@NicolasMassart NicolasMassart requested a review from a team as a code owner March 25, 2026 17:52
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Mar 26, 2026

@caieu caieu 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.

LGTM

@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 26, 2026
@NicolasMassart NicolasMassart added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 048febe Mar 26, 2026
225 of 227 checks passed
@NicolasMassart NicolasMassart deleted the refactor/26686_c5_predict branch March 26, 2026 14:55
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 26, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 size-S team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

PR C5 migrate useMetrics to useAnalytics in Predict

3 participants