Skip to content

refactor(analytics): migrate Batch 3-14: mobile-platform#26588

Merged
NicolasMassart merged 4 commits into
mainfrom
refactor/MCWP-297_analytics_migration_batch_3-14_mobile-platform
Feb 27, 2026
Merged

refactor(analytics): migrate Batch 3-14: mobile-platform#26588
NicolasMassart merged 4 commits into
mainfrom
refactor/MCWP-297_analytics_migration_batch_3-14_mobile-platform

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 analytics migration (Batch 3-14): migrate Legal/Onboarding's terms-of-use utilities from MetaMetrics.getInstance() to the new analytics system.

Reason: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController.

Changes: termsOfUse.ts now uses analytics.trackEvent() and AnalyticsEventBuilder from app/util/analytics; test mocks updated to mock the analytics utility instead of MetaMetrics.getInstance().

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-302 (Batch 3-14)

Manual testing steps

Feature: Legal/Onboarding analytics

  Scenario: user triggers a terms of use flow event
    Given app is open and user has not yet accepted terms of use

    When user performs an action that triggers analytics (e.g. terms of use shown, terms accepted)
    Then the event is tracked on Mixpanel

Screenshots/Recordings

N/A – analytics migration, no UI change.

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 refactor that swaps the event tracking implementation for terms-of-use shown/accepted; behavior should be equivalent but could impact whether/when these two events are emitted if the new analytics queueing differs from MetaMetrics.getInstance().

Overview
Migrates terms-of-use analytics emission from MetaMetrics.getInstance().trackEvent/MetricsEventBuilder to the shared analytics.trackEvent helper with AnalyticsEventBuilder for the USER_TERMS_SHOWN and USER_TERMS_ACCEPTED events.

Updates termsOfUse unit tests to mock app/util/analytics/analytics and assert calls to analytics.trackEvent instead of mocking MetaMetrics.

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

@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 Feb 25, 2026
@NicolasMassart NicolasMassart requested a review from a team February 25, 2026 17:52
@NicolasMassart NicolasMassart self-assigned this Feb 25, 2026
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 25, 2026

@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 1 potential issue.

Comment thread app/util/termsOfUse/termsOfUse.ts
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are a pure refactoring of analytics imports in the termsOfUse module:

  1. Replacing MetaMetrics.getInstance().trackEvent() with analytics.trackEvent()
  2. Replacing MetricsEventBuilder with AnalyticsEventBuilder

This is an internal code refactoring that:

  • Does not change any user-facing functionality
  • Does not modify the analytics events being tracked (USER_TERMS_ACCEPTED, USER_TERMS_SHOWN remain the same)
  • Only changes the import paths and method calls for analytics
  • Updates the corresponding test file to match the new implementation

The termsOfUse module is used by ModalMandatory component for displaying Terms of Use modal, but no E2E tests specifically target this flow. The changes are purely internal refactoring with no functional impact, making E2E testing unnecessary.

Performance Test Selection:
No performance impact - this is a pure refactoring of analytics imports. No UI rendering changes, no data loading changes, no state management changes. The analytics tracking calls remain functionally identical, just using a different import path.

View GitHub Actions results

@Cal-L Cal-L 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

@NicolasMassart NicolasMassart added this pull request to the merge queue Feb 27, 2026
@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 27, 2026
Merged via the queue into main with commit 3424cca Feb 27, 2026
59 checks passed
@NicolasMassart NicolasMassart deleted the refactor/MCWP-297_analytics_migration_batch_3-14_mobile-platform branch February 27, 2026 19:54
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants