Skip to content

refactor(analytics): migrate Batch 3-17: mobile-platform#26679

Merged
NicolasMassart merged 3 commits into
mainfrom
refactor/MCWP-297_analytics_migration_batch_3-17_mobile-platform
Feb 28, 2026
Merged

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

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 analytics migration (Batch 3-17): migrate Sample Feature's components and hooks from useMetrics/MetricsEventBuilder to the new useAnalytics/AnalyticsEventBuilder analytics system.

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

Changes: SamplePetNamesForm, SampleCounterPane, and SampleFeatureDevSettingsEntryPoint now use useAnalytics() from app/components/hooks/useAnalytics/useAnalytics and createEventBuilder from the hook instead of useMetrics() and MetricsEventBuilder; test mocks updated to mock the useAnalytics hook with a chainable builder instead of useMetrics.

Changelog

CHANGELOG entry: null

Related issues

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

Manual testing steps

Feature: Sample Feature analytics

  Scenario: user triggers a Sample Feature flow event
    Given app is open and user is in a Sample Feature flow

    When user performs an action that triggers analytics (e.g. increment counter, add pet name, navigate to sample feature)
    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: this is a refactor of analytics event building/tracking in a non-production sample feature, with corresponding unit test updates. Main risk is mis-tracked or missing events due to the new builder/mocking semantics.

Overview
Updates SampleFeature event tracking to use useAnalytics() and its createEventBuilder instead of useMetrics()/MetricsEventBuilder in SampleCounterPane, SamplePetNamesForm, and the dev-settings entry point.

Adjusts analytics event definitions (analytics/events.ts) and rewrites unit tests to mock/verify the new useAnalytics hook and builder chaining, plus updates SampleFeature docs/e2e docs to refer to Analytics (not MetaMetrics).

Written by Cursor Bugbot for commit 2dce2e4. 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 27, 2026
@NicolasMassart NicolasMassart requested a review from a team February 27, 2026 10:23
@NicolasMassart NicolasMassart self-assigned this Feb 27, 2026
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 27, 2026
@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: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are entirely within the SampleFeature directory, which is a development/demo feature only accessible through Developer Options settings. The changes consist of:

  1. Documentation updates renaming "MetaMetrics" to "Analytics" - purely cosmetic
  2. Refactoring from useMetrics hook to useAnalytics hook in 3 component files
  3. Updating test files to use the new mock pattern

Key factors for no E2E tests needed:

  • SampleFeature is NOT a production feature - it's a reference implementation for developers
  • The useAnalytics hook already exists and is tested separately
  • No production user flows are affected
  • Changes are isolated to the SampleFeature directory
  • The actual analytics tracking behavior remains the same - only the hook import changed
  • No changes to any shared components, navigation, or core functionality

This is a straightforward internal refactoring with no user-facing impact.

Performance Test Selection:
No performance tests needed. The changes are purely refactoring from one analytics hook to another within an isolated development/demo feature (SampleFeature). There are no changes to UI rendering, data loading, state management, or any critical user flows. The hook swap has no performance implications.

View GitHub Actions results

Cal-L
Cal-L approved these changes 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

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

Accidentally approved. LMK once it's ready and I can approve

@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Needs more work from the author in PR review queue Feb 27, 2026
@NicolasMassart NicolasMassart requested a review from Cal-L February 27, 2026 19:18

@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 28, 2026
@github-project-automation github-project-automation Bot moved this from Needs more work from the author to Review finalised - Ready to be merged in PR review queue Feb 28, 2026
Merged via the queue into main with commit fad4a12 Feb 28, 2026
61 checks passed
@NicolasMassart NicolasMassart deleted the refactor/MCWP-297_analytics_migration_batch_3-17_mobile-platform branch February 28, 2026 05:03
@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 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 28, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Feb 28, 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-M team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants