Skip to content

Send WALLET_CONNECT analytics from the login flow - #3622

Merged
tom2drum merged 2 commits into
mainfrom
fix-3621-wallet-connect-login-event
Aug 10, 2026
Merged

Send WALLET_CONNECT analytics from the login flow#3622
tom2drum merged 2 commits into
mainfrom
fix-3621-wallet-connect-login-event

Conversation

@tom2drum

Copy link
Copy Markdown
Collaborator

Problem

Fixes #3621. In reown mode, the WALLET_CONNECT Mixpanel 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

useWalletReown exposes two entry points that both open the AppKit modal:

  • connect() — opens the modal, logs WALLET_CONNECT/Started, and arms isConnectionStarted.
  • openModal() — opens the modal only.

The Connected event fires from the bridge connection handler only if isConnectionStarted is set (a guard added by the 2024 "connect wallet event sent twice" fix, #1509, so only the initiating instance reports). Every working call site uses connect(); the auth flow (useSignInWithWallet.start()) used openModal(), so it armed nothing and emitted neither Started nor Connected.

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 calls web3Wallet.connect() instead of openModal(), so login emits WALLET_CONNECT with its own source. The sign-in itself is unchanged (the web3Wallet.address effect still drives proceedToAuth).
  • Consolidated the shared load-and-open body of openModal/connect into loadAndOpenModal, so the two entry points can no longer drift — the root-cause class of this bug.

Verification

  • pnpm lint:tsc clean, pnpm lint:eslint 0 errors.
  • useWalletReown.spec.tsx — 9/9 pass, including the tests pinning the connect vs openModal analytics distinction.

🤖 Generated with Claude Code

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>
@tom2drum tom2drum changed the title Send WALLET_CONNECT analytics from the login flow (#3621) Send WALLET_CONNECT analytics from the login flow Aug 10, 2026
@tom2drum
tom2drum merged commit d3d4e13 into main Aug 10, 2026
12 checks passed
@tom2drum
tom2drum deleted the fix-3621-wallet-connect-login-event branch August 10, 2026 17:25
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.

"Wallet connect" events are not sent when logging in

1 participant