Optimizely Full Stack Destination


Getting Started

The first step is to make sure Optimizely Full Stack supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.

Web Mobile Server
📱 Device-mode
☁️ Cloud-mode

Segment’s Optimizely Full Stack (previously Optimizely X) destination supports the following Optimizely products:

If you’re interested in implementing Optimizely Classic, Optimizely X Web, or Optimizely Full Stack (JavaScript), please see Segment’s Optimizely Web destination, which supports:

Implementation Prerequisite

Optimizely works differently than other Segment destinations: It requires that customers implement at least some Optimizely functionalities natively.

Although Segment maps track events to Optimizely’s track method, customers must implement all Optimizely decision-based methods, such as activate, isFeatureEnabled, etc., natively. Segment’s API does not include methods that correspond to decision-based methods.

This limitation requires that customers include a native Optimizely implementation before their Segment implementation on pages or in mobile apps where Optimizely experiments run.

Server Side

Getting Started

  1. In your Segment source dashboard, enable the “Optimizely Full Stack” destination (not the “Optimizely Web” destination).
  2. Include your Optimizely project’s projectId and datafile URL in your Segment settings.
  3. Create a native Optimizely instance in your server environment so you can access Optimizely methods like activate, isFeatureEnabled, etc.
  4. Finally, define any metrics and attributes in your Optimizely dashboard, and to associate metrics with the appropriate Optimizely experiments. Segment maps track event names to Optimizely eventName - the eventName corresponds to an experiment metric. In addition, Segment maps track event context.traits to Optimizely attributes.

Track

Upon invocation of a Segment track event, Segment maps the event to an Optimizely track event:

  • If the Segment event name matches exactly the name of an active experiment metric set up in the Optimizely dashboard;
  • If the experiment metric is associated with a running experiment;
  • If the current user has been assigned a userId via Segment’s identify method (e.g. analytics.identify('123'));
  • If the current user is activated in a running experiment with the associated metric.

Segment also handles the following mapping:

  • Segment track event name to Optimizely eventName.
  • Segment track event properties to Optimizely eventTags.
  • Segment track event context.traits to Optimizely attributes.

revenue values should be passed as a Segment property. The value should be an integer and represent the value in cents, so, for example, $1 should be represented by 100.

Segment defaults to identifying users with their anonymousId. Enabling the “Use User ID” setting in your Segment settings means that only track events triggered by identified users are passed downstream to Optimizely. You may optionally fall back to anonymousId when userId is unavailable by setting fallbackToAnonymousId to true.

Notification Listeners

Segment’s server-side integration with Optimizely Full Stack does not support notification listeners.

Android Cloud-mode Implementation

Getting Started

  1. In your Segment source dashboard, enable the “Optimizely Full Stack” destination (not the “Optimizely Web” destination).
  2. Include the latest version of Optimizely Full Stack’s native SDK in your your app-level build.gradle file and implement Optimizely as your would natively.
  3. Finally, define any metrics and attributes in your Optimizely dashboard, and to associate metrics with the appropriate Optimizely Experiments. Segment maps track event names to Optimizely eventName - the eventName corresponds to an experiment metric. In addition, Segment maps identify traits to Optimizely attributes.

When implementing Optimizely Full Stack via cloud-mode, Segment will map track events to Optimizely track events on our servers and deliver the data to your Optimizely project as usual.

Track

Upon invocation of a Segment track event, Segment maps the event to an Optimizely track event:

  • If the Segment event name matches exactly the name of an active experiment metric set up in the Optimizely dashboard;
  • If the experiment metric is associated with a running experiment;
  • If the current user is activated in a running experiment with the associated metric.

Segment also handles the following mapping:

  • Segment track event name to Optimizely eventName.
  • Segment track event properties to Optimizely eventTags.

revenue values should be passed as a Segment property. The value should be an integer and represent the value in cents, so, for example, $1 should be represented by 100.

Segment defaults to identifying users with their anonymousId. Enabling “Use User ID” setting in your Segment dashboard means that only track events triggered by identified users are passed downstream to Optimizely. You may optionally fall back to anonymousId when userId is unavailable by setting fallbackToAnonymousId to true.

Identify

Invoking a Segment identify event sets Segment traits as Optimziely attributes. The attributes are sent downstream to Optimizely upon invocation of the next Segment track event.

Reset

Invoking this method invalidates the listener for the Experiment Viewed event.

Notification Listeners

Notification listeners are not available when implementing Optimizely via Segment using cloud-mode. However, notification listeners are straightforward to set up, as documented here on Optimizely’s site.

iOS Cloud-mode Implementation

Getting Started

  1. In your Segment source dashboard, enable the “Optimizely Full Stack” destination (not the “Optimizely Web” destination).
  2. Include the latest version of Optimizely Full Stack’s native SDK in your app and implement it as you would natively.
  3. Finally, define any metrics and attributes in your Optimizely dashboard, and to associate metrics with the appropriate Optimizely Experiments. Segment maps track event names to Optimizely eventName - the eventName corresponds to an experiment metric. In addition, Segment maps identify traits to Optimizely attributes.

When implementing Optimizely via cloud-mode, Segment will map track events to Optimizely track events on our servers and deliver the data to your Optimizely project as usual.

Track

Upon invocation of a Segment track event, Segment maps the event to an Optimizely track event:

  • If the Segment event name matches exactly the name of an active experiment metric set up in the Optimizely dashboard;
  • If the experiment metric is associated with a running experiment;
  • If the current user is activated in a running experiment with the associated metric.

Segment also handles the following mapping:

  • Segment track event name to Optimizely eventName.
  • Segment track event properties to Optimizely eventTags.

revenue values should be passed as a Segment property. The value should be an integer and represent the value in cents, so, for example, $1 should be represented by 100.

Segment defaults to identifying users with their anonymousId. Enabling “Use User ID” setting in your Segment dashboard means that only track events triggered by identified users are passed downstream to Optimizely. You may optionally fall back to anonymousId when userId is unavailable by setting fallbackToAnonymousId to true.

Identify

Invoking a Segment identify event sets Segment traits as Optimziely attributes. The attributes are sent downstream to Optimizely upon invocation of the next Segment track event.

Notification Listeners

Notification listeners are not available when implementing Optimizely via Segment using cloud-mode. However, notification listeners are straightforward to set up, as documented here on Optimizely’s site.

Personas

Please follow these instructions on how to setup Personas and Optimizely:

Supported Sources and Connection Modes

The first step is to make sure Optimizely Full Stack supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.

Web Mobile Server
📱 Device-mode
☁️ Cloud-mode

To learn more about about Connection Modes and what dictates which we support, see here.

This destination requires a Device-based Connection Mode for Mobile data. Follow the steps above to ensure you have packaged the Optimizely Full Stack SDK with Segment’s.

Settings

Segment lets you change these destination settings from your Segment dashboard without having to touch any code.

Cache Exp

To optimize the server side integration, we will cache the fetched Datafile that you have provided for this amount of time (in seconds) in Redis. Since the datafile should not change unless you modified the conditions or variation rules of your experiments, it is advised to have a minimum floor of 300 seconds (5 minutes).

Fall Back To Anonymous Id

Optionally fall back to anonymousId when userId is not present.

Sends the experiment and variation information as properties on a track call.

Send experiment data to other tools (as a track call). An “Experiment Viewed” track event will be triggered each time you access an Optimizely live variable. If you’re regularly accessing live variables and want to reduce the number of track events triggered, pass the “false” flag, for example our Android library would be:

Boolean myVariable = optimizelyClient.getVariableBoolean("myVariable",
                                                         userId,
                                                         false);

And for our iOS library:

bool myVariable = [optimizely variableBoolean:@"myVariable"
                                       userId:userId]
                           activateExperiment:False];

Specifies the Experiment Viewed as a non-interaction event for Google Analytics

Send Experiment Viewed as a non-interaction event

Use User ID

Enable this if you want the server side integration to use User ID instead of anonymous ID in your identify calls

Account ID

In order to use Optimizely X via server side, you must enter your Account ID from your Optimizely account. You can find this ID by visiting https://app.optimizely.com/v2/accountsettings/account/plan

Datafile URL

In order to use Optimizely X server side, you must enter the entire URL for your datafile. It should look something like https://cdn.optimizely.com/json/9218021209.json

Only Track Known Users

Optimizely does not alias known and unknown users. By default, Segment will only send the anonymousId to Optimizely. Enable this to only send the userId to Optimizely. Important: This setting only applies if you are bundling this integration for mobile sources.

Use Optimizely 3

Enable this setting to instantiate an Optimizely client using v3.2.2 of Optimizely’s SDK. The default Optimizely client version Segment instantiates is v2.1.3. NOTE: Do not enable this setting if the SDK version you are using to activate users into your Optimizely experiments is less than 3.0. You can find more information on how migrating from Optimizely 2.x to 3.x will affect your experiment tracking in Optimizely’s documentation: https://docs.developers.optimizely.com/full-stack/docs/changelog#section-may-2019

Adding Optimizely Full Stack to the integrations object

To add Optimizely Full Stack to the integrations JSON object (for example, to filter data from a specific source), use one of the following valid names for this integration:

  • Optimizely X

  • Optimizely Full Stack

Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account