Send WALLET_CONNECT analytics from the login flow - #3622
Merged
Conversation
In reown mode the auth flow connected the wallet via `openModal()`, which never arms `isConnectionStarted` nor logs the "Started" event, so the `WALLET_CONNECT` "Connected" analytics was gated out during login — while `connect()`-driven paths (contract page, header, marketplace, L2 claim) kept working. Route the auth flow through `connect()` so login emits the events with its own `source`. Also consolidate the shared load-and-open body of `openModal`/`connect` into `loadAndOpenModal`, so the two entry points can no longer drift — the root cause behind this class of bug. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Fixes #3621. In reown mode, the
WALLET_CONNECTMixpanel event fires when connecting a wallet on the contract page (and header, marketplace, L2 claim buttons) but not during the login / authentication flow.Root cause
useWalletReownexposes two entry points that both open the AppKit modal:connect()— opens the modal, logsWALLET_CONNECT/Started, and armsisConnectionStarted.openModal()— opens the modal only.The
Connectedevent fires from the bridge connection handler only ifisConnectionStartedis set (a guard added by the 2024 "connect wallet event sent twice" fix, #1509, so only the initiating instance reports). Every working call site usesconnect(); the auth flow (useSignInWithWallet.start()) usedopenModal(), so it armed nothing and emitted neitherStartednorConnected.This predates the #3566 perf work — that refactor faithfully preserved the existing gate — but the release surfaced it during analytics QA.
Fix
useSignInWithWallet.start()now callsweb3Wallet.connect()instead ofopenModal(), so login emitsWALLET_CONNECTwith its ownsource. The sign-in itself is unchanged (theweb3Wallet.addresseffect still drivesproceedToAuth).openModal/connectintoloadAndOpenModal, so the two entry points can no longer drift — the root-cause class of this bug.Verification
pnpm lint:tscclean,pnpm lint:eslint0 errors.useWalletReown.spec.tsx— 9/9 pass, including the tests pinning theconnectvsopenModalanalytics distinction.🤖 Generated with Claude Code