Optimizely Full Stack Destination

This destination is currently in beta. If you are interested in joining, let us know!

Segment makes it easy to send your data to Optimizely Full Stack (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Optimizely Full Stack in the format they understand.

Getting Started

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 expeirment;
  • 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. No option is available to use userId and fall back to anonymousId, as Optimizely does not support identity resolution.

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 expeirment;
  • 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. No option is available to use userId and fall back to anonymousId, as Optimizely does not support identity resolution.

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 expeirment;
  • 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. No option is available to use userId and fall back to anonymousId, as Optimizely does not support identity resolution.

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

You can send computed traits and audiences generated through Segment Personas to this destination as a user property. To learn more about Personas, reach out for a demo.

For user-property destinations, an identify call will be sent to the destination for each user being added and removed. The property name will be the snake_cased version of the audience name you provide with a true/false value. For example, when a user first completes an order in the last 30 days, we will send an identify call with the property order_completed_last_30days: true, and when this user no longer satisfies we will set that value to false.

When the audience is first created an identify call is sent for every user in the audience. Subsequent syncs will only send updates for those users which were added or removed since the last sync.

Supported Sources and Connection Modes

WebMobileServer
📱 Device-based
☁️ Cloud-based

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

Segment offers an optional Device-based Connection Mode for Mobile data with Optimizely Full Stack. If you’d like to use those features that require client-based functionality, 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 via your Segment dashboard without having to touch any code.

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

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).

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

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

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 User ID

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


If you have any questions, or see anywhere we can improve our documentation, please let us know!