From 50e1573411f1497c415f3679bac497e6ef2a5c4c Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Fri, 29 May 2026 10:07:13 -0400 Subject: [PATCH 1/2] docs: add CNAME initialization examples for iOS and Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cordova consumers initialise the mParticle SDK natively from their AppDelegate / Application class, so a custom CNAME endpoint is configured the same way as in any non-Cordova app — via `MPNetworkOptions.customBaseURL` on iOS or `NetworkOptions.withNetworkOptions` on Android. No JS bridge needed. Mirrors the docs portion of mParticle/mparticle-flutter-sdk#73. Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 4 ++++ README.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b507f90..95e035e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- README examples for configuring a custom CNAME endpoint on iOS (`MPNetworkOptions.customBaseURL`) and Android (`NetworkOptions.withNetworkOptions`). + ## [3.0.1] - 2026-05-27 ### Fixed diff --git a/README.md b/README.md index 6dd57a0..d241f9f 100755 --- a/README.md +++ b/README.md @@ -95,6 +95,20 @@ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { } ``` +Optional: if your team uses a custom CNAME endpoint, configure `MPNetworkOptions` separately: + +```swift +let networkOptions = MPNetworkOptions() +networkOptions.customBaseURL = URL(string: "https://rkt.example.com") +mParticleOptions.networkOptions = networkOptions +``` + +```objective-c +MPNetworkOptions *networkOptions = [MPNetworkOptions new]; +networkOptions.customBaseURL = [NSURL URLWithString:@"https://rkt.example.com"]; +mParticleOptions.networkOptions = networkOptions; +``` + Please see [Identity](http://docs.mparticle.com/developers/sdk/ios/identity/) for more information on supplying an `MPIdentityApiRequest` object during SDK initialization. @@ -128,6 +142,26 @@ class MyApplication : Application() { } ``` +Optional: if your team uses a custom CNAME endpoint, configure `NetworkOptions` separately: + +```java +import com.mparticle.networking.NetworkOptions; + +MParticleOptions options = MParticleOptions.builder(this) + .credentials("REPLACE ME WITH KEY", "REPLACE ME WITH SECRET") + .networkOptions(NetworkOptions.withNetworkOptions("https://rkt.example.com")) + .build(); +``` + +```kotlin +import com.mparticle.networking.NetworkOptions + +val options = MParticleOptions.builder(this) + .credentials("REPLACE ME WITH KEY", "REPLACE ME WITH SECRET") + .networkOptions(NetworkOptions.withNetworkOptions("https://rkt.example.com")) + .build() +``` + > **Warning:** It's generally not a good idea to log events in your `Application.onCreate()`. Android may instantiate your `Application` class for a lot of reasons, in the background, while the user isn't even using their device. From eda07b8d3dac88890494438b4e9b4706a5923a64 Mon Sep 17 00:00:00 2001 From: James Newman Date: Tue, 9 Jun 2026 10:23:03 -0400 Subject: [PATCH 2/2] docs: clarify CNAME rationale and use copy-paste-friendly placeholders - Explain *why* to route the Rokt SDK+ through a custom domain (reduces the risk of ad blockers / browsers blocking ads or data) instead of the terse "Optional: if your team uses a custom CNAME endpoint" lead-in, on both the iOS (MPNetworkOptions) and Android (NetworkOptions) examples. - Change the Android credential placeholders to REPLACE_ME_WITH_KEY / REPLACE_ME_WITH_SECRET so they select/copy-paste as single tokens. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d241f9f..518e153 100755 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { } ``` -Optional: if your team uses a custom CNAME endpoint, configure `MPNetworkOptions` separately: +Routing the Rokt SDK+ through your own domain reduces the risk of ad blockers and browsers from blocking ads or data. You can configure this with `MPNetworkOptions`: ```swift let networkOptions = MPNetworkOptions() @@ -128,7 +128,7 @@ class MyApplication : Application() { override fun onCreate() { super.onCreate() val options: MParticleOptions = MParticleOptions.builder(this) - .credentials("REPLACE ME WITH KEY", "REPLACE ME WITH SECRET") + .credentials("REPLACE_ME_WITH_KEY", "REPLACE_ME_WITH_SECRET") .logLevel(MParticle.LogLevel.VERBOSE) .identify(identifyRequest) .identifyTask( @@ -142,13 +142,13 @@ class MyApplication : Application() { } ``` -Optional: if your team uses a custom CNAME endpoint, configure `NetworkOptions` separately: +Routing the Rokt SDK+ through your own domain reduces the risk of ad blockers and browsers from blocking ads or data. You can configure this with `NetworkOptions`: ```java import com.mparticle.networking.NetworkOptions; MParticleOptions options = MParticleOptions.builder(this) - .credentials("REPLACE ME WITH KEY", "REPLACE ME WITH SECRET") + .credentials("REPLACE_ME_WITH_KEY", "REPLACE_ME_WITH_SECRET") .networkOptions(NetworkOptions.withNetworkOptions("https://rkt.example.com")) .build(); ``` @@ -157,7 +157,7 @@ MParticleOptions options = MParticleOptions.builder(this) import com.mparticle.networking.NetworkOptions val options = MParticleOptions.builder(this) - .credentials("REPLACE ME WITH KEY", "REPLACE ME WITH SECRET") + .credentials("REPLACE_ME_WITH_KEY", "REPLACE_ME_WITH_SECRET") .networkOptions(NetworkOptions.withNetworkOptions("https://rkt.example.com")) .build() ```