feat(audience): fix core bugs and add capabilities for web SDK#2824
Merged
ImmutableJeffrey merged 1 commit intomainfrom Apr 7, 2026
Merged
feat(audience): fix core bugs and add capabilities for web SDK#2824ImmutableJeffrey merged 1 commit intomainfrom
ImmutableJeffrey merged 1 commit intomainfrom
Conversation
2 tasks
|
View your CI Pipeline Execution ↗ for commit bad21ca
☁️ Nx Cloud last updated this comment at |
613d44d to
24a1dd6
Compare
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
reviewed
Apr 6, 2026
nattb8
requested changes
Apr 6, 2026
24a1dd6 to
ac6023c
Compare
nattb8
reviewed
Apr 6, 2026
deb2408 to
f54168f
Compare
nattb8
reviewed
Apr 7, 2026
nattb8
reviewed
Apr 7, 2026
nattb8
reviewed
Apr 7, 2026
f54168f to
7c161d7
Compare
Bug fixes: - Fix generateId fallback to UUID v4 format (backend requires UUID) - Replace sendBeacon with fetch+keepalive (sendBeacon can't set auth header) - Cap batch size at 100 messages per flush (backend maxItems limit) New capabilities: - Export getCookie/setCookie/deleteCookie; add domain param for cross-subdomain - collectContext() now accepts optional library/version params (backward compatible) - Add queue.purge(), transform(), flushUnload(), onFlush, staleFilter - Add storage prefix param for per-surface localStorage isolation - Add transport keepalive option - Add ConsentLevel, ConsentStatus, SESSION_COOKIE shared types - Add validation module (isTimestampValid, isAliasValid, truncate) - Add packages/audience/sdk to pnpm workspace Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7c161d7 to
bad21ca
Compare
nattb8
approved these changes
Apr 7, 2026
bkbooth
added a commit
that referenced
this pull request
Apr 7, 2026
…r, and snippet Add the pixel package scaffold and three self-contained modules that have no dependency on PR #2824. The package builds to a single IIFE bundle (dist/imtbl.js) targeting <10KB gzipped (currently 823 bytes). Modules: - attribution: UTM params, ad click IDs, referrer, landing page (session-cached) - loader: command-queue pattern (window.__imtbl) with pre-load replay - snippet: embeddable <script> tag generator for studio integration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
bkbooth
added a commit
that referenced
this pull request
Apr 7, 2026
…ion cookie Wire the pixel to audience-core now that PR #2824 has merged: - Consent state machine: three-level (none/anonymous/full), DNT/GPC detection, queue purge on downgrade to none, userId strip on downgrade to anonymous, fire-and-forget PUT to /v1/audience/tracking-consent - Session cookie: _imtbl_sid with 30-min rolling expiry - Pixel class: init creates MessageQueue with storagePrefix isolation, auto-fires PageMessage with attribution context, supports identify at full consent, setConsent, and destroy - Build config: resolves audience-core from source via tsup alias for tree-shaken self-contained IIFE bundle (8.04 KB raw / 3.2 KB gzipped) - Metrics stub: no-op stubs so the pixel bundle doesn't ship internal telemetry Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tasks
bkbooth
added a commit
that referenced
this pull request
Apr 7, 2026
…ion cookie Wire the pixel to audience-core now that PR #2824 has merged: - Consent state machine: three-level (none/anonymous/full), DNT/GPC detection, queue purge on downgrade to none, userId strip on downgrade to anonymous, fire-and-forget PUT to /v1/audience/tracking-consent - Session cookie: _imtbl_sid with 30-min rolling expiry - Pixel class: init creates MessageQueue with storagePrefix isolation, auto-fires PageMessage with attribution context, supports identify at full consent, setConsent, and destroy - Build config: resolves audience-core from source via tsup alias for tree-shaken self-contained IIFE bundle (8.04 KB raw / 3.2 KB gzipped) - Metrics stub: no-op stubs so the pixel bundle doesn't ship internal telemetry Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fixes bugs and adds capabilities to
@imtbl/audience-coreneeded by the web SDK and pixel.Bug fixes:
generateIdfallback to UUID v4 format (backend requires UUID)sendBeaconwithfetch+keepalive(sendBeacon can't set thex-immutable-publishable-keyheader — every unload flush was silently rejected)maxItemslimit)New capabilities:
getCookie/setCookie/deleteCookie; adddomainparam for cross-subdomain cookie sharingcollectContext(library, version)so each surface identifies itselfqueue.purge(),transform(),flushUnload(),onFlush,staleFilterstoragePrefixoption for per-surface localStorage isolationkeepaliveoptionConsentLevel,ConsentStatus,SESSION_COOKIE,CONSENT_COOKIEshared typesisTimestampValid,isAliasValid,truncate)No breaking changes to existing core API. All new capabilities are additive (optional params, new exports, new options object on queue constructor).
Test plan
cd packages/audience/core && pnpm test— 54 tests passcd packages/audience/core && pnpm build— builds clean🤖 Generated with Claude Code