A/B testing in mobile apps.
pod 'Proba'
- Select File > Swift Packages > Add Package Dependency. Enter https://github.com/proba-ai/proba-sdk-ios.git in the "Enter Package Repository URL" dialog.
- In the next page, specify the version resolving rule as "Up to Next Major" with "0.2.6" as its earliest version.
- After Xcode checking out the source and resolving the version, you can choose the "Proba" library and add it to your app target.
Download ZIP and copy folder Proba to your app.
import Proba
let proba = Proba(sdkToken: "<YOUR_SDK_TOKEN>",
appId: "<YOUR_APP_ID>",
deviceId: "<YOUR_DEVICE_ID>", // optional, UUID generated by default
deviceProperties: [
"installedAt": "2021-05-20T09:55:05.000+03:00"
], // optional, additional information about device
appsFlyerId: AppsFlyerTracker.shared().getAppsFlyerUID(), // optional, if AppsFlyer integration is needed (import AppsFlyerLib before)
amplitudeUserId: Amplitude.instance().userId, // optional, if Amplitude integration is needed (import Amplitude before)
usingShake: false, // true by default for debug mode, turn it off if you are already using shake motion in your app for other purposes
defaults: [
"<TEST_1_KEY>": "<TEST_1_DEFAULT_VALUE>",
"<TEST_2_KEY>": "<TEST_2_DEFAULT_VALUE>"
])
proba.fetch(completion: { error in })
let value: String? = proba["<TEST_KEY>"]
or
let value: String? = proba.value("<TEST_KEY>")
In case of problems with no internet connection or another, the values obtained in the previous session will be used, or if they are missing, the default values specified during initialization will be used.
let experiments = proba.experiments()
// or if you need tech details
// let experiments = proba.experimentsWithDetails()
// i.e. set Amplitude user properties
Amplitude.instance().setUserProperties(experiments);
You can disable the sending of events to analytics if debug mode is turn on.
if ProbaDebugMode.isOn {
// hold sending events
}
Before debug make sure that debug-mode for your App is turned-on on settings page
proba.showDebug = true // false by default, to print all debugging info in the console
proba.log = { text in } // to define your own log handler
let duration = proba.lastOperationDuration // the duration of the last operation in seconds
In debug mode you can see all actual tests and check how the user will see each option of the test. To show the debug menu you just need to turn it on in your personal cabinet and call
ProbaDebugMode.showMenu(from: <yourViewController>)
or you can inherit some of your UIViewController
's from ProbaShakeToDebugController
and just make shake motion on your iPhone or simulator.
==================================================
You can see the example of usage in the attached project.