Skip to content

Telemetry: Disambiguate traffic coming from error/upgrade links#32287

Merged
shilman merged 11 commits into
nextfrom
shilman/error-utm
Aug 20, 2025
Merged

Telemetry: Disambiguate traffic coming from error/upgrade links#32287
shilman merged 11 commits into
nextfrom
shilman/error-utm

Conversation

@shilman
Copy link
Copy Markdown
Member

@shilman shilman commented Aug 18, 2025

Closes N/A

Telescopes on #32286

What I did

Better disambiguate traffic coming from error/upgrade links

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

This PR adds UTM tracking parameters to Storybook documentation links throughout the codebase to improve telemetry and traffic attribution. The changes systematically add ?ref=error parameters to links that appear in error messages and ?ref=upgrade parameters to links that appear in upgrade/migration contexts, while also adding ?utm_source=ui to links accessed from UI components.

The implementation spans 28 files across the Storybook codebase, touching error handling systems, CLI tools, UI components, and documentation blocks. Key areas affected include:

  • Error handling: The core StorybookError class and various specific error classes now append ?ref=error to all storybook.js.org URLs in error messages
  • CLI and upgrade flows: Migration guides and upgrade documentation links now include ?ref=upgrade parameters
  • UI components: Documentation links in manager components, addon panels, and docs blocks now include ?utm_source=ui parameters
  • Test files: Multiple test files have been updated with new expected URL formats to match the implementation changes

This telemetry enhancement builds on PR #32286 and enables the Storybook team to distinguish between different traffic sources (error-driven, upgrade-driven, and UI-driven) when users navigate to documentation. The changes are purely additive and cosmetic, maintaining all existing functionality while providing valuable analytics data.

Confidence score: 4/5

  • This PR is generally safe to merge with low risk of breaking functionality, as changes are primarily cosmetic URL modifications
  • Score reflects the comprehensive scope across many files and some complexity in URL parameter handling logic that could introduce edge cases
  • Pay close attention to code/core/src/storybook-error.ts for potential URL construction issues with nested ternary operators

@shilman shilman added maintenance User-facing maintenance tasks patch:yes Bugfix & documentation PR that need to be picked to main branch telemetry ci:normal labels Aug 18, 2025
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Aug 18, 2025

View your CI Pipeline Execution ↗ for commit 6aa17df

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 46s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-20 04:57:38 UTC

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented Aug 18, 2025

Package Benchmarks

Commit: 6aa17df, ran on 20 August 2025 at 04:44:28 UTC

No significant changes detected, all good. 👏

@shilman shilman self-assigned this Aug 18, 2025
@shilman shilman force-pushed the shilman/configure-utm branch from cd46fac to 239f97e Compare August 19, 2025 01:44
@shilman shilman changed the title Telemetry: Add utm_source=error to error links Telemetry: Add ref=error/upgrade to error/upgrade links Aug 19, 2025
Base automatically changed from shilman/configure-utm to next August 19, 2025 03:28
@shilman shilman marked this pull request as ready for review August 19, 2025 03:32
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

29 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

Comment thread code/core/src/manager/settings/SettingsFooter.tsx Outdated
Comment thread code/core/src/storybook-error.ts Outdated
Comment thread code/core/src/storybook-error.ts Outdated
@shilman shilman changed the title Telemetry: Add ref=error/upgrade to error/upgrade links Telemetry: Add ref=error/upgrade/ui to links Aug 19, 2025
Copy link
Copy Markdown
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

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

@shilman this is shaping up nicely, I left some items for you to consider when you can. The major one i'm concerned is the URL structure usage.

Approving to unblock you.

Comment thread code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts Outdated
Comment thread code/core/src/manager/components/mobile/about/MobileAbout.tsx Outdated
Comment thread code/core/src/manager/components/panel/Panel.tsx Outdated
Comment thread code/core/src/core-server/utils/StoryIndexGenerator.ts Outdated
Comment thread code/core/src/preview-api/modules/store/csf/portable-stories.ts Outdated
category: Category.CLI_AUTOMIGRATE,
code: 1,
documentation: 'https://storybook.js.org/docs/configure/overview#es-modules',
documentation: 'https://storybook.js.org/docs/configure/overview?ref=error#es-modules',
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.

@shilman just a heads up, this will point to an incorrect URL as we don't have actual documentation about it except the following entry in the monorepo's migration guide and in the main.js|ts API reference

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jonniebigodes Thanks for your diligence on this. I think we should add a section on ESM only to the configuration overview page as part of SB10 release, so I'm going to leave this as is for now. But if we want to keep the existing structure we can link to the main.ts|js reference instead. I'll let you guys take care of that separately cc @kylegach

Comment thread code/core/src/test/testing-library.ts Outdated
Comment thread code/lib/cli-storybook/src/codemod/csf-factories.ts
@shilman shilman merged commit 14cf3d9 into next Aug 20, 2025
55 checks passed
@shilman shilman deleted the shilman/error-utm branch August 20, 2025 06:42
@github-actions github-actions Bot mentioned this pull request Aug 20, 2025
17 tasks
@ndelangen ndelangen changed the title Telemetry: Add ref=error/upgrade/ui to links Telemetry: Disambiguate traffic coming from error/upgrade links Aug 20, 2025
ndelangen pushed a commit that referenced this pull request Aug 20, 2025
Telemetry: Add ref=error/upgrade/ui to links
(cherry picked from commit 14cf3d9)
ndelangen pushed a commit that referenced this pull request Aug 20, 2025
Telemetry: Add ref=error/upgrade/ui to links
(cherry picked from commit 14cf3d9)
ndelangen pushed a commit that referenced this pull request Aug 21, 2025
Telemetry: Add ref=error/upgrade/ui to links
(cherry picked from commit 14cf3d9)
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Aug 21, 2025
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal maintenance User-facing maintenance tasks patch:done Patch/release PRs already cherry-picked to main/release branch telemetry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants