fix(sso): redesign auth analytics for login/register parity and outcome tracking - #3632
Open
YishaiGlasner wants to merge 1 commit into
Open
fix(sso): redesign auth analytics for login/register parity and outcome tracking#3632YishaiGlasner wants to merge 1 commit into
YishaiGlasner wants to merge 1 commit into
Conversation
…me tracking The sign-up funnel analytics shipped alongside SSO were built for register only and reused as-is for login, causing login attempts to fire method_chosen/ process_started/process_ended events with a null flow_id and no bookending flow_started/flow_ended. Rename the whole sign_up_* vocabulary to the spec's auth_* events, track login and register as equally first-class flows (a direct register<->login transition now correctly ends the old flow and starts a new one), add flow_intent and outcome fields, and fix LoginView never calling endProcess at all. Getting `outcome` (created_new_account vs existing_user_login) for Google/Apple SSO required backend support: a new Sefaria-owned /api/auth/google/callback endpoint (mirroring the existing Apple one) replaces a direct call to allauth's stock headless endpoint, which had no hook to report it. Redirect-mode SSO (mobile web) gets the same signal via a new sefaria_sso_outcome cookie, set by extending get_login_redirect_url/get_signup_redirect_url and the existing ClearSsoNextCookieMiddleware. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📊 Code Quality Score: 52/100
Was this score accurate? 👍 Yes · 👎 No Scored by GitVelocity · How are scores calculated? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sign_up_*events/constants/files) to the spec'dauth_*events, and fixes login attempts firing tracking events with a nullflow_idand no bookendingflow_started/flow_ended(the tracking hook was gated toflow === 'register'only).flow_intent(registration/login/one_tap_login) andoutcome(created_new_account/existing_user_login) fields across all five events, and fixesLoginView.jsx, which never calledendProcessat all.outcomeis accurate for Google/Apple SSO too: a new/api/auth/google/callbackendpoint (mirroring the existing Apple one) replaces a direct call to allauth's stock headless endpoint, which had no hook to report it; redirect-mode (mobile web) SSO gets the same signal via a newsefaria_sso_outcomecookie set throughget_login_redirect_url/get_signup_redirect_urland the existingClearSsoNextCookieMiddleware.Test plan
npx jest static/js/auth— 102 tests passing across 7 suitespython manage.py test sso.tests.adapters_test sso.tests.middleware_test sso.tests.views_test— 67 tests passing/loginand/registerfor email, Google (popup), Google One Tap, and Apple (popup), confirming a consistentflow_id/attempt_idsequence with correctflow_intent/outcomeon success🤖 Generated with Claude Code