fix(analytics): identify PostHog users server-side on signup and onboarding#3179
Open
fix(analytics): identify PostHog users server-side on signup and onboarding#3179
Conversation
…arding Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
…ostHog Use `automation_<id>` as PostHog distinctId for chat and tool events triggered by automations, so they show up under the automation persona instead of the owner user. Also propagates automation metadata (id, name, trigger_id, user_agent) to all captured events and fixes abort event naming to distinguish user-cancelled from server-aborted runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… self-heal Add posthog.identify() for the user and posthog.groupIdentify() for the organization on every streamCore run. This refreshes the person/group profile each session so legacy users and orgs that predate the signup/creation hooks get backfilled automatically. Also drop the redundant `organization_name` / `organization_slug` event properties — PostHog resolves them via the organization group. Carry `virtual_mcp_name` on chat/tool events since virtual MCPs are not a PostHog group type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Frontend already emits chat_message_stopped when the user clicks the stop button (apps/mesh/src/web/components/chat/input.tsx). The server side was firing the same event for abortReason="cancelled", producing two events per user cancel. Now we skip the server event for user cancels and only fire chat_message_aborted for genuine non-user aborts (tab close, registry race, force-fail, reaped, ghost). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Accept main's refactored createMemory (lookup-only, no thread creation) and drop the extra fields passed from stream-core that are no longer needed. Co-Authored-By: Claude Sonnet 4.6 <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.
What is this contribution about?
PostHog was not receiving user name/email for server-side events because
posthog.identify()was never called server-side. Users appeared as unrecognized IDs (e.g.VWPJPnX0DXgPDMIo5J6CBNTbLOPI6XVS) instead of their actual name/email in PostHog dashboards.Two fixes:
posthog.identify()in theuser.createdatabase hook so every new user gets their name + email linked to their PostHog profile at the moment of signupnameto the existingposthog.identify()call in the/domain-setuponboarding route, which only hademailbeforeScreenshots/Demonstration
N/A — analytics-only change, no UI impact.
How to Test
emailandnamepropertiesReview Checklist
Summary by cubic
Identify PostHog users on signup, onboarding, and every stream run, and group-identify organizations for accurate attribution. Automation-triggered chats/tools are attributed to automation personas, with richer event context and no duplicate cancel events.
Bug Fixes
posthog.identify()in theuser.createhook and addnameto the/domain-setupidentify payload.posthog.identify()andposthog.groupIdentify()to self-heal legacy data.chat_message_stoppedon user cancel to prevent duplicates; emitchat_message_abortedonly for non-user aborts.New Features
automation_<id>andposthog.identify()the automation (name, owner user, org). Add richer event context (trigger_id,is_automation,automation_id/name,user_id,user_agent,virtual_mcp_name,abort_reason) and broaden credit/quota error detection.Written for commit e8983b7. Summary will update on new commits. Review in cubic