Data Subject Request API Version 1 and 2
Data Subject Request API Version 3
Platform API Overview
Accounts
Apps
Audiences
Calculated Attributes
Data Points
Feeds
Field Transformations
Services
Users
Workspaces
Warehouse Sync API Overview
Warehouse Sync API Tutorial
Warehouse Sync API Reference
Data Mapping
Warehouse Sync SQL Reference
Warehouse Sync Troubleshooting Guide
ComposeID
Warehouse Sync API v2 Migration
Custom Access Roles API
Bulk Profile Deletion API Reference
Data Planning API
Group Identity API Reference
Calculated Attributes Seeding API
Pixel Service
Profile API
Events API
mParticle JSON Schema Reference
IDSync
AMP SDK
Initialization
Configuration
Network Security Configuration
Event Tracking
User Attributes
IDSync
Screen Events
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
WebView Integration
Logger
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting the Android SDK
API Reference
Upgrade to Version 5
Cordova Plugin
Identity
Direct URL Routing FAQ
Web
Android
iOS
Initialization
Configuration
Event Tracking
User Attributes
IDSync
Screen Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
Webview Integration
Upload Frequency
App Extensions
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting iOS SDK
Social Networks
iOS 14 Guide
iOS 15 FAQ
iOS 16 FAQ
iOS 17 FAQ
iOS 18 FAQ
API Reference
Upgrade to Version 7
Getting Started
Identity
Upload Frequency
Getting Started
Opt Out
Initialize the SDK
Event Tracking
Commerce Tracking
Error Tracking
Screen Tracking
Identity
Location Tracking
Session Management
Initialization
Configuration
Content Security Policy
Event Tracking
User Attributes
IDSync
Page View Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Custom Logger
Persistence
Native Web Views
Self-Hosting
Multiple Instances
Web SDK via Google Tag Manager
Preventing Blocked HTTP Traffic with CNAME
Facebook Instant Articles
Troubleshooting the Web SDK
Browser Compatibility
Linting Data Plans
API Reference
Upgrade to Version 2 of the SDK
Getting Started
Identity
Web
Alexa
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 9. Test your local app
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 1. Create an input
Step 2. Create an output
Step 3. Verify output
Node SDK
Go SDK
Python SDK
Ruby SDK
Java SDK
Introduction
Outbound Integrations
Firehose Java SDK
Inbound Integrations
Compose ID
Data Hosting Locations
Glossary
Migrate from Segment to mParticle
Migrate from Segment to Client-side mParticle
Migrate from Segment to Server-side mParticle
Segment-to-mParticle Migration Reference
Rules Developer Guide
API Credential Management
The Developer's Guided Journey to mParticle
Create an Input
Start capturing data
Connect an Event Output
Create an Audience
Connect an Audience Output
Transform and Enhance Your Data
The new mParticle Experience
The Overview Map
Introduction
Data Retention
Connections
Activity
Live Stream
Data Filter
Rules
Tiered Events
mParticle Users and Roles
Analytics Free Trial
Troubleshooting mParticle
Usage metering for value-based pricing (VBP)
Introduction
Sync and Activate Analytics User Segments in mParticle
User Segment Activation
Welcome Page Announcements
Project Settings
Roles and Teammates
Organization Settings
Global Project Filters
Portfolio Analytics
Analytics Data Manager Overview
Events
Event Properties
User Properties
Revenue Mapping
Export Data
UTM Guide
Data Dictionary
Query Builder Overview
Modify Filters With And/Or Clauses
Query-time Sampling
Query Notes
Filter Where Clauses
Event vs. User Properties
Group By Clauses
Annotations
Cross-tool Compatibility
Apply All for Filter Where Clauses
Date Range and Time Settings Overview
Understanding the Screen View Event
Analyses Introduction
Getting Started
Visualization Options
For Clauses
Date Range and Time Settings
Calculator
Numerical Settings
Assisted Analysis
Properties Explorer
Frequency in Segmentation
Trends in Segmentation
Did [not] Perform Clauses
Cumulative vs. Non-Cumulative Analysis in Segmentation
Total Count of vs. Users Who Performed
Save Your Segmentation Analysis
Export Results in Segmentation
Explore Users from Segmentation
Getting Started with Funnels
Group By Settings
Conversion Window
Tracking Properties
Date Range and Time Settings
Visualization Options
Interpreting a Funnel Analysis
Group By
Filters
Conversion over Time
Conversion Order
Trends
Funnel Direction
Multi-path Funnels
Analyze as Cohort from Funnel
Save a Funnel Analysis
Explore Users from a Funnel
Export Results from a Funnel
Saved Analyses
Manage Analyses in Dashboards
Dashboards––Getting Started
Manage Dashboards
Dashboard Filters
Organize Dashboards
Scheduled Reports
Favorites
Time and Interval Settings in Dashboards
Query Notes in Dashboards
User Aliasing
The Demo Environment
Keyboard Shortcuts
Analytics for Marketers
Analytics for Product Managers
Compare Conversion Across Acquisition Sources
Analyze Product Feature Usage
Identify Points of User Friction
Time-based Subscription Analysis
Dashboard Tips and Tricks
Understand Product Stickiness
Optimize User Flow with A/B Testing
User Segments
IDSync Overview
Use Cases for IDSync
Components of IDSync
Store and Organize User Data
Identify Users
Default IDSync Configuration
Profile Conversion Strategy
Profile Link Strategy
Profile Isolation Strategy
Best Match Strategy
Aliasing
Overview
Create and Manage Group Definitions
Introduction
Catalog
Live Stream
Data Plans
Blocked Data Backfill Guide
Predictive Attributes Overview
Create Predictive Attributes
Assess and Troubleshoot Predictions
Use Predictive Attributes in Campaigns
Predictive Audiences Overview
Using Predictive Audiences
Introduction
Profiles
Warehouse Sync
Data Privacy Controls
Data Subject Requests
Default Service Limits
Feeds
Cross-Account Audience Sharing
Approved Sub-Processors
Import Data with CSV Files
CSV File Reference
Glossary
Video Index
Single Sign-On (SSO)
Setup Examples
Introduction
Introduction
Introduction
Rudderstack
Google Tag Manager
Segment
Advanced Data Warehouse Settings
AWS Kinesis (Snowplow)
AWS Redshift (Define Your Own Schema)
AWS S3 Integration (Define Your Own Schema)
AWS S3 (Snowplow Schema)
BigQuery (Snowplow Schema)
BigQuery Firebase Schema
BigQuery (Define Your Own Schema)
GCP BigQuery Export
Snowflake (Snowplow Schema)
Snowplow Schema Overview
Snowflake (Define Your Own Schema)
Aliasing
Event
Event
Audience
Audience
Event
Feed
Event
Cookie Sync
Audience
Audience
Audience
Audience
Event
Feed
Event
Event
Audience
Event
Data Warehouse
Event
Event
Event
Event
Audience
Event
Feed
Event
Event
Event
Event
Event
Audience
Event
Event
Feed
Event
Event
Audience
Feed
Event
Event
Event
Custom Feed
Data Warehouse
Event
Event
Audience
Audience
Audience
Event
Audience
Event
Event
Event
Event
Event
Audience
Audience
Event
Audience
Data Warehouse
Event
Event
Cookie Sync
Audience
Event
Event
Event
Event
Event
Feed
Feed
Event
Event
Event
Audience
Event
Event
Audience
Event
Event
Event
Audience
Feed
Audience
Event
Event
Audience
Audience
Event
Audience
Audience
Event
Audience
Event
Event
Event
Event
Event
Feed
Event
Event
Event
Event
Audience
Feed
Event
Event
Event
Event
Event
Event
Event
Feed
Audience
Event
Event
Custom Pixel
Feed
Event
Event
Event
Event
Event
Audience
Event
Event
Event
Data Warehouse
Event
Audience
Audience
Audience
Audience
Event
Audience
Audience
Cookie Sync
Event
Feed
Event
Audience
Event
Audience
Audience
Event
Event
Event
Event
Cookie Sync
Audience
Cookie Sync
Audience
Feed
Audience
Event
Optimizely provides easy-to-use A/B testing solutions, allowing dynamic experimentation in your web, iOS, and Android apps.
This integration allows you to send events tracked in mParticle to Optimizely to give further visibility into how the experiments you are running impact your engagement metrics. Use it to reduce the time it takes to evaluate an experiment by leveraging the events you already record with mParticle.
mParticle supports 2 Optimizely products for your needs:
If you want to use both Optimizely Web and Optimizely Full Stack (Web), add 2 Optimizely connections to your JS input. To enable Full Stack in one of those connections, select Use Full Stack
. Full Stack is assumed for Android and iOS.
In order to enable mParticle’s integration with Optimizely, you will need your Optimizely SDK Key.
Note: as noted on the Optimizely website, earlier versions of their SDK use a Project ID rather than an SDK Key to create a manager. Project IDs are still supported in 2.x backwards compatibility. Versions 1.x and 2.x can use only a Project ID, while 3.0+ can use a Project ID or SDK key to instantiate the client with the datafile. The benefit of using an SDK Key is that you can retrieve datafiles for other environments and not just the primary environment as when you use a Project ID. See Initialize a mobile SDK for clarification.
Optimizely does not accept PII, so while mParticle allows for email addresses to be used to identify users, an anonymous user ID is required to send with the mParticle events that are sent to Optimizely. Additionally, the user ID used for the mParticle event must be the same that is passed into the Optimizely activate call. Please see Optimizely’s documentation regarding user IDs and event tracking for more information.
The mParticle Web SDK will automatically load the Optimizely JavaScript snippet for your SDK Key or Project ID once you’ve configured it in your mParticle dashboard. If you would like to load the Optimizely snippet yourself you can do so and, once enabled, mParticle will look for window.optimizely
to prevent duplicate loading. In either case, mParticle will still forward events to the Optimizely object that is loaded.
While allowing mParticle to automatic load Optimizely reduces the amount of code you need to write, you may choose to initialize Optimizely yourself to prevent “page flashing” in the case where an Optimizely experiment is expected to alter the UI immediately on load. You can read more about this concern here and make the choice that’s best for your setup.
The mParticle Web SDK will automatically load the Optimizely Full Stack Javascript snippet for your SDK Key once you’ve configured it in your mParticle dashboard. You may choose to initialize the Optimizely Full Stack SDK yourself to improve load times by requiring @optimizely/optimizely-sdk
and creating an optimizelyClientInstance
attached to window
. Note that mParticle will only recognize window.optimizelyClientInstance
to prevent duplicate loading. In either case, mParticle will map events to an Optimizely track
event once loaded. All decision-based API methods, such as activate
and isFeatureEnabled
, must be implemented by customers natively.
mParticle’s Optimizely integration requires that you add the Optimizely Kit to your iOS or Android app.
mParticle publishes the Optimizely Kit as separate iOS and Android libraries which have transitive dependencies on the mParticle Core SDK as well as the Optimizely SDK.
# Sample Podfile
source 'https://github.com/CocoaPods/Specs.git'
target '<Your Target>' do
pod 'mParticle-Optimizely'
end
// Sample build.gradle
// Add the kit dependency
dependencies {
// Ensure the Kit version matches that of the mParticle Core SDK that you're using
compile 'com.mparticle:android-optimizely-kit:5+'
}
Reference the Apple SDK and Android SDK guides to read more about kits.
The mParticle integration will take care of initializing the Optimizely client for you with your configured SDK Key or Project ID, or you can initialize it yourself.
On iOS and Android, you can directly access the Optimizely Client that is created. For Web, use window.optimizely
and for Web Full Stack, use window.optimizelyClientInstance
.
//save this reference to the client for later use
[MParticle sharedInstance] kitInstance:[NSNumber numberWithLong:MPKitInstanceOptimizely] completionHandler:^(id *kitInstance) {
OPTLYClient *client = [MPKitOptimizely optimizelyClient];
}];
let client = MParticle.sharedInstance()
OptimizelyKit.getOptimizelyClient(new OptimizelyKit.OptimizelyClientListener() {
@Override
public void onOptimizelyClientAvailable(OptimizelyClient optimizelyClient) {
//save this reference to the client for later use
}
});
If you’d like to initialize the Optimizely client yourself you can do so, and tell mParticle to use it:
// Create the builder and manager. Then set the datafile manager
OPTLYManagerBuilder *builder = [OPTLYManagerBuilder builderWithBlock:^(OPTLYManagerBuilder * _Nullable builder) {
builder.projectId = @"projectId"; //called sdk key in Optimizely console but projectID in their docs
}];
OPTLYManager *manager = [[OPTLYManager alloc] initWithBuilder:builder];
// Synchronously initialize the client, then activate the client
OPTLYClient *client = [manager initialize];
// Get the reference to the kit and set client
MPKitOptimizely.optimizelyClient = client;
// Or, asynchronously initialize the client, then activate the client
[manager initializeWithCallback:^(NSError * _Nullable error,
OPTLYClient * _Nullable client) {
//Get the reference to the kit and set client
MPKitOptimizely.optimizelyClient = client;
}];
let builder = OPTLYManagerBuilder(block: { builder in
builder?.projectId = "projectId"
})
let manager = OPTLYManager(builder: builder)
let client = manager.initialize()
MPKitOptimizely.optimizelyClient = client
manager.initialize(withCallback: { error, client in
MPKitOptimizely.optimizelyClient = client
})
OptimizelyManager.Builder builder = OptimizelyManager.builder()
.withSDKKey("project_id")
.build(getApplicationContext())
optimizelyManager.initialize(this, new OptimizelyStartListener() {
@Override
public void onStart(OptimizelyClient optimizely) {
// Set the Optimizely client on mParticle
OptimizelyKit.setOptimizelyClient(optimizely);
}
});
var optimizely = require('@optimizely/optimizely-sdk');
// Instantiate an Optimizely client
window.optimizelyClientInstance = optimizely.createInstance({
datafile: window.optimizelyDatafile,
});
See Optimizely’s docs for a more in-depth explanation.
The mParticle Optimizely Web integration will look for window.optimizely
and use that if present. You can also use this object to access the Optimizely Web client directly.
The mParticle Optimizely Full Stack integration will look for window.optimizelyClientInstance
and use that if present. You can also use this object to access the Optimizely Full Stack client that the integration automatically initializes if you are not initializing it yourself.
Once you have a reference to the Optimizely client, you can use it to activate an experiment. It’s crucial that you do so using the same user ID that the mParticle integration is configured to use, so that events are associated with the correct user.
By default, mParticle will use the device application stamp if present. See below for more information on the supported identity types. If you’ve configured a different ID than device application stamp, be sure to use that ID (if present) to activate experiments.
See Optimizely’s docs for a more in-depth explanation.
// Conditionally activate an experiment for the provided user
OPTLYVariation *variation = [MPKitOptimizely.optimizelyClient activate:@"my_experiment"
userId:[MParticle sharedInstance].identity.deviceApplicationStamp //or another appropriate id
];
if ([variation.variationKey isEqualToString:@"control"]) {
// Execute code for control variation
}
else if ([variation.variationKey isEqualToString:@"treatment"]) {
// Execute code for treatment variation
}
else {
// Execute default code
}
// Conditionally activate an experiment for the provided user
let variation = MPKitOptimizely.optimizelyClient.activate("my_experiment", userId: MParticle.sharedInstance().identity.deviceApplicationStamp /*or another appropriate id */)
if (variation?.variationKey == "control") {
// Execute code for control variation
} else if (variation?.variationKey == "treatment") {
// Execute code for treatment variation
} else {
// Execute default code
}
Variation variation = optimizelyClient.activate(experimentKey, MParticle.getInstance().Identity().getDeviceApplicationStamp());
if (variation != null) {
if (variation.is("control")) {
// Execute code for control variation
} else if (variation.is("treatment")) {
// Execute code for treatment variation
}
} else {
// Execute default code
}
You can activate an experiment on web using exactly the same code as a standard Optimizely implementation.
See Optimizely’s docs for a more in-depth explanation.
You can enable event tracking with Optimizely Full Stack by setting up a new experiment in Optimizely and defining events
and attributes
in your Optimizely dashboard that you want to capture and report on.
See Optimizely’s docs for a more in-depth explanation on adding events to experiments.
All events sent to Optimizely must be tagged with a user ID. With mParticle’s integration you have the option to configure which user or device identity type should be mapped to the Optimizely User ID. This is present as a connection setting when configuring Optimizely in your mParticle dashboard. The following user identities are supported:
Note: For anonymous users, when your configured ID is not present, the integration will default to Device Application Stamp, which is always present.
The Optimizely Web client platform does not currently support user ID values at this time. As soon as this becomes available, we’ll be sure to update the mParticle integration to send it!
mParticle forwards the following event types:
On iOS, Android and Full Stack these events are mapped to Optimizely’s track
API and will include the name of the event, custom attributes, user attributes, and your configured user ID. On Web, the events are pushed into the window.optimizely
queue to be sent to the server.
You can create custom mappings from an event attribute to the Optimizely value
attribute.
Optimizely supports several “reserved” event tags including “revenue” and “value”. See the sections below for how mParticle maps to these tags.
mParticle will map Purchase-type CommerceEvent
’s as Optimizely revenue events, mapping the CommerceEvent
revenue to Optimizely’s revenue
event tag.
mParticle will use the default CommerceEvent
purchase event name “eCommerce - purchase - Total” when invoking Optimizely’s track
API. You may override this name by setting a Custom Flag on the given CommerceEvent:
MPProduct *product = [[MPProduct alloc] initWithName:@"Foo name"
sku:@"Foo sku"
quantity:@4
price:@100.00];
MPTransactionAttributes *attributes = [[MPTransactionAttributes alloc] init];
attributes.transactionId = @"foo-transaction-id";
// mapped to Optimizely as 45000 cents
attributes.revenue = @450.00;
attributes.tax = @30.00;
attributes.shipping = @30;
MPCommerceEventAction action = MPCommerceEventActionPurchase;
MPCommerceEvent *event = [[MPCommerceEvent alloc] initWithAction:action
product:product];
// mapped to Optimizely as a custom event name
[event addCustomFlag:@"custom revenue event name"
withKey:MPKitOptimizelyEventName];
event.transactionAttributes = attributes;
[[MParticle sharedInstance] logCommerceEvent:event];
let product = MPProduct(name: "Foo name", sku: "Foo sku", quantity: NSNumber(value: 4), price: NSNumber(value: 100.00))
let attributes = MPTransactionAttributes()
attributes.transactionId = "foo-transaction-id"
// mapped to Optimizely as 45000 cents
attributes.revenue = NSNumber(value: 450.00)
attributes.tax = NSNumber(value: 30.00)
attributes.shipping = NSNumber(value: 30)
let action = MPCommerceEventActionPurchase as? MPCommerceEventAction
let event = MPCommerceEvent(action: action, product: product)
// mapped to Optimizely as a custom event name
event.addCustomFlag("custom revenue event name", withKey: MPKitOptimizelyEventName)
event.transactionAttributes = attributes
MParticle.sharedInstance().logCommerceEvent(event)
Product product = new Product.Builder("Foo name", "Foo sku", 100.00)
.quantity(4)
.build();
TransactionAttributes attributes = new TransactionAttributes("foo-transaction-id")
// mapped to Optimizely as 45000 cents
.setRevenue(450.00);
CommerceEvent event = new CommerceEvent.Builder(Product.PURCHASE, product)
// mapped to Optimizely as a custom event name
.addCustomFlag(OptimizelyKit.OPTIMIZELY_EVENT_NAME, "custom revenue event name")
.transactionAttributes(attributes)
.build();
MParticle.getInstance().logEvent(event);
var product1 = mParticle.eCommerce.createProduct('Foo name', 'Foo sku', 100, 4),
shipping = 30,
tax = 30,
ta = mParticle.eCommerce.createTransactionAttributes('foo-transaction-id', 'foo-affiliation', 'foo-coupon', 400, shipping, tax),
logPurchaseBoolean = false,
attributes = {foo: 'bar'},
// mapped to Optimizely as a custom event name if Web
customFlags = {'Optimizely.EventName': 'custom revenue event name'};
//mapped to Optimizely as a custom event name if Full Stack
customFlags = {'OptimizelyFullStack.EventName': 'custom revenue event name'};
mParticle.eCommerce.logPurchase(ta, product1, logPurchaseBoolean, attributes, customFlags);
You may also include Optimizely’s “revenue” tag as a custom attribute of any event (Commerce or Custom events) and it will be forwarded to Optimizely as such.
Optimizely supports a reserved “value” event tag to associate a scalar value to a given event. You may include “value” as custom event attribute, or you can include this as a custom flag. The custom flag lets you stick to your dedicated taxonomy for custom attributes while also sending this reserved tag to Optimizely.
MPEvent *event = [[MPEvent alloc] initWithName:@"Foo conversion event"
type:MPEventTypeOther;
// "10" will be parsed as a number and sent to Optimizely
[event addCustomFlag:@"10"
withKey:MPKitOptimizelyEventKeyValue];
[[MParticle sharedInstance] logEvent:event];
let client = MParticle.sharedInstance()
var event: MPEvent?
event.setValue(10, forKey: "MPKitOptimizelyEventKeyValue")
client.logEvent(event)
Map flags = new HashMap<>();
// "10" will be parsed as a double and sent to Optimizely
flags.put(OptimizelyKit.OPTIMIZELY_VALUE_KEY, "10");
MPEvent event = new MPEvent.Builder("Foo conversion event")
.info(flags)
.build();
MParticle.getInstance().logEvent(event);
var eventType = mParticle.EventType.Other,
attributes = {foo: 'bar'},
customFlags = {'Optimizely.Value': 15};
mParticle.logEvent('Foo conversion event', eventType, attributes, customFlags);
Optimizely works great on Single Page Applications (SPAs). Review this in depth article about how to set up your Optimizely settings and pages properly in order to avoid issues with Optimizely on your SPA. mParticle’s Optimizely Web Client SDK provides the logPageView
method which allows you to apply a page context for manually activating a page, allowing for full flexibility for sites with dynamic content or challenging URL patterns. View more information here. The following example performs a mapping of the page watchedVideo
as seen here.
var tags = {category: 'Kitchen', subcategory: 'blenders'}
mParticle.logPageView('watchedVideo', tags);
will map to the following:
window['optimizely'].push({
type: 'page',
pageName: 'watchedVideo',
tags: {
'category': 'Kitchen',
'subcategory': 'Blenders'
}
});
Setting Name | Data Type | Description |
---|---|---|
SDK Key | string |
(required) Your Site/App’s Optimizely SDK Key. |
Setting Name | Data Type | Platform | Default Value | Description |
---|---|---|---|---|
User ID | enum |
iOS/Android | Device Application Stamp | The User Identity you would like to map to Optimizely’s “userId” field. Supports Device Application Stamp, Customer ID, Email, or MPID. |
Event Interval | integer |
iOS/Android | The interval (seconds) at which Optimizely’s SDK uploads events. Defaults to Optimizely’s own SDK default if not set. | |
Datafile Interval | integer |
iOS/Android | The interval (seconds) at which Optimizely’s SDK attempts to update the cached datafile. Defaults to Optimizely’s own SDK default if not set. |