feat(audience): remove sandbox env routing, add testMode (SDK-357)#2872
Merged
Conversation
Removes getBaseUrl() and the pk_imapik-test- prefix check that routed events to api.sandbox.immutable.com, which is being decommissioned. Adds testMode init option to both the pixel and SDK — when true, every outbound event carries a top-level test: true field so the backend can filter test data from production analytics. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
View your CI Pipeline Execution ↗ for commit ad0f604
☁️ Nx Cloud last updated this comment at |
✅ Audience Bundle Size — @imtbl/audience
Budget: 24.00 KB gzipped (warn at 20.00 KB) |
✅ Pixel Bundle Size — @imtbl/pixel
Budget: 10.00 KB gzipped (warn at 8.00 KB) |
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 13e8cf5. Configure here.
…EADMEs Updates the 8 stale sandbox URL assertions in consent.test.ts and queue.test.ts that bugbot flagged — they referenced api.sandbox URLs that no longer get produced after the getBaseUrl removal. Drops the Test Mode README sections. The option is for internal/non-prod use, similar to baseUrl which is also undocumented. Still discoverable via TypeScript IntelliSense. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nattb8
previously approved these changes
May 13, 2026
nattb8
reviewed
May 13, 2026
Contributor
nattb8
left a comment
There was a problem hiding this comment.
Need another PR to update the sample app?
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove api.sandbox.immutable.com from CSP and environment dropdown - Add testMode checkbox in Advanced section, wired into Audience.init() - Update package.json description Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ptions Group it with the other configuration sections (Consent Modes, Auto-Tracked Events) instead of orphaning it after the operational details (Cookies, CSP, Browser Support). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Web SDK README documents zero init options inline — everything is shown in the quickstart snippet and otherwise deferred to the docs site. Singling out testMode violated that pattern. Pixel README keeps its Test mode section, matching its existing convention of documenting consent / autocapture options inline. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nattb8
reviewed
May 15, 2026
nattb8
previously approved these changes
May 15, 2026
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nattb8
approved these changes
May 15, 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
getBaseUrl()and thepk_imapik-test-key prefix check that routed events toapi.sandbox.immutable.com(being decommissioned). Default base URL is now alwayshttps://api.immutable.com; dev routing continues via the existingbaseUrloverride.testMode?: booleantoPixelInitOptionsandAudienceConfig. Whentrue, all outbound events carry a top-leveltest: truefield so the backend can filter test traffic from production analytics.Closes SDK-357. Sub-issue of SDK-351 (Sandbox Removal).
Changed files
core/src/config.tsTEST_KEY_PREFIX,getBaseUrl(). AddedBASE_URLconstant.core/src/config.test.tscore/src/types.tstest?: truetoBaseMessage.core/src/queue.tsBASE_URLinstead ofgetBaseUrl(publishableKey).core/src/consent.tsBASE_URLinstead ofgetBaseUrl(publishableKey).pixel/src/pixel.tstestModetoPixelInitOptions, instance property, andbuildBase().sdk/src/types.tstestModetoAudienceConfigwith JSDoc.sdk/src/sdk.tstestModeinstance property, wired intobaseMessage().pixel/README.mdsdk/README.mdTest plan
@imtbl/audience-coreunit tests pass@imtbl/pixelunit tests pass@imtbl/audienceunit tests passeslintpasses on all changed files (lint-staged ran at commit)test: truetop-level field is handled correctly on ingest🤖 Generated with Claude Code
Note
Medium Risk
Changes the default ingest/consent endpoints to always use production and removes key-based sandbox routing, which could redirect real traffic if callers relied on the old behavior. Adds an optional
testModeflag that alters outbound event payloads by tagging messages withtest: true.Overview
Removes sandbox environment routing by deleting
getBaseUrl()/test-key prefix logic and standardizing the default API base toBASE_URL = https://api.immutable.comfor both ingest (MessageQueue) and consent sync (createConsentManager), withbaseUrlremaining as the only override.Adds test event tagging via a new
testMode?: booleanoption in both the web SDK and pixel; when enabled, all emitted messages include a top-leveltest: truefield (type updates inaudience-core), and docs/sample app UI are updated accordingly.Reviewed by Cursor Bugbot for commit ad0f604. Bugbot is set up for automated code reviews on this repo. Configure here.