Repository navigation
feat(server): send layerId with experiment exposures - #223
Merged
Merged
Conversation
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dferber90
marked this pull request as ready for review
December 2, 2026 19:21
The production e2e tests proxy the live va.vercel-scripts.com/v1/script.js, which no longer sends a client timestamp (ts) in pageview payloads. Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
feugy
approved these changes
Dec 3, 2026
feugy
left a comment
Member
There was a problem hiding this comment.
Thank for this PR.
For the record, it also removes outdated test expectations on the ts field which the ingestion overrides already.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
This branch was successfully deployed
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.
trackExposurenow accepts an optionallayerIdand sends it in the exposure data, so exposures from layered experiments can be analyzed per layer.Why
@vercel/flags-core(since 1.12.0) attacheslayerIdto the exposures it reports for experiments that run in a layer.trackExposurebuilds theedpayload from a fixed list of fields, so the layer id was dropped before it reached Web Analytics.The same flags-core release added the
not-in-layerassignment reason, whichExposureAssignmentReasondidn't list. Callers had to cast to pass it through.Approach
layerId?: stringtoExposureInputand include it inedwhen it's defined, the same wayrampIdandrampPercentageare handled. When it's left out, the payload is unchanged.'not-in-layer'toExposureAssignmentReason. This only changes the type; the reason was already sent unchanged at runtime.Validation
layerId: 'layer_a'andassignmentReason: 'not-in-layer'and checks both values are ined.vitest run src/server/experiments.test.ts: 22/22 pass.biome check packages/web/src/server: clean.Relevant context
The exposure ingestion endpoint has to keep (or start storing)
ed.layerIdfor the value to show up in queries.Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>