Skip to content

feat(onboarding): instrument brain onboarding analytics#1099

Open
MaheshtheDev wants to merge 3 commits into
mainfrom
worktree-onboarding-analytics
Open

feat(onboarding): instrument brain onboarding analytics#1099
MaheshtheDev wants to merge 3 commits into
mainfrom
worktree-onboarding-analytics

Conversation

@MaheshtheDev

@MaheshtheDev MaheshtheDev commented Jun 11, 2026

Copy link
Copy Markdown
Member

Wire PostHog funnel events (started, step viewed/completed, mode, workspace, sources, ingest, team, completed) across the brain onboarding flow, and drop stale pre-brain event defs from analytics.ts.


Session Details

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 2d753af Commit Preview URL

Branch Preview URL
Jun 12 2026, 03:22 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 2d753af Jun 12 2026, 03:22 AM

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@MaheshtheDev MaheshtheDev force-pushed the worktree-onboarding-analytics branch from 73ee3e8 to 6dd15f9 Compare June 11, 2026 19:02
@MaheshtheDev MaheshtheDev marked this pull request as ready for review June 11, 2026 19:12
@graphite-app graphite-app Bot requested a review from Dhravya June 11, 2026 19:12
@claude

claude Bot commented Jun 11, 2026

Copy link
Copy Markdown

Claude finished @MaheshtheDev's task in 1m 31s —— View job


Reviewing PR #1099

  • Analyze PR diff and changed files
  • Review existing comments from other reviewers
  • Check for bugs, security issues, and logic errors
  • Provide review summary

Overview: Instruments PostHog funnel events across the brain onboarding flow with proper ref-based guards against double-firing and cold-load handling.

Previous reviewer concerns — now addressed:

  • chatgpt-codex-connector flagged that cold-load events would be dropped before PostHog initializes → Fixed by onAnalyticsReady() which polls for posthog.__loaded with a 200ms interval
  • vorflux flagged that initialStep from useSearchParams() could change if the user navigates before PostHog loads → Fixed by entryStepRef = useRef(initialStep) which freezes the entry step at mount

Implementation review:
The fix at page.tsx:109-128 is correct:

  1. entryStepRef captures the entry step at mount, before any URL changes
  2. onAnalyticsReady() defers the callback until PostHog is loaded (or times out after 10s if blocked)
  3. Inside the callback, entryStepRef.current is read to ensure the frozen value is used
  4. startedRef prevents double-firing in React Strict Mode
  5. The cleanup function properly cancels pending callbacks if the effect re-runs

Issues found: None — this looks good to ship.

The event structure provides complete funnel visibility: onboarding_startedonboarding_step_viewed/completedonboarding_mode_selected/workspace_created/sources_completed/ingest_completed/team_skipped/invites_sentonboarding_completed

Score: 10/10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Instruments PostHog funnel events across the brain onboarding flow with proper ref-based guards against double-firing.

Issues found: None — this looks good to ship.

The implementation is clean:

  • startedRef correctly prevents double-firing of onboardingStarted in React Strict Mode
  • navTrigger ref pattern properly tracks user vs auto navigation before the state update
  • Error messages captured in onboardingWorkspaceCreateFailed are safe (no PII)
  • Event structure provides complete funnel visibility: started → step viewed/completed → mode/workspace/sources/ingest/team → completed

Score: 10/10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d33f791e88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/app/(app)/onboarding/page.tsx Outdated
@MaheshtheDev MaheshtheDev force-pushed the worktree-onboarding-analytics branch from d33f791 to 94c8d1f Compare June 11, 2026 19:19

@vorflux vorflux Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one legit issue in the onboarding analytics flow.


Review with Vorflux

Comment thread apps/web/app/(app)/onboarding/page.tsx Outdated
Wire PostHog funnel events (started, step viewed/completed, mode, workspace, sources, ingest, team, completed) across the brain onboarding flow, and drop stale pre-brain event defs from analytics.ts.
@MaheshtheDev MaheshtheDev force-pushed the worktree-onboarding-analytics branch from 2dd05d8 to 2b904aa Compare June 12, 2026 03:12
github-actions Bot and others added 2 commits June 12, 2026 03:14
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.

1 participant