Disable Production Devices From Connecting To A/B Test Designer

The Messaging and Mobile A/B testing features are not available for purchase and will be deprecated from the product on January 1st, 2022. Read more information on the Mixpanel blog.

By default, Mixpanel A/B testing is enabled in the Mixpanel iOS and Android SDKs, which means any device with your app has the potential to connect to the Mixpanel A/B test designer unless you explicitly remove this ability in your production builds.

Mixpanel uses websockets for the A/B test designer, which means only one connection can happen at a time. If somehow users’ devices are accidentally connecting to the A/B test designer, that means you may be blocked from creating an A/B test (as you will not be able to connect to the designer with your device).

Unable to Connect to A/B Test Designer Due to a Connected Production Device

If you’re currently blocked by not being able to connect to the A/B test designer due to inadvertent connection to the tester by a production device, you can try forcing your app to connect by setting the preprocessor macro DEBUG=1 in your current build (iOS only). This will force the app to attempt to connect every couple of seconds to the websocket. It might take several attempts to beat out other device(s) trying to connect, but it will try the connection every couple of seconds.

Long-Term Fix for Android

To prevent production devices from inadvertently connecting to the A/B test designer, simply add a line to your AndroidManifest.xml file which removes this default behavior:

<meta-data android:name="com.mixpanel.android.MPConfig.DisableGestureBindingUI" android:value="true" />

If you would like to prevent emulated devices from connecting to the A/B test designer you can add the following line to your AndroidManifest.xml file:

<meta-data android:name="com.mixpanel.android.MPConfig.DisableEmulatorBindingUI" android:value="true" />

Long-Term Fix for iOS

On iOS, there is less likelihood of your users connecting to the A/B test designer by accident since it takes the more unnatural four finger touch for there to be a connection. However, you can still disable it in production by adding a line to the preprocessor macros for your podfile:



You may also make an explicit call to [mixpanel setEnableVisualABTestAndCodeless: NO];oracallto mixpanel.enableVisualEditorForCodeless = false in our Swift SDK.


Did this answer your question?



Article is closed for comments.