Optimizely Feature Experimentation Device Mode Integration

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.

Prerequisites

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.

RudderStack maps the track calls with Optimizely’s track calls. You need to implement all Optimizely’s decision-based methods like activate and isFeatureEnabled natively. For more details, refer to Optimizely’s Easy Event Tracking blog and the Optimizely SDK reference Guide.

Adding Optimizely to your mobile project

Follow these steps to add Optimizely Feature Experimentation to your Android Project:

  1. Add the following repository to your app/build.gradle file.
groovy
repositories {
    mavenCentral()
}
  1. After that, add the following dependency in the same file:
groovy
implementation 'com.rudderstack.android.integration:optimizely:0.1.1'
implementation 'com.optimizely.ab:android-sdk:3.0.0'
  1. 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.
groovy
val optimizelyManager =  OptimizelyManager.builder()
            .withSDKKey(<YOUR OPTIMIZELY SDK KEY>)
            .build(this)
  1. Finally, change the initialization of your RudderClient in your Application class:
groovy
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.

Questions? Let's figure it out together.

Join the RudderStack Slack community to connect with other users, customers, and the RudderStack team — or reach out for direct support.