feat(analytics): track onboarding, add-credits, and configure events - #3456
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (19)
🚧 Files skipped from review as they are similar to previous changes (17)
📝 WalkthroughWalkthroughAnalytics tracking is added to credits flows, payment selection, deployment configuration, configuration page views, and onboarding actions. Components receive ChangesAnalytics instrumentation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3456 +/- ##
==========================================
- Coverage 73.05% 72.06% -1.00%
==========================================
Files 1175 1085 -90
Lines 29799 27528 -2271
Branches 7400 6954 -446
==========================================
- Hits 21771 19839 -1932
+ Misses 7062 6753 -309
+ Partials 966 936 -30
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
997e142 to
0f2defc
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.tsx`:
- Around line 300-325: Update the payment-method selection flow around
trackPaymentTypeSelected so payment types are normalized before comparing
against lastPaymentTypeRef, and reset that ref when selecting NEW_CARD. Ensure
switching to a saved bank method cannot leave a stale "card" dedupe value that
suppresses the next new-card event.
In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.tsx`:
- Around line 52-76: Update the CPU count handlers in the Controller render
block so ConfigureDeployment analytics tracks only changed, finite values:
capture the field value on focus, compare it on blur, and call
analyticsService.track only when the value changed and is finite. Always call
field.onBlur(), including for unchanged or invalid input.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 706ed828-a120-4df1-a288-62aac6b6c9ab
📒 Files selected for processing (19)
apps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.spec.tsxapps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.tsxapps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.tsxapps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.tsxapps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.tsxapps/deploy-web/src/components/onboarding-picker/OnboardingPickerPage.spec.tsxapps/deploy-web/src/components/onboarding-picker/OnboardingPickerPage.tsxapps/deploy-web/src/services/analytics/analytics.service.ts
0f2defc to
9161be8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.spec.tsx`:
- Around line 139-147: Update both unchanged-value analytics tests around the
CPU input blur behavior to assert that analyticsService.track was never called
at all, replacing the event-specific not.toHaveBeenCalledWith checks. Keep the
existing setup and focus/blur interactions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 80db14e3-4ee1-4341-b6a6-3f039686e73e
📒 Files selected for processing (19)
apps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.spec.tsxapps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.tsxapps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.tsxapps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.tsxapps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.spec.tsxapps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.tsxapps/deploy-web/src/components/onboarding-picker/OnboardingPickerPage.spec.tsxapps/deploy-web/src/components/onboarding-picker/OnboardingPickerPage.tsxapps/deploy-web/src/services/analytics/analytics.service.ts
🚧 Files skipped from review as they are similar to previous changes (17)
- apps/deploy-web/src/components/onboarding-picker/OnboardingPickerPage.spec.tsx
- apps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.spec.tsx
- apps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.spec.tsx
- apps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.tsx
- apps/deploy-web/src/services/analytics/analytics.service.ts
- apps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.tsx
- apps/deploy-web/src/components/billing-usage/AddCreditsForm/AddCreditsForm.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/ComputeResourcesCard/ComputeResourcesCard.tsx
- apps/deploy-web/src/components/billing-usage/AddCreditsNewPaymentMethodFields/AddCreditsNewPaymentMethodFields.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.tsx
- apps/deploy-web/src/components/billing-usage/AddCreditsAmountFields/AddCreditsAmountFields.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/PresetsCard/PresetsCard.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentForm/ConfigureDeploymentForm.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigurationPane/GpuCard/GpuCard.tsx
- apps/deploy-web/src/components/auth/AddCreditsSheet/AddCreditsSheet.tsx
Instrument Amplitude events across three deploy-web surfaces, fired via useServices().analyticsService.track and added to the AnalyticsEvent union: - Onboarding picker: deploy click (chosen template / custom-image option) and add-credits click (skip-trial / unlock-gpu reason). - Add Credits sheet/form: opened, amount selected, payment type, purchased, cancelled. - Configure page: page viewed, preset selected, GPU type, GPU count, CPU count. Duration is derived in Amplitude from start/end event timestamps, not computed client-side. The shared Add Credits sheet gains a context prop so the funnel can be segmented by surface.
9161be8 to
cdb3faf
Compare
Why
Onboarding, Add Credits, and the new-deployment Configure screen are among Console's most important
activation and conversion surfaces, but the specific user actions on them weren't reported to
Amplitude. We couldn't answer product questions like which starter template people deploy, how the
add-credits funnel converts (and where it's abandoned), or what hardware people pick while
configuring.
This instruments those actions so the funnel — land on onboarding → deploy a template / add credits
/ configure → deploy — can be measured in Amplitude.
What
No visual changes — analytics-only. All events go through the existing
useServices().analyticsService.track(...)and are added to theAnalyticsEventunion./onboardingpicker (category: "onboarding")onboarding_deploy_click{ option }— the three template cards report their template id; the"Deploy image" link reports
"custom-image". The post-credit LLM auto-deploy deliberately doesnot fire this (deploy-click tracking is split from navigation).
onboarding_add_credits_click{ reason: "skip-trial" | "unlock-gpu" }— both add-credits entrypoints (skip the trial, unlock the gated GPU template), distinguished by reason.
Add Credits sheet/form (
category: "billing")add_credits_opened,add_credits_amount_selected{ amount, isCustom },add_credits_payment_method_selected{ type }(saved method type, or the Stripe payment-elementselection, mapped to
card/bank),add_credits_purchased{ amount },add_credits_cancelled.AddCreditsSheet, so they cover every surface that opens it. The sheet gainsan optional
contextprop (onboarding passes its reason) to segment the funnel by surface./new-deployment/configure(category: "deployments")configure_page_viewed(on mount),configure_preset_selected{ preset },configure_gpu_type_selected{ model, vendor },configure_gpu_count_changed{ count },configure_cpu_count_changed{ count }(on blur, not per keystroke).Duration is derived in Amplitude, not computed client-side. For "time spent" / "time to convert"
we emit clean start and end events (e.g.
add_credits_opened → add_credits_purchased,configure_page_viewed → create_lease) and let Amplitude's Funnel "time to convert" report theelapsed time — no
durationMsprop or unmount timers.Notes
e.g.
create_lease+{ gpuAmount }), rather than a combinatorial set of event names.PresetsCard,GpuCard,ComputeResourcesCard) exposeuseServicesvia their
DEPENDENCIESso they stay unit-testable with an injectedmock<AnalyticsService>().Verification
Credits components, the four configure components). All touched specs pass.
tscadds no new errors over the pre-existingbaseline. The full deploy-web unit suite is green except 3 pre-existing env failures unrelated to
this change (
validateGeneratedSdl×2,useProviderJwt×1, all confirmed failing onmain).Summary by CodeRabbit