Skip to content

feat: add social login dismiss event and account_type gaps#30529

Merged
grvgoel81 merged 7 commits into
mainfrom
feat/TO-754-telegram-events
May 22, 2026
Merged

feat: add social login dismiss event and account_type gaps#30529
grvgoel81 merged 7 commits into
mainfrom
feat/TO-754-telegram-events

Conversation

@grvgoel81

@grvgoel81 grvgoel81 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

Social login onboarding analytics had gaps: several events were missing account_type, and there was no dedicated signal when a user abandoned the provider auth UI before completing login (especially Telegram and cross-provider cancel flows)

This PR:

  1. Adds Social Login Auth Browser Dismissed (SOCIAL_LOGIN_AUTH_BROWSER_DISMISSED) with:
  • account_type (best-effort via getSocialAccountType)
  • surface (onboarding | rehydration)
  • elapsed_ms
  1. Fills account_type gaps on:
  • Account Already Exists Page Viewed / Account Not Found Page Viewed
  • Wallet Setup Failure in ChoosePassword for social login flows
  1. Improves cancel detection so dismiss tracking works across providers:
  • Shared helpers: isOAuthUserCancellationMessage, isSocialLoginAuthSessionDismissed
  • Broader Android Google ACM cancel mapping (canceled, One Tap cancel, resolved cancel result)
  • iOS Apple ERR_REQUEST_CANCELED and additional cancel messages

Jira: https://consensyssoftware.atlassian.net/browse/TO-754

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: Social login onboarding analytics

 Scenario: User dismisses Google login on iOS during wallet creation
    Given the user is on onboarding and opts in to analytics
    And the user taps "Continue with Google" to create a wallet

    When the user closes the in-app auth browser before login completes
    Then "Social Login Auth Browser Dismissed" is tracked with account_type "metamask_google", surface "onboarding", and elapsed_ms
    And "Social Login Failed" is tracked with failure_type "user_cancelled"

  Scenario: User dismisses Apple login on iOS during wallet creation
    Given the user is on onboarding and opts in to analytics
    And the user taps "Continue with Apple" to create a wallet

    When the user cancels the native Apple sign-in sheet
    Then "Social Login Auth Browser Dismissed" is tracked with account_type "metamask_apple" and surface "onboarding"

  Scenario: User dismisses Google login on Android during wallet creation
    Given the user is on onboarding on Android and opts in to analytics
    And the user taps "Continue with Google" to create a wallet

    When the user cancels the Google credential / One Tap UI or dismisses the browser fallback
    Then "Social Login Auth Browser Dismissed" is tracked with account_type "metamask_google" and surface "onboarding"

Screenshots/Recordings

Before

After

Screenshot 2026-05-21 at 6 47 48 PM Screenshot 2026-05-21 at 7 34 54 PM Screenshot 2026-05-21 at 7 35 10 PM

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.

Note

Medium Risk
Adds new analytics events and modifies OAuth provider cancellation/error classification on Android and iOS, which could change how login failures are surfaced and tracked. Risk is moderate because it touches cross-platform OAuth handlers and centralized OAuthService error handling, but does not alter auth token exchange logic.

Overview
Adds a new MetaMetrics event SOCIAL_LOGIN_AUTH_BROWSER_DISMISSED and emits it from OAuthService when provider auth is cancelled/dismissed (with account_type, surface, and elapsed_ms).

Fills account_type gaps for AccountStatus page-view + wallet setup/import start events and for ChoosePassword WALLET_SETUP_FAILURE tracking during social-login flows.

Refactors cancel detection into shared helpers (isOAuthUserCancellationMessage, isSocialLoginAuthSessionDismissed) and expands Android Google + iOS Apple handlers to classify more cancel/dismiss outcomes (including resolved cancel results and additional message/code patterns), with updated/added unit tests.

Reviewed by Cursor Bugbot for commit 4a231c8. Configure here.

@grvgoel81 grvgoel81 self-assigned this May 21, 2026
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 21, 2026
@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.

@grvgoel81 grvgoel81 removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 21, 2026
@grvgoel81 grvgoel81 marked this pull request as ready for review May 21, 2026 14:14
@grvgoel81 grvgoel81 requested a review from a team as a code owner May 21, 2026 14:14
@grvgoel81 grvgoel81 added the team-onboarding Onboarding team label May 21, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4a231c8. Configure here.

Comment thread app/core/OAuthService/OAuthLoginHandlers/androidHandlers/google.ts Outdated
@grvgoel81 grvgoel81 enabled auto-merge May 21, 2026 16:42

@tylerc-consensys tylerc-consensys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From AI:

- The PR still does not pass explicit accountType into the wallet creation error route, so SocialLoginErrorSheet can still fall back to metamask if seedless onboarding auth connection is unavailable.
- Pre-OAuth failures from Onboarding, like invalid/disabled Telegram provider, are still outside OAuthService and not covered by Social Login Failed.
- No-internet preflight remains untracked, but I’d leave that alone unless Product explicitly wants it because tracking it changes metrics opt-in timing.

@github-actions github-actions Bot added size-L and removed size-M labels May 22, 2026
@github-actions github-actions Bot added size-XL and removed size-L labels May 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSeedlessOnboarding
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 19 changed files are focused exclusively on the seedless onboarding / social login (OAuth) flow:

  1. OAuthService core changes: Refactored social login failure tracking - extracted #trackSocialLoginFailure to standalone trackSocialLoginFailed, added new #trackSocialLoginAuthBrowserDismissed to distinguish user dismissals from errors, added timing tracking.

  2. New error detection helpers (error.ts): isOAuthUserCancellationMessage() and isSocialLoginAuthSessionDismissed() for more robust cancellation detection across Google/Apple providers.

  3. New analytics module (socialLoginAnalytics.ts): Extracted analytics tracking logic with isPreOAuthSocialLoginFailure() and trackSocialLoginFailed().

  4. New analytics event (MetaMetrics.events.ts): SOCIAL_LOGIN_AUTH_BROWSER_DISMISSED to track when users dismiss the OAuth browser.

  5. Platform handlers (google.ts, apple.ts): Updated to use new isOAuthUserCancellationMessage() helper, added explicit handling for cancel/cancelled/dismiss result types.

  6. Onboarding/index.tsx: Refactored trace management with endSocialLoginAttemptTrace(), improved error handling flow, added analytics for pre-OAuth failures, restructured try/catch for createLoginHandler vs handleOAuthLogin.

  7. AccountStatus/index.tsx: Added account_type property to analytics events for account found/not found screens.

  8. ChoosePassword/index.tsx: Added account_type to wallet setup failure analytics events.

  9. WalletCreationError/: Refactored to pass accountType as prop instead of reading from Redux selector.

The changes are analytics/error-handling improvements within the social login onboarding flow. The core OAuth logic (login, token exchange, wallet creation) is not fundamentally changed - only how errors are classified and tracked. The SmokeSeedlessOnboarding tag directly covers these flows (Google/Apple OAuth, onboarding lifecycle, SeedlessOnboardingController integration).

No other test tags are needed because:

  • No changes to wallet core, Engine, or controllers
  • No changes to navigation structure beyond onboarding
  • No changes to account management, network, swap, or other features
  • The ChoosePassword and AccountStatus changes are analytics-only additions that don't affect functional behavior

Performance tests are not warranted as these are analytics/error-handling changes with no UI rendering or data loading impact.

Performance Test Selection:
Changes are focused on analytics tracking and error classification within the OAuth social login flow. No UI rendering changes, no list components, no data loading paths, no app startup changes, and no performance-sensitive code paths were modified. Performance tests are not warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@grvgoel81 grvgoel81 added this pull request to the merge queue May 22, 2026
Merged via the queue into main with commit 5201867 May 22, 2026
186 of 189 checks passed
@grvgoel81 grvgoel81 deleted the feat/TO-754-telegram-events branch May 22, 2026 08:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.80.0 Issue or pull request that will be included in release 7.80.0 label May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.80.0 Issue or pull request that will be included in release 7.80.0 size-XL team-onboarding Onboarding team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants