fix(analytics): stop orphaning anonymous person on load, breaking signup attribution #83

Merged
root merged 1 commits from dev into main 2026-06-03 11:05:00 +03:00
Owner

__root identify effect called posthog.reset() whenever user was falsy —
which includes the brief window while the session resolves on every page
load. After the signup hard-redirect this rotated the anonymous distinct_id,
orphaning the pre-signup anonymous person that carries user_signed_up and
first-touch $initial_utm_*. The later identify() then merged a fresh, empty
anon id, so signups never linked to trial/payment (only ~16% stitched) and
channel attribution read "(none)" for 100% of signups.

  • __root.tsx: gate the effect on isLoading and only reset() on a real
    identified -> anonymous transition (logout), tracked via a ref. Logout
    still resets via dashboard handleSignOut.
  • register.tsx: identify() within the still-active anonymous session before
    firing user_signed_up, so the anon->identified merge carries $initial_utm_*
    and attributes the signup (email flow; Google is handled on OAuth return).

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

__root identify effect called posthog.reset() whenever `user` was falsy — which includes the brief window while the session resolves on every page load. After the signup hard-redirect this rotated the anonymous distinct_id, orphaning the pre-signup anonymous person that carries `user_signed_up` and first-touch `$initial_utm_*`. The later identify() then merged a fresh, empty anon id, so signups never linked to trial/payment (only ~16% stitched) and channel attribution read "(none)" for 100% of signups. - __root.tsx: gate the effect on isLoading and only reset() on a real identified -> anonymous transition (logout), tracked via a ref. Logout still resets via dashboard handleSignOut. - register.tsx: identify() within the still-active anonymous session before firing user_signed_up, so the anon->identified merge carries $initial_utm_* and attributes the signup (email flow; Google is handled on OAuth return). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
root added 1 commit 2026-06-03 11:04:56 +03:00
fix(analytics): stop orphaning anonymous person on load, breaking signup attribution
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
fa6937bb5f
__root identify effect called posthog.reset() whenever `user` was falsy —
which includes the brief window while the session resolves on every page
load. After the signup hard-redirect this rotated the anonymous distinct_id,
orphaning the pre-signup anonymous person that carries `user_signed_up` and
first-touch `$initial_utm_*`. The later identify() then merged a fresh, empty
anon id, so signups never linked to trial/payment (only ~16% stitched) and
channel attribution read "(none)" for 100% of signups.

- __root.tsx: gate the effect on isLoading and only reset() on a real
  identified -> anonymous transition (logout), tracked via a ref. Logout
  still resets via dashboard handleSignOut.
- register.tsx: identify() within the still-active anonymous session before
  firing user_signed_up, so the anon->identified merge carries $initial_utm_*
  and attributes the signup (email flow; Google is handled on OAuth return).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
root merged commit f233080623 into main 2026-06-03 11:05:00 +03:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: root/sase.tr#83