chore(runway): cherry-pick fix: add metrics opt In event cp-7.71.0#27868
Conversation
<!--
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 -->
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
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:
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: |
|
|
✅ E2E Fixture Validation — Schema is up to date |



Description
MetaMetricsAndDataCollectionSection screen
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
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_INevent and emits itwhenever users enable metrics, including the onboarding opt-in screen
(
location: onboarding_metametrics), social login onboarding flow(
location: onboarding_social_login), and the settings MetaMetricstoggle (
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 verifyingupdated_after_onboardingand optionalaccount_typeproperties.Written by Cursor
Bugbot for commit
9968f73. Configure
here.