Optimizely Web Experimentation (formerly Optimizely Web) lets you you test and experiment new features on your website. It is typically used by marketing teams and product managers to learn more about the customers' product journey, and test new features to boost conversion rates and overall customer engagement.
Getting started
RudderStack supports sending event data to Optimizely Web via the following connection modes:
| Connection Mode | Web | Mobile | Server | 
|---|---|---|---|
| Device mode | Supported | - | - | 
| Cloud mode | - | - | - | 
Once you have confirmed that the source platform supports sending events to Optimizely Web Experimentation, follow these steps:
- Define custom events in the Optimizely Dashboard and add those events as metrics in the corresponding experiments.
 - Add the Optimizely Web Experimentation snippet to your web page immediately after the opening 
<head>tag. Then, include the RudderStack JavaScript snippet. - From your RudderStack dashboard, add the source. Then, from the list of destinations, select Optimizely Web.
 - Assign a name to your destination and click Continue.
 
Connection settings
To successfully configure Optimizely Web Experimentation as a destination, you will need to configure the following settings:
- Send experiment data to other tools: By enabling this setting, you can send your experiment or campaign data to other destinations connected to the same source.
- As a track call: When this setting is enabled, an 
Experiment Viewedtrackevent will be sent to RudderStack along with other configured destinations for each active experiments per page load. Thepropertiesof this event will be Optimizely's experiment metadata. - As identify call: When this setting is enabled, an 
identifycall will be sent to RudderStack and other configured destinations, with the traits asexperiment nameandvariation name. 
 - As a track call: When this setting is enabled, an 
 - Send experiment viewed event as non-interaction event: In case you want to send the 
Experiment Viewedtrack event to Google Analytics, enable this setting. Thetrackevent will then be sent to Google Analytics as a non-interaction event, i.e. an additional propertynonInteractionwith value1will be appended to the properties of that event. - Revenue on Order Completed event: Enabling this setting will send 
revenueas a property of thetrackonly for the events with event nameOrder Completed. - Track categorized pages: Enabling this setting will send 
pagecalls to Optimizely Web havingcategoryastrackevents. - Track named pages: Enabling this will send 
pagecalls havingnameastrackevents to Optimizely Web. - Custom campaign properties: In this section, provide the mapping of the campaign metadata to the RudderStack 
trackevent properties for theExperiment Viewedevent. Please note that theevent propertyshould be thetrackevent property and thecampaign propertyshould be the corresponding metadata of the campaign. - Client-side Events Filtering: This setting lets you specify which events should be blocked or allowed to flow through to Optimizely Web Experimentation. For more information on this setting, refer to the Client-side Events Filtering guide.
 - Use device mode to send events: As this is a web device mode-only destination, this setting is enabled by default and cannot be disabled.
 - OneTrust Cookie Categories: This setting lets you associate OneTrust cookie consent groups to Optimizely.
 
Page
If you have enabled the Track Categorized Pages or Track Named Pages dashboarding setting, then RudderStack sends a page call having a name or category as a track event with the event name as Viewed ${category} page or Viewed ${name} page to Optimizely.
A sample page call is shown below:
// "home" is the name of the page.rudderanalytics.page("home");Track
RudderStack sends a track call to Optimizely with a valid event name associated with an active experiment.
If you have enabled the Revenue on Order Completed event dashboard setting, then RudderStack sends the revenue property only for the Order Completed event and not for any other event.
RudderStack converts the value of revenue to cents before passing it to Optimizely. Thus, $5 will be converted to 500 cents.
If Revenue on Order Completed event is disabled in the dashboard, then the property is passed as is, without any conversion.
A sample track call is as shown below:
rudderanalytics.track("Order Completed", {  revenue: 30,  value: 30.0,})Sending experiment data
If the Send experiment data as track call dashboard setting is enabled while configuring the destination, RudderStack automatically records and sends a web experiment as a track event with Experiment Viewed as the event name and the experiment metadata as the event properties. 
You can then send this track event to the other destinations (connected to the same source in RudderStack) to analyze the experimentation results.
This track event call consists of the following properties:
campaignNamecampaignIdexperimentIdexperimentNamevariationNamevariationIdaudienceIdaudienceNamenonInteraction
A sample track call is shown below:
rudderanalytics.track("Experiment Viewed", {  campaignName: "test campaign",  campaignId: "1234567890",  experimentId: "0123456789",  experimentName: "test experiment",  variationId: "1122334455",  variationName: "test variation",  audienceId: "1212121212",  audienceName: "sample audience",  nonInteraction: 1,})If the Send experiment data as identify call dashboard setting is enabled, RudderStack sends an identify event with the following traits for each active experiment:
experimentNamevariationName
You can then send this identify event to the other destinations (connected to the same source in RudderStack) to analyze the experimentation results.
Note that:
- In case multiple experiments are active, then multiple 
identifyevents are triggered. - RudderStack persists the 
identifytraits for the subsequentidentifycalls, that is, theidentifycalls contain the previousidentifytraits as well. 
A sample identify call is as shown:
rudderanalytics.identify({    `Experiment: ${experimentName}` : variationName});FAQ
Do I need to add Optimizely Web's JavaScript snippet to my website?
Yes. You need to add the Optimizely Web snippet immediately after the opening <head> tag of your web page. Then, include the JavaScript snippet of RudderStack.
Why I am not able to see the events in my experiments?
Define the custom events in Optimizely Web's dashboard and add those events as metrics in corresponding Optimizely 's experiment.
While defining the custom event, you need to provide an API Name and while using RudderStack's track API, use this API name as the event name.
Contact us
For more information on the topics covered on this page, email us or start a conversation in our Slack community.