Repository navigation
[DATA-8187] fix(analytics): avoid redundant browser identity and flag calls - #6731
Merged
Merged
Conversation
pedroheyerdahl
marked this pull request as ready for review
September 25, 2026 18:38
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the single changed file ( Files Reviewed (1 file)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Sep 25, 2026
This was referenced Sep 27, 2026
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
When NextAuth refreshes a login session, it can create a new session object even though the user has not changed. The PostHog effect depends on that object, so it repeats identification and feature-flag requests.
Make the effect depend on the user's email, name and login status instead. Remove the separate
aliasandreloadFeatureFlagscalls becauseidentifyalready links the anonymous user and refreshes flags when the identity changes. This behavior was checked in the installedposthog-jsversion, 1.360.2.Verification
Checked on September 25 at
57575371:git diff --checkpassed.Local verification screenshots
The temporary panel on the running local app shows the counts before and after three session refreshes: identify 1 → 1, alias 0 → 0, flag reload 1 → 1.
Reviewer Notes
The profile's auto-routing settings failed to load in the local environment. The login and session checks above completed.