Skip to content

fix: set unset OPTIN_META_METRICS_UI_SEEN at onboarding SL-467#24979

Merged
ieow merged 4 commits intomainfrom
cw/set-unset-OPTIN_META_METRICS_UI_SEEN
Jan 23, 2026
Merged

fix: set unset OPTIN_META_METRICS_UI_SEEN at onboarding SL-467#24979
ieow merged 4 commits intomainfrom
cw/set-unset-OPTIN_META_METRICS_UI_SEEN

Conversation

@ieow
Copy link
Copy Markdown
Contributor

@ieow ieow commented Jan 21, 2026

Description

Add set OPTIN_META_METRICS_UI_SEEN at onboarding for seedless onboarding
Add unset OPTIN_META_METRICS_UI_SEEN for create srp wallet onboarding flow

OPTIN_META_METRICS_UI_SEEN flag is used to track if the optin metric screen is been seen by user during srp wallet creation.
For seedless onboarding where optin metric defaulted, OPTIN_META_METRICS_UI_SEEN should be set instead of checking seedless onboarding flow flag in the login screen

Changelog

CHANGELOG entry: set OPTIN_META_METRICS_UI_SEEN flag when user login with social login
CHANGELOG entry: unset OPTIN_META_METRICS_UI_SEEN flag when user create srp wallet

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Introduces a small utility to manage the metrics opt-in UI flag and wires it into onboarding flows for correct behavior across SRP and social login paths.

  • Adds util/metrics/metricsOptInUIUtils with markMetricsOptInUISeen and resetMetricsOptInUISeen (with error logging)
  • Updates OptinMetrics to call markMetricsOptInUISeen() when continuing instead of writing to storage directly
  • Updates Onboarding:
    • Calls resetMetricsOptInUISeen() when starting "Create Wallet" or "Import Wallet" to re-show consent
    • Calls markMetricsOptInUISeen() after successful OAuth login (metrics auto-enabled)
  • Adds unit tests for the new utils in metricsOptInUIUtils.test.ts

Written by Cursor Bugbot for commit cc06677. 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-onboarding Onboarding team label Jan 21, 2026
@ieow ieow marked this pull request as ready for review January 22, 2026 08:47
@ieow ieow requested review from a team as code owners January 22, 2026 08:47
@github-actions github-actions bot added size-M and removed size-S labels Jan 22, 2026
@ieow ieow changed the title fix: set unset OPTIN_META_METRICS_UI_SEEN at onboarding fix: set unset OPTIN_META_METRICS_UI_SEEN at onboarding SL-467 Jan 22, 2026
cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The PR introduces a new utility module metricsOptInUIUtils.ts that centralizes the logic for marking/resetting the metrics opt-in UI seen flag. The changes affect:

  1. OptinMetrics component: Refactored to use the new utility function instead of direct storage calls - this is a low-risk refactor that maintains the same behavior.

  2. Onboarding component: Added calls to reset the metrics opt-in flag when starting create/import wallet flows, and mark it as seen after OAuth success. This ensures users see the consent screen when starting a new wallet flow.

  3. Unit tests: Comprehensive tests added for the new utility functions.

The E2E tests in e2e/specs/analytics/ (new-wallet.spec.ts and import-wallet.spec.ts) are tagged with SmokeWalletPlatform and directly test the analytics events during wallet creation and import flows. These tests verify that:

  • Analytics events are tracked when users opt-in to metrics
  • No analytics events are tracked when users opt-out

Since the changes modify the onboarding flow and metrics consent handling, running SmokeWalletPlatform tests will validate that:

  • Wallet creation flow still works correctly
  • Wallet import flow still works correctly
  • Analytics opt-in/opt-out behavior is preserved

The risk is medium because while the changes are well-structured refactoring with proper error handling, they touch the onboarding flow which is critical for new users.

View GitHub Actions results

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.90%. Comparing base (129cc7c) to head (cc06677).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24979      +/-   ##
==========================================
+ Coverage   79.88%   79.90%   +0.01%     
==========================================
  Files        4231     4233       +2     
  Lines      108283   108518     +235     
  Branches    22674    22709      +35     
==========================================
+ Hits        86503    86707     +204     
- Misses      15722    15745      +23     
- Partials     6058     6066       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@grvgoel81 grvgoel81 left a comment

Choose a reason for hiding this comment

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

lgtm

@ieow ieow added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit 45eb4b6 Jan 23, 2026
90 checks passed
@ieow ieow deleted the cw/set-unset-OPTIN_META_METRICS_UI_SEEN branch January 23, 2026 13:50
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2026
@metamaskbot metamaskbot added the release-7.64.0 Issue or pull request that will be included in release 7.64.0 label Jan 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-M team-onboarding Onboarding team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants