Prerender content pages + harden client telemetry#31
Merged
Conversation
navigator.sendBeacon forces credentials mode "include" with no opt-out, so it replayed the third-party cookies the Azure ingestion endpoint sets (ai_user, browserId) on every /v2.1/track POST. Our envelopes carry their own operationId/pageviewId, so a cookie is never needed for correlation. Send via a keepalive fetch with credentials:"omit" instead — the modern beacon equivalent that survives page unload (keepalive) and stays off the critical request chain (priority:"low", the reason beacon was used before), while being the only transport that lets us drop credentials. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
decipher-ms | 72f024d | Commit Preview URL Branch Preview URL |
May 29 2026, 08:10 PM |
There was a problem hiding this comment.
Pull request overview
This PR hardens client telemetry by replacing navigator.sendBeacon with a low-priority keepalive fetch that omits credentials, preventing App Insights ingestion cookies from being replayed.
Changes:
- Removes the
sendBeacontransport path for telemetry. - Uses
fetchwithkeepalive: true,credentials: "omit", andpriority: "low"for telemetry POSTs. - Updates inline comments to document the cookie/transport rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Stacks the prerender perf work with two telemetry fixes.
Changes
e9a39c8,c6ed36e).72f024d).navigator.sendBeaconforces credentials modeincludewith no opt-out, so it was replaying the third-party cookies the Azure ingestion endpoint sets (ai_user,browserId) on every/v2.1/trackPOST. Switched to a keepalivefetchwithcredentials:"omit"— survives unload, stays off the critical chain (priority:"low"), and carries no cookies.Verification
itemsAccepted, noSet-Cookie)./v2.1/trackfires with noCookieheader,type: fetch, HTTP 200.🤖 Generated with Claude Code