feat: analytics pref tracking for social onboarding cp-13.25.0#41343
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (1 files, +3 -2)
🔐 @MetaMask/web3auth (3 files, +25 -11)
|
…racking-for-social-users
Builds ready [e126531]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [4cd8e8b]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [4bc52dd]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
…racking-for-social-users
…sic-functionality
|
Builds ready [1223d6d]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 1 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|




Description
This PR closes a gap in
Analytics Preference Selectedtracking for social login users and makes the event payload consistent across the other consent surfaces.Social login users do not go through the standard onboarding MetaMetrics screen, so this adds tracking when they make that preference implicitly during create-password onboarding and when returning social-login users are rehydrated from backup. It also aligns the standard onboarding, settings, and home consent flows to use the same
MetaMetricsUserTraitpayload fields, and adds unit coverage for the social backup restore path.This PR also fixes ~
participateInMetaMetrics === trueas “ready to send”, even when metaMetricsId had not been created yet.Analytics Preference Selectedto go down the immediate-send path and get dropped by the background layer before it could reach Segment.addEventBeforeMetricsOptIn, which matches the real onboarding flow better.Changelog
CHANGELOG entry: null
Related issues
Fixes: #41378
Manual testing steps
Analytics Preference Selectedfires withlocation: onboarding_metametricsand the expected consent values.location: onboarding_create_passwordand the correcthas_marketing_consentvalue.location: onboarding_social_login_rehydrationafter marketing consent is synced from background state.Analytics Preference Selecteduses the standardized user trait fields and expected opt-in / consent values.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes MetaMetrics event dispatch conditions and adds new onboarding tracking paths, which could affect when/if analytics events are sent during critical onboarding flows. Test updates and new provider unit coverage reduce risk but regressions could still drop or duplicate events.
Overview
Adds missing
AnalyticsPreferenceSelectedtracking for social login users duringcreate-passwordand during social-backup rehydration, and wirestrackEventthroughrestoreSocialBackupAndGetSeedPhraseto emit the event after marketing-consent sync.Fixes a metrics dispatch race by making
MetaMetricsProvideronly send events immediately when bothparticipateInMetaMetricsis enabled and ametaMetricsIdexists; otherwise events are buffered viaaddEventBeforeMetricsOptIn(exceptMetricsOptOut).Standardizes consent-related event properties across onboarding, Home, and Settings to use
MetaMetricsUserTraitkeys, and updates/extends tests (newui/contexts/metametrics.test.tsx, integration/e2e fixtures, and additional API nocks) plus console baselines accordingly.Written by Cursor Bugbot for commit 1223d6d. This will update automatically on new commits. Configure here.