feat(audience): stamp sessionId on every message envelope#2895
Open
nattb8 wants to merge 1 commit into
Open
Conversation
✅ Pixel Bundle Size — @imtbl/pixel
Budget: 10.00 KB gzipped (warn at 8.00 KB) |
✅ Audience Bundle Size — @imtbl/audience
Budget: 24.00 KB gzipped (warn at 20.00 KB) |
|
View your CI Pipeline Execution ↗ for commit 91eb9a7
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit 2e1608d
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
2e1608d to
a8c3dd9
Compare
JCSanPedro
previously approved these changes
Jul 7, 2026
Session id was previously injected ad hoc into the properties object at each call site, so identify() and alias() on the web SDK carried no session correlation since those message types have no properties field. Adding sessionId to the shared BaseMessage envelope closes that gap while keeping the existing properties.session_id fields for backward compatibility.
a8c3dd9 to
91eb9a7
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.
Why
session_idonly reached some events via ad hoc per-call-siteproperties.session_id, andidentify()/alias()on the web SDK had none at all since those message types have nopropertiesfield. Every event should carry it consistently so a session can be reconstructed with a plain equality join instead of per-event-type special-casing.What
sessionIdis now on the top-level envelope for every message type: track, page, session_start, session_end, identify, alias. The old nestedproperties.session_idwrites are removed (confirmed nothing downstream reads them), so there's a single consistent field everywhere, no duplication.Also fixed a related bug in the web SDK:
page()/track()/identify()/alias()calledgetOrCreateSession()but discarded the result, so a session rollover after 30 minutes of inactivity was invisible, the SDK kept stamping a stale id and never fired a newsession_start. Pixel already handled this correctly; the web SDK now matches it.Linear: SDK-628
Test plan
corelint + tests passpixellint + tests passsdklint + tests passsessionIdpresent on identify/alias messagessession_startand updatessessionId, instead of keeping a stale id