Send events to Optimizely Feature Experimentation using RudderStack’s device mode.
RudderStack lets you send the experimentation data from your mobile apps to Optimizely Feature Experimentation via device mode.
Unlike other destinations, Optimizely Feature Experimentation for the mobile integration works a little differently. You will have to implement some Optimizely functions natively to make sure the experiment logic runs correctly.
Follow these steps to add Optimizely Feature Experimentation to your Android Project:
- Add the following
repository
to your app/build.gradle
file.
repositories {
mavenCentral()
}
- After that, add the following
dependency
in the same file:
implementation 'com.rudderstack.android.integration:optimizely:0.1.1'
implementation 'com.optimizely.ab:android-sdk:3.0.0'
- Initialize the Optimizely Manager:
Optimizely recommends initializing their SDK as soon as possible. You need to initialize the Optimizely Manager before proceeding to the next step. Refer to the Optimizely
Initializing the SDK guide for more information.
val optimizelyManager = OptimizelyManager.builder()
.withSDKKey(<YOUR OPTIMIZELY SDK KEY>)
.build(this)
- Finally, change the initialization of your
RudderClient
in your Application
class:
val rudderClient = RudderClient.getInstance(
this,
<YOUT_WRITE_KEY>,
RudderConfig.Builder()
.withEndPointUri(<YOUR_DATA_PLANE_URL>)
.withFactory(OptimizelyIntegrationFactory.FACTORY(optimizelyManager)
.build()
)
Make sure you pass the Optimizely manager instance you created in the previous step to the factory as shown in the above snippet above.
Follow these steps to add Optimizely Feature Experimentation to your iOS project:
- Go your
Podfile
and add the Rudder-Optimizely
extension:
- After adding the dependency followed by
pod install
, you can add the imports to your AppDelegate.m
file as shown:
#import "RudderOptimizelyFactory.h"
- Finally, change the initialization of your
RudderClient
as shown:
RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];
[builder withDataPlaneUrl:DATA_PLANE_URL];
// Setup optimizely logger.
OPTLYLoggerDefault *optlyLogger = [[OPTLYLoggerDefault alloc] initWithLogLevel:OptimizelyLogLevelAll];
// Create an Optimizely manager
self.optlyManager = [[OPTLYManager alloc] initWithBuilder:[OPTLYManagerBuilder builderWithBlock:^(OPTLYManagerBuilder * _Nullable builder) {
builder.sdkKey = @<SDK KEY>;
builder.logger = optlyLogger;
}]];
[builder withFactory:[RudderOptimizelyFactory instanceWithOptimizely:self.optlyManager]];
[builder withLoglevel:RSLogLevelDebug];
[RSClient getInstance:WRITE_KEY config:[builder build]];