Skip to content

Attach sessionId to every outbound Audience message#813

Draft
nattb8 wants to merge 1 commit into
mainfrom
feat/sdk-627-session-id-every-event
Draft

Attach sessionId to every outbound Audience message#813
nattb8 wants to merge 1 commit into
mainfrom
feat/sdk-627-session-id-every-event

Conversation

@nattb8

@nattb8 nattb8 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Why

session_id was only attached to the three session-lifecycle events (session_start, session_heartbeat, session_end) via manual properties writes. Every other event, custom Track() calls, Identify(), Alias(), and built-ins like game_launch, shipped with zero session correlation. 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

sessionId is now on the top-level envelope for every message type: Track, Identify, Alias, sourced from the active session so no call site has to remember to add it. The existing properties["session_id"] writes on the three lifecycle events are kept unchanged, Unity carries the field in both places for now (the web SDK equivalent dropped its nested field entirely after confirming nothing downstream depends on it).

Linear: SDK-627

Test plan

  • Tests pass (dotnet test src/Audience.Build/Audience.Tests/Audience.Tests.csproj)
  • New/updated tests cover: sessionId present on Track/Identify/Alias envelopes; session_end carries the ending session's id, not null; no sessionId with no active session
  • Lint/format passes (no lint step exists for this package)

session_id was previously only attached to session_start/heartbeat/end via manual properties writes, leaving custom Track calls, Identify, Alias, and built-ins like game_launch with no session correlation. Session now passes its captured session id through the TrackDelegate so ImmutableAudience can stamp a sessionId field on every message envelope automatically, including for session_end where the id must come from the value captured before Session resets its live state.
@nattb8 nattb8 force-pushed the feat/sdk-627-session-id-every-event branch from 951f64f to 9a0c1ef Compare July 7, 2026 02:54
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Audience SDK — Build Size

Platform SDK Size Change
Android 0.37 / 20.00 MB +0.00 MB
Windows 0.16 / 20.00 MB +0.00 MB
iOS 8.54 / 20.00 MB +0.02 MB
macOS 0.92 / 20.00 MB +0.02 MB

SDK Size = build minus empty app. Change = vs baseline. Fails if any platform exceeds its absolute size limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant