Skip to content

fix(engagement): gate marketing-consent sheet on MetaMetrics cp-7.80.0#31028

Merged
Montoya merged 2 commits into
mainfrom
ge-217-pre-prompt-account-for-metametrics
Jun 3, 2026
Merged

fix(engagement): gate marketing-consent sheet on MetaMetrics cp-7.80.0#31028
Montoya merged 2 commits into
mainfrom
ge-217-pre-prompt-account-for-metametrics

Conversation

@samir-acle

@samir-acle samir-acle commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

Previously, the push onboarding sheets could trigger analytics.optIn() when MetaMetrics was off, effectively using the marketing-consent flow to enable MetaMetrics in a less than clear way. This is not desired. This PR simplifies the action taken after accepting the push pre-prompt. It reduces the risk of the existing code.

This PR:

  • Adds a isMetaMetricsEnabled gate in usePushPrePromptVariant so the marketing_consent variant is never returned when MetaMetrics is off (the push_permission variant is unaffected)
  • Strips analytics.optIn(), updateCachedConsent(), and the device/user-settings trait generation from useEnableMarketingConsent — the hook now only operates when MetaMetrics is already on
  • Removes is_metrics_opted_in from the ANALYTICS_PREFERENCE_SELECTED event property, since this flow no longer touches metrics opt-in state
  • Adds test coverage for the missing push×MetaMetrics×dataCollection combinations

Changelog

CHANGELOG entry: Remove the ability for the push onboarding flow to toggle MetaMetrics opt-in state.

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

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

@github-actions

github-actions Bot commented Jun 3, 2026

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.

@samir-acle samir-acle changed the title fix(engagement): gate marketing-consent sheet on MetaMetrics being en… fix(engagement): gate marketing-consent sheet on MetaMetrics Jun 3, 2026
@github-actions github-actions Bot added the size-M label Jun 3, 2026
@samir-acle samir-acle changed the title fix(engagement): gate marketing-consent sheet on MetaMetrics fix(engagement): gate marketing-consent sheet on MetaMetrics cp-7.80.0 Jun 3, 2026
@samir-acle samir-acle marked this pull request as ready for review June 3, 2026 17:29
@samir-acle samir-acle requested a review from a team as a code owner June 3, 2026 17:29
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 3, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

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: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are confined to two notification utility hooks:

  1. useEnableMarketingConsent.ts: Simplified to be a no-op when MetaMetrics is disabled. Removed the ability to call analytics.optIn(), updateCachedConsent(), or trigger metrics opt-in from push onboarding sheets. This is a behavioral fix to prevent push notification sheets from acting as a backdoor to enable MetaMetrics.

  2. usePushPrePromptVariant.ts: Added a guard using selectAnalyticsEnabled to prevent the marketing consent prompt variant from appearing when MetaMetrics is off. Added isMetaMetricsEnabled to the eligibility state.

Both changes are:

  • Internal to the push notification onboarding flow (PushNotificationOnboarding components)
  • Covered by updated unit tests in the accompanying .test.ts files
  • Not touching any core wallet functionality (accounts, transactions, networks, swaps, etc.)
  • Not affecting any shared components like TabBar, navigation, modals, or confirmations that could break existing E2E tests

None of the available E2E test tags cover push notification pre-prompt variants or marketing consent flows specifically. The changes don't affect any flows tested by SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, or SmokeSnaps in a meaningful way.

Performance Test Selection:
The changes are purely behavioral logic fixes in notification hooks. No UI rendering, list components, data loading, state management at scale, or performance-sensitive code paths are affected. No performance tests are warranted.

View GitHub Actions results

@samir-acle samir-acle enabled auto-merge June 3, 2026 17:49
@samir-acle samir-acle added this pull request to the merge queue Jun 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 3, 2026
@Montoya Montoya added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 9ff8bd7 Jun 3, 2026
158 checks passed
@Montoya Montoya deleted the ge-217-pre-prompt-account-for-metametrics branch June 3, 2026 20:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:medium AI analysis: medium risk size-M team-engagement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants