-
Notifications
You must be signed in to change notification settings - Fork 42
feat: load dynamic configuration #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
feugy
merged 7 commits into
canary
from
damien/o11y-3535-vercelanalytics-load-dynamic-configuration
Jan 9, 2026
Merged
feat: load dynamic configuration #184
feugy
merged 7 commits into
canary
from
damien/o11y-3535-vercelanalytics-load-dynamic-configuration
Jan 9, 2026
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
8aa4282 to
e7bc6e6
Compare
Jooliashi
approved these changes
Jan 8, 2026
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.
🖖 What's in there?
This PR introduce loads a stringified configuration when injecting the script, which acts as defaults for unspecified properties.
This mechanism is a generic way for Vercel to configure at build time
@vercel/analyticsand other "client side" packages, while allowing users to override the configuration when needed.This server-side
track()function will not use this configuration for now: instead, I've fixed it so we could leverage the exiting (unused) VERCEL_WEB_ANALYTICS_ENDPOINT env var to fully configure where the data is sent.This PR also introduce dedicated data attribute for the injected script:
data-event-endpointanddata-view-endpoint.Finally, it replaces eslint+prettier with biome, and husky+lint-staged with lefthook, and restore unit tests in CI.
🤺 How to test?
It's not tested on CI, because I need to define configuration strings at build time when deploying the test applications on Vercel. At least the exiting tests are checking that it's fully backward compatible.
As for manual tests:
go to any test application inside the
apps/folderbuild the app using the appropriate env var:
NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG(Next),PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG(Astro),VITE_VERCEL_OBSERVABILITY_CLIENT_CONFIG(all others) and give it these values'{"analytics":{"scriptSrc":"https://acme.com/foo.js"}}'.'{"analytics":{"endpoint":"/foo/bar","scriptSrc":"https://vercel-scripts.com/v1/script.js"}}'run the application locally (
pnpm previeworpnpm start) and browse to it with dev tools open on the network tab.for example:
🔬Notes to reviewers
While adding tests to
src/server/index.ts(server side tracking), I've fixed a bug where the provided flags would not be sent unless the request context is populated.All changes on test apps are due to biome's linter and formatter.