feat: pass mParticle CNAME through to Rokt SDK#143
Merged
Conversation
When the integrating app sets a custom CNAME on MParticleOptions via NetworkOptions.customBaseURL, forward it to the Rokt SDK so Rokt traffic routes through the same first-party domain. No-op when customBaseURL is unset, empty, or MParticle is uninitialized. Mirrors the iOS Rokt kit behavior added in mparticle-apple-sdk#760. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9 tasks
thomson-t
previously approved these changes
May 13, 2026
4.14.3 exposes Rokt.setCustomBaseURL(URL) used by the new CNAME passthrough in onKitCreate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
CI failures are expected as the mParticle Core needs to be released in order to reference |
thomson-t
approved these changes
May 13, 2026
thomson-t
added a commit
to mParticle/mparticle-android-sdk
that referenced
this pull request
May 14, 2026
* feat: add customBaseURL CNAME support to NetworkOptions Adds NetworkOptions.Builder.setCustomBaseURL(String) which routes all mParticle endpoint traffic (config, events, identity, alias, audience) through a single HTTPS CNAME host. When set, customBaseURL takes priority over individual domain mappings and rewrites paths to match CDN routing: /config/v4/, /nativeevents/v2/, /identity/v1/, /nativeevents/v1/identity/, /nativeevents/v1/<key>/audience. Also adds R8 keep rules for MParticle$Internal and ConfigManager.getNetworkOptions() so kits can read customBaseURL after minification. The Rokt kit reads NetworkOptions.customBaseURL and forwards it to the Rokt SDK: mparticle-integrations/mparticle-android-integration-rokt#143 Mirrors iOS work from mparticle-apple-sdk#760. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: persist customBaseURL across NetworkOptions JSON round-trip NetworkOptions.toJson() and withNetworkOptions(String) did not include customBaseURL, so any value was silently dropped when UploadSettings serialized NetworkOptions to the upload database. Events and alias uploads read back NetworkOptions without customBaseURL and routed to the default mParticle endpoints instead of the partner CNAME. Also: - Extract the customBaseURL/DomainMapping host-resolution branch out of getUrl() into a private resolveHost() helper plus a small ResolvedHost value type, lowering getUrl()'s cyclomatic complexity. - Switch java.net.URL / java.net.MalformedURLException to imports. - Add two androidTest cases covering the round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(android-core): cover custom base URL upload storage --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Thomson Thomas <thomson.thomas@rokt.com>
jamesnrokt
added a commit
to mParticle/mparticle-android-sdk
that referenced
this pull request
May 20, 2026
* feat: add customBaseURL CNAME support to NetworkOptions Adds NetworkOptions.Builder.setCustomBaseURL(String) which routes all mParticle endpoint traffic (config, events, identity, alias, audience) through a single HTTPS CNAME host. When set, customBaseURL takes priority over individual domain mappings and rewrites paths to match CDN routing: /config/v4/, /nativeevents/v2/, /identity/v1/, /nativeevents/v1/identity/, /nativeevents/v1/<key>/audience. Also adds R8 keep rules for MParticle$Internal and ConfigManager.getNetworkOptions() so kits can read customBaseURL after minification. The Rokt kit reads NetworkOptions.customBaseURL and forwards it to the Rokt SDK: mparticle-integrations/mparticle-android-integration-rokt#143 Mirrors iOS work from mparticle-apple-sdk#760. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat: pass mParticle CNAME through to Rokt SDK When the integrating app sets a custom CNAME on MParticleOptions via NetworkOptions.customBaseURL, forward it to the Rokt SDK so Rokt traffic routes through the same first-party domain. No-op when customBaseURL is unset, empty, or MParticle is uninitialized. Mirrors the iOS Rokt kit behavior added in mparticle-apple-sdk#760. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: persist customBaseURL across NetworkOptions JSON round-trip NetworkOptions.toJson() and withNetworkOptions(String) did not include customBaseURL, so any value was silently dropped when UploadSettings serialized NetworkOptions to the upload database. Events and alias uploads read back NetworkOptions without customBaseURL and routed to the default mParticle endpoints instead of the partner CNAME. Also: - Extract the customBaseURL/DomainMapping host-resolution branch out of getUrl() into a private resolveHost() helper plus a small ResolvedHost value type, lowering getUrl()'s cyclomatic complexity. - Switch java.net.URL / java.net.MalformedURLException to imports. - Add two androidTest cases covering the round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Bump Rokt dependency version * fix: only warn on domain-mapping conflict when mapping is non-default NetworkOptionsManager.validateAndResolve auto-populates a default DomainMapping for every endpoint, so the previous check fired the "customBaseURL is set; domain mapping for X is ignored" warning on every getUrl() call for every endpoint — even when the integrator never configured a custom mapping. Compare against the default URL so the warning only fires for genuinely user-configured mappings that conflict with customBaseURL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <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
RoktKit.onKitCreate, readsMParticle.getInstance().Internal().configManager.networkOptions.customBaseURLand forwards it toRokt.setCustomBaseURL(URL("https://<host>"))beforeRokt.init.applyCustomBaseURLIfSet()method for testability.customBaseURLis null, empty, or MParticle is uninitialized.Pre-merge dependencies
This PR requires two upstream releases before it can be merged/published:
com.rokt:roktsdkrelease containingRokt.setCustomBaseURL(URL)(currently onworkstation/5.0.0in sdk-android-source).com.mparticle:android-corerelease containingNetworkOptions.customBaseURLplus R8 keep rules forMParticle$InternalandConfigManager.getNetworkOptions().A follow-up commit will bump
com.rokt:roktsdkfrom4.14.2to the released 5.x version once available.Test plan
Added 6 unit tests in
RoktKitTests.kt:All 60 unit tests pass locally.
🤖 Generated with Claude Code