Skip to content

chore(runway): cherry-pick fix: add metrics opt In event cp-7.71.0#27868

Merged
chloeYue merged 1 commit into
release/7.71.0from
runway-cherry-pick-7.71.0-1774360093
Mar 24, 2026
Merged

chore(runway): cherry-pick fix: add metrics opt In event cp-7.71.0#27868
chloeYue merged 1 commit into
release/7.71.0from
runway-cherry-pick-7.71.0-1774360093

Conversation

@runway-github
Copy link
Copy Markdown
Contributor

@runway-github runway-github Bot commented Mar 24, 2026

Description

  • Add Metrics Opt In event in Onboarding, Optinmetrics and
    MetaMetricsAndDataCollectionSection screen

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: METRICS_OPT_IN analytics on user opt-in

  Scenario: User opts in from onboarding MetaMetrics screen
    Given the user is on the onboarding MetaMetrics / data collection screen with basic usage enabled by default

    When the user continues without turning off basic usage
    Then the app completes onboarding as before and analytics pipelines receive a "Metrics Opt In" event with onboarding location and expected properties in addition to "Analytics Preference Selected"

  Scenario: User enables MetaMetrics from Settings
    Given the user is logged in and MetaMetrics is currently off

    When the user opens Settings > Security & privacy and turns the MetaMetrics switch on
    Then the app opts in successfully and emits "Metrics Opt In" with settings location and updated_after_onboarding before the preference-selected event

  Scenario: User enables marketing which requires MetaMetrics
    Given MetaMetrics is off and marketing data collection is off

    When the user turns marketing data collection on (which enables MetaMetrics)
    Then MetaMetrics turns on and "Metrics Opt In" is recorded before the subsequent preference events

Screenshots/Recordings

Before

After

Screenshot 2026-03-24 at 3 35 19 PM
Screenshot 2026-03-24 at 3 36 30 PM
Screenshot 2026-03-24 at 3 40 10 PM

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 analytics-only change that adds an additional tracking call
when users enable metrics (onboarding, social login, and settings). Main
risk is event ordering/duplication affecting downstream dashboards
rather than app behavior.

Overview
Adds a new MetaMetricsEvents.METRICS_OPT_IN event and emits it
whenever users enable metrics, including the onboarding opt-in screen
(location: onboarding_metametrics), social login onboarding flow
(location: onboarding_social_login), and the settings MetaMetrics
toggle (location: settings / onboarding_default_settings).

Updates tests to assert the new opt-in event is sent (and in
settings/onboarding cases is sent before
ANALYTICS_PREFERENCE_SELECTED), including verifying
updated_after_onboarding and optional account_type properties.

Written by Cursor
Bugbot
for commit
9968f73. Configure
here.

[79b1aa8](https://github.com/MetaMask/metamask-mobile/commit/79b1aa88a8bc5618a2a54dc633c34aef844c6a8f)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
* Add Metrics Opt In event in Onboarding, Optinmetrics and
MetaMetricsAndDataCollectionSection screen

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: METRICS_OPT_IN analytics on user opt-in

  Scenario: User opts in from onboarding MetaMetrics screen
    Given the user is on the onboarding MetaMetrics / data collection screen with basic usage enabled by default

    When the user continues without turning off basic usage
    Then the app completes onboarding as before and analytics pipelines receive a "Metrics Opt In" event with onboarding location and expected properties in addition to "Analytics Preference Selected"

  Scenario: User enables MetaMetrics from Settings
    Given the user is logged in and MetaMetrics is currently off

    When the user opens Settings > Security & privacy and turns the MetaMetrics switch on
    Then the app opts in successfully and emits "Metrics Opt In" with settings location and updated_after_onboarding before the preference-selected event

  Scenario: User enables marketing which requires MetaMetrics
    Given MetaMetrics is off and marketing data collection is off

    When the user turns marketing data collection on (which enables MetaMetrics)
    Then MetaMetrics turns on and "Metrics Opt In" is recorded before the subsequent preference events

```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**
<img width="702" height="94" alt="Screenshot 2026-03-24 at 3 35 19 PM"
src="https://github.com/user-attachments/assets/e5177be9-8c93-413b-ae76-8e10c3e50352"
/>
<img width="703" height="50" alt="Screenshot 2026-03-24 at 3 36 30 PM"
src="https://github.com/user-attachments/assets/6da0d4cb-f660-49b9-818e-bb45fe1e413e"
/>
<img width="695" height="91" alt="Screenshot 2026-03-24 at 3 40 10 PM"
src="https://github.com/user-attachments/assets/229e4a2d-80c3-469e-b1a9-639df7068c17"
/>

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk analytics-only change that adds an additional tracking call
when users enable metrics (onboarding, social login, and settings). Main
risk is event ordering/duplication affecting downstream dashboards
rather than app behavior.
> 
> **Overview**
> Adds a new `MetaMetricsEvents.METRICS_OPT_IN` event and emits it
whenever users enable metrics, including the onboarding opt-in screen
(`location: onboarding_metametrics`), social login onboarding flow
(`location: onboarding_social_login`), and the settings MetaMetrics
toggle (`location: settings` / `onboarding_default_settings`).
> 
> Updates tests to assert the new opt-in event is sent (and in
settings/onboarding cases is sent *before*
`ANALYTICS_PREFERENCE_SELECTED`), including verifying
`updated_after_onboarding` and optional `account_type` properties.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9968f73. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github Bot requested review from a team as code owners March 24, 2026 13:48
@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-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Mar 24, 2026
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes in this PR are focused on analytics event tracking:

  1. MetaMetrics.events.ts: Added a new METRICS_OPT_IN event enum and event object (alongside existing METRICS_OPT_OUT). This is purely additive.

  2. OptinMetrics/index.tsx: Changed from only tracking opt-out to tracking both opt-in AND opt-out during the onboarding metrics consent screen. The UI/navigation behavior is unchanged.

  3. Onboarding/index.tsx: Added METRICS_OPT_IN tracking for social login onboarding flow. The accountType variable was moved earlier in the function to support this. Core onboarding logic is unchanged.

  4. MetaMetricsAndDataCollectionSection.tsx: Added METRICS_OPT_IN tracking when user enables analytics from Settings. No UI changes.

  5. Test files: Unit tests updated to reflect new event tracking order/calls.

Why SmokeWalletPlatform: This tag covers "wallet lifecycle analytics tracking for new wallet creation and SRP import events" - the onboarding flow analytics changes directly relate to this. The OptinMetrics screen and Onboarding screen are part of the wallet creation/import lifecycle.

Why not other tags:

  • No changes to transaction flows (SmokeConfirmations, SmokeTrade not needed)
  • No changes to account management (SmokeAccounts not needed)
  • No changes to network management (SmokeNetworkAbstractions not needed)
  • No changes to Settings UI behavior (just analytics tracking added)
  • The changes are additive analytics events with no functional behavior changes

The risk is low because: (1) only analytics events are added, (2) no UI or navigation changes, (3) no controller or core engine changes, (4) the new event is purely additive and won't break existing flows.

Performance Test Selection:
No performance-impacting changes. The PR only adds analytics event tracking calls (trackEvent) which are fire-and-forget operations. No UI rendering changes, no list components modified, no data loading changes, no state management changes, and no app startup/initialization changes. Performance tests are not warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chloeYue chloeYue merged commit 6db5885 into release/7.71.0 Mar 24, 2026
89 of 91 checks passed
@chloeYue chloeYue deleted the runway-cherry-pick-7.71.0-1774360093 branch March 24, 2026 14:45
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants