Repository navigation
chore: upgrade Fullstory to snippet 2.1 and skip it without an org ID - #7061
Merged
Merged
Conversation
The docs site still shipped Fullstory's legacy v1.3.0 snippet. Fullstory's Browser API v2 requires snippet 2.0 or later, and 2.1 is current, so we were running on a snippet Fullstory no longer documents. The org ID was also wrapped in hand-written quotes, so any production build without FULLSTORY_ORG_ID (including every CI build) shipped _fs_org = 'undefined' on every page and loaded fs.js for an org that doesn't exist. - Replace the snippet with SnippetSrc from @fullstory/snippet@2.1.0, copied verbatim. Its host, script, namespace, and org ID placeholders are filled with JSON.stringify, the same way the package's injectSnippetArgs() fills them. Snippet 2.1 takes these as arguments instead of window._fs_* globals; the values are unchanged (fullstory.com, edge.fullstory.com/s/fs.js, FS). - Inject nothing when FULLSTORY_ORG_ID is unset or empty, in addition to the existing non-production check. - Document at the top of the plugin when the snippet is injected and where it comes from. No v1-style FS.identify/event/setUserVars/consent/shutdown/restart calls exist elsewhere in the repo, so nothing else needed converting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WUv8r1UmXksNKFmsHaYoTF
Use active voice for how the placeholders get filled, and separate the dev server case from builds that lack FULLSTORY_ORG_ID so each sentence describes one behavior. No code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WUv8r1UmXksNKFmsHaYoTF
The new code comment rules in AGENTS.md ask for the why only. Drop the parts that restated the production and org ID check, and give the reason for JSON.stringify (a quoted, escaped literal) instead of pointing at the package function it mirrors. No code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WUv8r1UmXksNKFmsHaYoTF
cypress-documentation
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress-documentation
|
| Branch Review |
fullstory/v2-snippet
|
| Run status |
|
| Run duration | 02m 16s |
| Commit |
|
| Committer | Jennifer Shehane |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
427
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
32.91%
|
|
|---|---|
|
|
738
|
|
|
26
|
Accessibility
98.89%
|
|
|---|---|
|
|
3 critical
5 serious
4 moderate
1 minor
|
|
|
75
|
cypress-documentation
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress-documentation
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 02m 07s |
| Commit |
|
| Committer | Jennifer Shehane |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
427
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
32.91%
|
|
|---|---|
|
|
738
|
|
|
26
|
Accessibility
98.91%
|
|
|---|---|
|
|
2 critical
5 serious
4 moderate
1 minor
|
|
|
73
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the Fullstory v1.3.0 snippet in
plugins/fullstory.jswith Fullstory's current 2.1.0 snippet, and stops adding the snippet to pages whenFULLSTORY_ORG_IDis unset or empty.Why
FULLSTORY_ORG_ID(including every CI build) shipped_fs_org = 'undefined'and loadedfs.jsfor an org that doesn't exist.Production now builds on Cloudflare Workers Builds, and
FULLSTORY_ORG_IDis set there as a build variable.What changed
SnippetSrcfrom Fullstory's@fullstory/snippet@2.1.0npm package, copied verbatim. Fullstory's developer docs don't publish the snippet text; they point to the in-app Fullstory Setup page, and the snippet on that page matches the package's 2.1.0 code.window._fs_*globals. The values haven't changed:fullstory.com,edge.fullstory.com/s/fs.js, andFS.JSON.stringifyfills all four values, so the org ID lands as a quoted, escaped string literal.FULLSTORY_ORG_IDis unset or empty, in addition to the existing non-production check.AGENTS.md.node_modules,dist, and.docusaurus) for v1-style calls (FS.identify,FS.event,FS.setUserVars,FS.consent,FS.shutdown,FS.restart, and the other helpers). None exist outside the old snippet.How this was tested
SnippetSrcwith its placeholders filled.npm run buildwithFULLSTORY_ORG_IDunset: 0 of 339 HTML files containedge.fullstory.com.FULLSTORY_ORG_ID=test-org npm run build:dist/api/commands/visit/index.htmlhas one Fullstory script in<head>, ending"FS","test-org"), with noundefined.node --checkon the extracted script passes.fs.jsstubbed): it loadsedge.fullstory.com/s/fs.js?org=test-org, setsdata-fs-namespace="FS"andFS._vto2.1.0, and queuesinitwith the right org, host, and script.npm run lint:fixand Prettier are clean.Docusaurus minifies inline head scripts at build time, so the deployed page holds a minified version of the snippet. The source file keeps the verbatim copy, and the browser run above exercised the minified output.
Not tested: recording against the real Fullstory org, which needs production traffic.
Notes for reviewers
cloudflare/previewcheck uploads the CI build, and CI doesn't setFULLSTORY_ORG_ID. That's expected.FULLSTORY_ORG_IDshould be set only for production builds, so branch previews don't send sessions to the production org.?org=<id>. If Osano identifies Fullstory by its script address, confirm it still blocks Fullstory after a visitor declines. To check locally:FULLSTORY_ORG_ID=test-org npm run build, thennpm run serve.fs.jsdoesn't load.Generated by Claude Code
Note
Medium Risk
Changes production-only third-party script injection and URL shape (
?org=), which can affect session recording and consent/blocking behavior if those tools key off the old script URL.Overview
Summary
Replaces the legacy Fullstory 1.3.0 inline bootstrapping code in
plugins/fullstory.jswith the 2.1.0 minified snippet (from@fullstory/snippet), passed host, script path, namespace, and org viaJSON.stringifyso values are safe string literals. Injection is skipped when the build is not production or whenFULLSTORY_ORG_IDis unset/empty, so dev and CI builds no longer loadedge.fullstory.comor send sessions for a non-existent org.Why
Fullstory’s current browser stack expects snippet 2.x; the old 1.3.0 path was outdated. The previous org ID was interpolated into JS without validation, so missing
FULLSTORY_ORG_IDin prod-like builds produced'undefined'and still requestedfs.js. Production now has a real org ID in the deploy environment; gating onorgIdmatches that and avoids bad data.Notes for reviewers
The file header documents copying verbatim
SnippetSrcfor future upgrades—prefer replacing the block over hand-editing. PR previews / CI stay without Fullstory if the org var is unset (expected). If Osano or other tooling matches Fullstory by script URL, the loader URL now includes?org=…; worth a quick smoke check that blocking still works after cookie decline.Closes #
Reviewed by Cursor Bugbot for commit 772fd3b. Bugbot is set up for automated code reviews on this repo. Configure here.