Set server URL during initialization using MixpanelOptions#368
Merged
ketanmixpanel merged 7 commits intomasterfrom Feb 17, 2026
Merged
Set server URL during initialization using MixpanelOptions#368ketanmixpanel merged 7 commits intomasterfrom
ketanmixpanel merged 7 commits intomasterfrom
Conversation
Updated Android implementation to set server URL during initialization using MixpanelOptions.Builder(), making it consistent with iOS behavior. This ensures the server URL is configured before the first network request, enabling proper ad-blocker detection and fallback logic. Changes: - Updated mixpanel-android SDK to v8.3.0 in build.gradle - Modified initialize() to use MixpanelOptions.Builder().setServerURL() - Maintained backward compatibility of setServerURL() @ReactMethod - Made gradlew executable Based on mixpanel-android PR #884
Updated initialize() method to correctly use MixpanelOptions.Builder(): - Use .serverURL() instead of .setServerURL() - Add .optOutTrackingDefault() and .superProperties() to builder - Use correct getInstance(Context, String, boolean, MixpanelOptions) signature This ensures proper configuration during initialization with the new MixpanelOptions API introduced in mixpanel-android 8.3.0.
Updated MixpanelStarter to demonstrate the new serverURL initialization feature. Users can now configure a custom Mixpanel server URL during initialization. Changes: - Added serverURL prop to MixpanelProvider component - Updated MixpanelContext to accept and pass serverURL to init() - Added anser dependency (required by React Native) - Configured example to use EU server (https://api-eu.mixpanel.com)
539ea52 to
bbfce4e
Compare
Collaborator
|
Looks good but we should add tests. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the Android native module implementation to configure the server URL during Mixpanel initialization using the new MixpanelOptions API introduced in mixpanel-android 8.3.0, achieving parity with the iOS implementation. The change enables proper ad-blocker detection by ensuring the server URL is set before the first network request.
Changes:
- Updated Android SDK from 8.2.5 to 8.3.0 and iOS SDK from 5.1.3 to 5.2.0
- Refactored Android initialization to use
MixpanelOptions.Builder()pattern for configuration - Enhanced MixpanelStarter sample app to demonstrate server URL configuration during initialization
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| android/build.gradle | Updated mixpanel-android dependency from 8.2.5 to 8.3.0 |
| android/src/main/java/com/mixpanel/reactnative/MixpanelReactNativeModule.java | Refactored initialize() to use MixpanelOptions.Builder() for setting serverURL, optOutTrackingDefault, and superProperties before instance creation |
| android/gradlew | Added standard Gradle wrapper script for Android builds |
| MixpanelReactNative.podspec | Updated Mixpanel-swift dependency from 5.1.3 to 5.2.0 |
| Samples/MixpanelStarter/src/contexts/MixpanelContext.tsx | Added serverURL parameter support to MixpanelProvider |
| Samples/MixpanelStarter/src/App.tsx | Demonstrates server URL configuration with EU endpoint |
| Samples/MixpanelStarter/package.json | Reordered dependencies alphabetically and added anser package |
| .github/workflows/node.js.yml | Added Podfile.lock cleanup step to ensure clean iOS pod installation |
…tiveModule.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lReactNativeModule.java" This reverts commit 74dd2ce.
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
Updates the Android implementation to set the server URL during Mixpanel initialization using the new
MixpanelOptionsAPI, making it consistent with the iOS implementation and enabling proper ad-blocker detection.Based on mixpanel-android PR #884.
Changes
Updated Dependencies
mixpanel-androidSDK from8.2.5to8.3.0Modified Initialization
initialize()method to useMixpanelOptions.Builder()pattern.serverURL()during initialization (not after).optOutTrackingDefault()and.superProperties()via buildergetInstance()call to use the new 4-parameter signature withMixpanelOptionsBackward Compatibility
setServerURL()@ReactMethod remains unchanged for runtime configurationBenefits
MixpanelOptionsbefore instance creationTesting