Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Set up mParticle

This topic describes how to send Optimizely experiment information from your Android and iOS apps to mParticle for further analysis.

The mParticle integration uses the Optimizely DECISION notification listener and the Activate, Get Enabled Features, Get Feature Variable, and Is Feature Enabled methods.

When any of these methods are called, this triggers the DECISION notification listener to send an event containing user, experiment, and variation data as input to mParticle. Once the integration is complete, you can expect to see the event in your Optimizely input feed on the mParticle Live Stream dashboard within 1 minute.

Before setting up Optimizely as input data for mParticle, we recommend that you review mParticleโ€™s documentation on the Optimizely integration.

mParticle and Android

If you are getting started, read mParticle Getting Started guide for the Android SDK.

Step 1: Prerequisites

  • Make sure that the required experiment is running in Optimizely.
  • Install the mParticle SDK with the additional Optimizely kit on the Android app.

Step 2: Enable the integration

The example code below sends an DECISION notification listener that contains information about the user, experiment, and variation to mParticle in an event called Experiment Viewed.



You can customize the event name and also specify which event tags are included the event payload.

import com.mparticle.MParticle;
OptimizelyClient optimizelyClient = optimizelyManager.getOptimizely();
// Add a DECISION listener
int notificationId = optimizelyClient.getNotificationCenter().addNotificationListener(NotificationCenter.NotificationType.Decision, new DecisionNotificationListener() {
  public void onActivate(Experiment experiment,
                    String userId,
                    Map<String, String> attributes,
                    Variation variation) {
    String experimentId = experiment.getId();
    String experimentKey = experiment.getKey();
    String variationId = variation.getId();
    String variationKey = variation.getKey();
	Map<String, String> eventInfo = new HashMap<String, String>(2);
    eventInfo.put("experimentId", experimentId);
    eventInfo.put("experimentName", experimentKey);
    eventInfo.put("variationId", variationId);
    eventInfo.put("variationName", variationKey);
   MPEvent event = new MPEvent.Builder("Experiment Viewed", 	EventType.Transaction)
                .category("AB Test")

mParticle and Optimizely integration via CocoaPods

You can add the mParticle - Optimizely integration kit to your iOS app using CocoaPods. For more information, see the mParticle - Optimizely article on the CocoaPods website.

Q/A and troubleshooting

To verify the integration is working, check the Optimizely input feed of the mParticle Live Stream dashboard. You should see the sent event (Experiment Viewed, or your customized name) within 3-5 minutes after completing the integration. If you do not see the event, make sure your experiment is running correctly in Optimizely.



mParticle uses dollars and Optimizely uses cents. mParticle handles the conversion to dollars.

Unsupported platforms

Optimizely does not have a suggested solution for integrating mParticle with our SDKs for these platforms:

  • Agent
  • Go
  • C#
  • Java
  • JavaScript
  • Node
  • PHP
  • Python
  • Ruby