Fix analytics SDK shutdown and device-cookie cleanup - #1704
Closed
David Pine (IEvangelist) wants to merge 1 commit into
Closed
David Pine (IEvangelist) wants to merge 1 commit into
David Pine (IEvangelist) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Analytics shutdown and consent changes span runtime code, cookies, and browser behavior and warrant final human review.
Review effort: Lite
Findings: None
What changed in this PR
Updates analytics consent handling to prevent stale SDK initialization, stop telemetry on withdrawal, and clean up only the device identifier cookie.
Changes:
- Rechecks consent before SDK initialization.
- Disables cookies, pauses collection, and removes scoped device-cookie variants.
- Adds unit and real-SDK E2E coverage.
- Documents analytics behavior and validation commands.
| File | Description |
|---|---|
src/frontend/tests/unit/analytics-script-contracts.vitest.test.ts |
Tests consent guards and failure handling. |
src/frontend/tests/e2e/cookie-consent.spec.ts |
Adds cookie, SDK, reload, withdrawal, and navigation coverage. |
src/frontend/src/components/starlight/Head.astro |
Applies consent changes and performs scoped analytics cleanup. |
src/frontend/public/scripts/analytics/1ds.js |
Prevents initialization without current analytics consent. |
.github/astro.instructions.md |
Documents analytics behavior and regression commands. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
David Pine (IEvangelist)
marked this pull request as draft
September 21, 2026 17:00
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
Apply updated analytics settings before reloading the page, and prevent a delayed SDK bootstrap from initializing with stale settings.
Analyticsbecomes false, rather than unloading and flushing queued events.MicrosoftApplicationsTelemetryDeviceId, covering root-path host-only and current-domain variants while preserving other cookies.Analyticsvalue immediately before SDK initialization. Existing regional defaults remain unchanged.Third-party links and affiliations
None.
Validation