Add action telemetry to onboarding funnel - #442
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## shilman/storybook-10-5 #442 +/- ##
==========================================================
+ Coverage 74.46% 74.51% +0.05%
==========================================================
Files 163 164 +1
Lines 12753 12900 +147
Branches 1123 1136 +13
==========================================================
+ Hits 9496 9612 +116
- Misses 3240 3271 +31
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR expands telemetry to include a consistent, screen-scoped “action” vocabulary across the authentication → project linking → onboarding funnel, and adds Storybook interaction coverage to validate key telemetry payloads (including the persisted welcome/sign-in edge case).
Changes:
- Introduces a closed
TelemetryActionunion and returns a screen-scoped action tracker fromuseTelemetry(plus a newuseTrackActionfor action-only tracking). - Threads action tracking through Authentication / LinkProject / Onboarding flows and tags build-trigger events with optional
{ location, screen }context. - Adds a reusable Storybook
telemetrySpyhelper and new interaction stories that assert emitted telemetry payloads.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/useBuildEvents.ts | Adds optional build trigger context and includes it in startBuild/stopBuild telemetry payloads. |
| src/utils/telemetrySpy.tsx | Adds a Storybook helper to inject a telemetry spy for interaction assertions. |
| src/utils/TelemetryContext.tsx | Adds TelemetryAction, useTrackAction, and updates useTelemetry to return an action tracker. |
| src/TestProviderRender.tsx | Wrapes build stop handler to avoid passing click events into the new signature. |
| src/screens/VisualTests/StoryInfo.tsx | Wrapes build start handler to avoid passing click events into the new signature. |
| src/screens/VisualTests/SnapshotControls.tsx | Wrapes build start handler to avoid passing click events into the new signature. |
| src/screens/VisualTests/RunBuildContext.tsx | Updates context typings so build actions can accept optional telemetry context. |
| src/screens/VisualTests/NoBuild.tsx | Wrapes build start handler to avoid passing click events into the new signature. |
| src/screens/VisualTests/BuildResults.tsx | Wrapes start/stop handlers to avoid passing click events into the new signature. |
| src/screens/Onboarding/Onboarding.tsx | Tracks actions on error/suspended flows and tags retry build with screen context. |
| src/screens/Onboarding/Onboarding.stories.tsx | Adds Storybook interaction coverage asserting onboarding/build-error telemetry payloads. |
| src/screens/Onboarding/InitialBuildComplete.tsx | Tracks “catchAChange” and “skipOnboarding” actions. |
| src/screens/Onboarding/InitialBuild.tsx | Tracks “skipOnboarding” and tags “startBuild” with onboarding screen context. |
| src/screens/Onboarding/CatchAChangeComplete.tsx | Tracks completion/skips and includes a path discriminator in completion payloads. |
| src/screens/Onboarding/CatchAChange.tsx | Tracks skip action and tags “startBuild” with onboarding screen context. |
| src/screens/LinkProject/LinkProject.tsx | Tracks account/project selection and project creation actions. |
| src/screens/LinkProject/LinkedProject.tsx | Tracks “continue” action when proceeding to onboarding. |
| src/screens/Authentication/Verify.tsx | Tracks verify-step sign-in action without duplicating view telemetry. |
| src/screens/Authentication/Authentication.tsx | Tracks navigation/sign-in actions and fixes screen attribution for persisted welcome→signin case. |
| src/screens/Authentication/Authentication.stories.tsx | Adds Storybook interaction coverage asserting authentication telemetry payloads (including persisted state case). |
Comments suppressed due to low confidence (1)
src/utils/useBuildEvents.ts:61
contextis optional, but it's being object-spread into the telemetry payload. This will fail TypeScript type-checking and should default to{}when omitted.
trackEvent?.({ ...context, action: 'stopBuild' });
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ghengeveld My biggest concern here is this event, which is kind of weird. Do we need the path at all? Can it be simplified? I also don't know if we need every single event here. But I don't think it hurts. Also there is telemetry for
startBuildevents (including a bugfix for the test provider build, which you should look at), but no telemetry forbuildComplete/buildError, which is a little weird.completeOnboardingpath: skippedSecondBuild | completedSecondBuildSummary
Add action telemetry for the VTA onboarding funnel
useTelemetryEvents
continueuninstallAddongoBacksignInsignInWithSSOgoBacksubmitSubdomaingoBacksignInselectAccountcreateProjectselectProjectcontinuestartBuildskipOnboardingcatchAChangeskipOnboardingstartBuildskipOnboardingcompleteOnboardingpath: skippedSecondBuild | completedSecondBuildskipOnboardingstartBuildskipOnboardingcontinueScreen impressions remain unchanged and continue to emit
{ location, screen }without anaction.Validation
yarn gate