Skip to content

Conversation

@huggingbot
Copy link

Description

This PR implements analytics tracking enhancements across onboarding and authentication flows by integrating a unified event buffering system and adding comprehensive wallet lifecycle tracking events.

New Analytics Events Added

The following new events were added to shared/constants/metametrics.ts:

Onboarding & Authentication:

  • WalletSetupStarted - When user begins wallet creation flow
  • WalletImportStarted - When user begins wallet import flow
  • WalletImportAttempted - When user attempts to import with SRP
  • WalletImported - When wallet import succeeds
  • WalletCreationAttempted - When user attempts to create new wallet
  • WalletCreated - When new wallet creation succeeds
  • WalletSetupCompleted - When overall wallet setup completes
  • WalletSetupFailure - When wallet setup fails
  • WalletLoginSelected - When existing user selects social login
  • WalletLoginCompleted - When existing user social login succeeds
  • WalletRehydrationAttempted - When social login user attempts to unlock
  • WalletRehydrationCompleted - When social login unlock succeeds
  • WalletRehydrationFailed - When social login unlock fails

SRP & Security:

  • SrpDefinitionClicked - When user clicks "What is a Secret Recovery Phrase?"
  • ExternalLinkClicked - Enhanced to track "Learn More" links during onboarding

Settings & Password:

  • PasswordChanged - When user successfully changes password
  • ForgotPassword - When user clicks "Forgot Password"
  • ResetWallet - When user confirms wallet reset

Enhanced Event Buffering System

Modified the following components to integrate event buffering for pre-analytics-consent tracking:

Core MetaMetrics Infrastructure:

  • MetaMetricsProvider - Added buffering logic to store events before opt-in
  • metametrics.js - Added event flushing when user consents to analytics
  • metamask-controller.js - Added buffering controller methods

Onboarding Components:

  • CreatePassword - Added wallet lifecycle tracking and learn more link analytics
  • ImportSRP - Added SRP definition click tracking with location context
  • ReviewRecoveryPhrase - Added SRP definition click tracking
  • SecureYourWallet - Added SRP definition click tracking
  • Welcome - Enhanced with social login provider tracking and account type properties
  • AccountExist - Added wallet import flow tracking for social users
  • AccountNotFound - Added wallet setup flow tracking for social users
  • OnboardingMetametrics - Added event buffer flushing on opt-in

Authentication Components:

  • UnlockPage - Added comprehensive social login rehydration tracking
  • ChangePassword - Added password change event tracking

@github-actions
Copy link

github-actions bot commented Jun 2, 2025

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.

trackEvent(
{
category: MetaMetricsEventCategory.Onboarding,
event: MetaMetricsEventName.WalletSetupStarted,
Copy link
Author

@huggingbot huggingbot Jun 2, 2025

Choose a reason for hiding this comment

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

this event was removed because it's used in welcome.js instead, which is consistent with mobile.

In welcome.js, WalletSetupStarted replaces OnboardingWalletCreationStarted, because both of them have the same clashing value (Wallet Setup Selected), and the key WalletSetupStarted has a consistent naming as mobile. The value of WalletSetupStarted is now changed from Wallet Setup Selected to Wallet Setup Started, which is consistent with mobile.

NftAdded = 'NFT Added',
OnboardingWalletCreationStarted = 'Wallet Setup Selected',
OnboardingWalletImportStarted = 'Wallet Import Started',
OnboardingWalletCreationAttempted = 'Wallet Password Created',
Copy link
Author

Choose a reason for hiding this comment

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

These are unused or replaced with Wallet* events

OnboardingWalletSecurityPhraseWrittenDown = 'SRP Backup Confirm Display',
OnboardingWalletSecurityPhraseConfirmed = 'SRP Backup Confirmed',
OnboardingWalletCreationComplete = 'Wallet Created',
OnboardingWalletCreationComplete = 'Onboarding Wallet Created',
Copy link
Author

Choose a reason for hiding this comment

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

there is already a Wallet Created value under the WalletCreated key, hence this value was renamed

metaMetricsController.clearEventsAfterMetricsOptIn.bind(
metaMetricsController,
),

Copy link
Author

@huggingbot huggingbot Jun 2, 2025

Choose a reason for hiding this comment

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

we're just exposing an existing implementation. Not sure why it wasn't exposed. These methods were unused and were probably removed previously, though the implementations were kept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants