fix(analytics): clear GA user id on logout - #2381
Merged
thostetler merged 3 commits intoSep 21, 2026
Merged
Conversation
user_signed_out never cleared the GA user_id set on sign-in, so hits for the rest of the session stayed attributed to the logged-out user. Also catches the digestMessage rejection crypto.subtle throws on insecure origins, previously unhandled. No test coverage for this file.
thostetler
force-pushed
the
fix/ga-user-id-clear-on-logout
branch
from
September 16, 2026 16:46
61a4d8a to
aed9cb8
Compare
thostetler
marked this pull request as ready for review
September 16, 2026 16:49
Contributor
There was a problem hiding this comment.
馃煛 Changes recommended
Two moderate issues remain involving stale asynchronous digests and synchronously thrown hashing errors.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates analytics identity handling to clear the GA user ID on logout and handle user-ID hashing failures.
Changes:
- Sends
user_id: nullonuser_signed_out. - Adds handling around user-ID hashing.
File summaries
| File | Description |
|---|---|
src/js/components/navigator.js |
Handles GA identity updates on sign-in and sign-out. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| analytics('send', 'user_update', { | ||
| user_id: userIdHash, | ||
| }); | ||
| digestMessage(data) |
Comment on lines
+99
to
+102
| .then((userIdHash) => { | ||
| analytics('send', 'user_update', { | ||
| user_id: userIdHash, | ||
| }); |
shinyichen
approved these changes
Sep 17, 2026
digestMessage assumed crypto.subtle exists; on insecure origins it's undefined, so digest() threw synchronously past the caller's catch. digest is also async, so a sign-out could land before a pending sign-in hash resolved and re-attribute hits to the logged-out user. - Reject instead of throwing when crypto.subtle is unavailable - Run TextEncoder and digest() inside the promise chain - Bump a token per announcement, discard hashes from a prior session
Fails with "el.onerror is not a function": a RequireJS module load during the async window hits the global appendChild stub with an element lacking onerror.
thostetler
force-pushed
the
fix/ga-user-id-clear-on-logout
branch
from
September 21, 2026 21:05
ea6f2b1 to
8d9eb59
Compare
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.
Logging out never cleared the GA user_id, so hits for the rest of the browsing session kept attributing to the logged-out user.