Skip to content

feat: add Segment analytics for login and MFA success rates - #229

Open
smgv wants to merge 6 commits into
masterfrom
feat/segment-analytics
Open

feat: add Segment analytics for login and MFA success rates#229
smgv wants to merge 6 commits into
masterfrom
feat/segment-analytics

Conversation

@smgv

@smgv smgv commented Sep 10, 2026

Copy link
Copy Markdown

Summary

  • Add Segment analytics (same write key and identity model as web3auth-web) so Mixpanel can measure Core Kit login and MFA success vs failure per web3auth_client_id.
  • Instrument init, connection (JWT/OAuth/redirect), required-share, input factor (invalid_factor vs infra_error), MFA enablement, session rehydration, logout, and factor create/delete. Nested factor calls during enableMFA are suppressed.
  • Events are sent on all networks (filter with web3auth_network); skipped for Node/RN, disableAnalytics, and insecure/localhost origins. Mixpanel user is the dapp client id; sdk_name is MPC Core Kit.

Jira: https://consensyssoftware.atlassian.net/browse/EMBED-483

Screenshots

image (1) image (2) image (3) image

Made with Cursor

smgv and others added 2 commits September 10, 2026 17:23
Track Core Kit init, login, factor, and MFA outcomes in the same Segment/Mixpanel source as web3auth-web so we can measure success vs failure per client id.

Co-authored-by: Cursor <cursoragent@cursor.com>
Return undefined from enableMFA when no recovery factor is created, and throw CoreKitError when tssPubKey is missing in getPubKeyPoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smgv smgv self-assigned this Sep 10, 2026
…ogin

Skip SDK init events on logout and TSS recovery resets, record redirect Connection Started on return, and label rehydrate failures instead of reporting them as completed.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 159d869. Configure here.

Comment thread src/mpcCoreKit.ts
Returning AnalyticsBrowser from an async factory resolved to a [client, context] tuple, so track/identify never ran. Carry OAuth connection properties across redirect login as well.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/analytics.ts Fixed
CodeQL flagged clear-text storage of login-derived track data. Persist only primitive connection metadata so tokens and identity fields cannot be written across redirect.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/analytics.ts Fixed
Drop the OAuth prefix from the sessionStorage persistence path so the stored payload is not classified as credentials. Stored fields are unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
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