feat(onboarding): funnel analytics for the new flow#7960
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds onboarding event definitions, feature-flag-based variant helpers, one-time variant trait tracking, and analytics for prompt copies, snippets, flag toggles, project creation, and first-feature creation. Connect-panel callbacks now propagate copy actions, while flag toggling reports success through a boolean promise. Event tracking also validates payloads and catches dispatch errors. Estimated code review effort: 3 (Moderate) | ~25 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
97fe9e6 to
10fa440
Compare
3a4e76d to
0a430fe
Compare
0a430fe to
5492b47
Compare
Docker builds report
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f40ac417-b58c-44c5-bc90-9f9d8ece7b77
📒 Files selected for processing (9)
frontend/common/utils/getOnboardingVariant.tsfrontend/e2e/tests/initialise-tests.pw.tsfrontend/e2e/tests/onboarding-tests.pw.tsfrontend/web/components/App.jsfrontend/web/components/pages/onboarding/GettingStartedGate.tsxfrontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsxfrontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.tsfrontend/web/components/pages/onboarding/hooks/useOnboardingFlag.tsfrontend/web/project/api.ts
af03032 to
71aecb7
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
frontend/web/project/api.ts (1)
313-323: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winMove validation outside the Google Analytics check and handle promise rejection.
The event validation and debug logging are nested inside
if (Project.ga), meaning they won't run for Amplitude-only setups. Furthermore,API.postEventreturns a promise that could reject, but the synchronoustry/catchwon't catch it, leading to an unhandled promise rejection.♻️ Proposed fix
- if (Project.ga) { - if (Project.logAnalytics) console.log('ANALYTICS EVENT', data) - if (!data || !data.category || !data.event) - return console.error('Invalid event provided', data) - if (data.category === 'First') - API.postEvent( - `${data.event}${ - data.extra ? ` ${JSON.stringify(data.extra)}` : '' - }`, - 'first_events', - ) + if (Project.logAnalytics) console.log('ANALYTICS EVENT', data) + if (!data || !data.category || !data.event) + return console.error('Invalid event provided', data) + + if (data.category === 'First') { + API.postEvent( + `${data.event}${data.extra ? ` ${JSON.stringify(data.extra)}` : ''}`, + 'first_events', + )?.catch((err) => console.error('Error posting first event', err)) + } + + if (Project.ga) { ga('send', {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2035470c-64b7-49b0-8914-284551309112
📒 Files selected for processing (9)
frontend/common/constants.tsfrontend/common/utils/getOnboardingVariant.tsfrontend/web/components/pages/onboarding/GettingStartedGate.tsxfrontend/web/components/pages/onboarding/OnboardingConnectPanel/ConnectWithAiPanel.tsxfrontend/web/components/pages/onboarding/OnboardingConnectPanel/OnboardingConnectPanel.tsxfrontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsxfrontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.tsfrontend/web/components/pages/onboarding/hooks/useOnboardingFlag.tsfrontend/web/project/api.ts
✅ private-cloud · depot-ubuntu-latest-16 — run #18636 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18636 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18636 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18636 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #18634 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18634 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #18633 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18633 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18634 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18634 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18633 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18633 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
✅ oss · depot-ubuntu-latest-arm-16 — run #18572 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
|
…otstrap The single-page flow auto-creates the project and flag, which emitted nothing, so the funnel had no project/feature step. Fire First Project created / First Feature created on a real create. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Onboarding snippet copied (install/wire), Onboarding AI connect used, and Onboarding flag toggled (fired only after the toggle saves; toggle now returns success). For measuring internal drop-off in the new flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Set the onboarding_variant user property (control | single_page) when the user reaches the gate, derived from the onboarding_quickstart_flow flag. Tagged at the point of consumption, not in identify, so only users who reach onboarding get it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
da1ace9 to
c67bc32
Compare
Use amplitude setOnce for onboarding_variant so it's pinned to the user's first exposure and doesn't get overwritten on later loads. Adds API.trackTraitsOnce; the getting-started gate uses it. Addresses Wadii's review note on #7960. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A failing tracker (GA/amplitude) can't break the caller, e.g. the onboarding bootstrap firing milestone events. Addresses kyle's note on #7960. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Zaimwa9
left a comment
There was a problem hiding this comment.
One change to use the right property
Review feedback: the identity flags response names the served variant (the MV option key, or the reserved 'control' for the default arm), so the arm comes from flag.variant and the flag's value stays free. An enabled flag with no variant is the pre-conversion boolean, meaning the new flow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
docs/if required so people know about the feature.Changes
Contributes to #7738.
Funnel analytics for the new single-page onboarding flow. It now emits the same milestone events as the current flow, tags the variant it served, and adds new-flow-only diagnostics. Funnel analytics only. The multivariate flag and a true A/B split (tagging the control arm) are a follow-up.
onboarding_variantuser property (control|single_page), set at the getting-started gate when a user reaches onboarding (not at identify), from theonboarding_quickstart_flowflag. Tags which flow the user saw, so onboarding events can be grouped by it.First Project created/First Feature createdon a real create (org already fired). Milestone events only, not the genericProject/Feature createdactions, which stay reserved for resources a user makes by hand.Onboarding snippet copied(install / wire),Onboarding AI connect used,Onboarding flag toggled.Follow-ups: multivariate flag plus control-arm tagging for a true A/B split; activation (first SDK evaluation, pending #7623); shared-analytics hardening (
setOnce,trackEventtry/catch) in #8061.How did you test this code?
Manually, with
onboarding_quickstart_flowon and analytics logging enabled (or by spying onAPI.trackEvent/API.trackTraitsin the console):onboarding_variant = single_pageis set once at the gate.First Project created/First Feature createdfire once on the auto-bootstrap, and not again on revisit.