Documentation / Product / Integrations / Optimizely

Optimizely Integration

Get the most out of Optimizely by running experiments against any of your Lytics audiences. Watch a short example of how Lytics and Optimizely can supercharge personalized marketing by using cross-channel data.

Because Optimizely uses a synchronous tag that blocks page load and Lytics uses an asynchronous tag that will never affect page load, natively running experiments on the first page view for first time visitors is not recommended. This integration relies on a cookie to be stored containing the audience memberships and on the first page view for first time visitors, Optimizely's tag will initialize before that cookie can be saved. Additionally, be aware that this functionality currently requires the use of version 2 of the Lytics JavaScript tag.

How it Works

Both Optimizely X and Classic Optimizely work fundamentally the same way. However, as covered below, the setup process is different based on how you authenticate and what APIs are available. Regardless of the setup method when someone visits a web property with the Lytics tag installed, Lytics will identify who they are and return a list of audiences they are currently a member of in real-time. This process happens very quickly but is asynchronous, meaning it is designed to never negatively impact performance. Once those profiles have been received, the audiences are stored in a cookie called ly_segs. This cookie is then updated, asynchronously, on every subsequent page view.

When manually defining an audience inside of Optimizely there is an option to do a string match against a cookie. Meaning that if a user's cookie value is one, two, three, an Optimizely experiment can be targeted at anyone whose cookie value contains the value two. Since storing the audiences as a cookie is handled by the Lytics JavaScript tag no additional work is needed. The only configuration that is necessary is the creation of your audiences inside of Optimizely. This process is covered below and will differ for Optimizely X and Classic users.

Optimizely X

Optimizely X (OX) is the current generation of Optimizely. As such the setup for OX users can be automated. You will need to authenticate and configure an export as described below and Lytics will handle the rest.

To get started log in to your Lytics account and navigate to the Optimizely integration overview.

Authentication

  1. Select Authorizations from the left side menu.
  2. Click New Authorization.
  3. Select Optimizely X.
  4. Log in to Optimizely when prompted.
  5. Complete the authorization by adding a description.

Syncing Lytics Audiences

  1. Select Workflows from the left side menu.
  2. Click New Workflow.
  3. Select Export Audience.
  4. Select the authorization created above.
  5. Click Start Export.

This will begin to export all Lytics audiences that have been API enabled. After a few minutes visit the Audiences section of your Optimizely account to verify that the Lytics audiences are being pulled in correctly.

Optimizely Classic

Classic Optimizely has some limitations and does not support the same form of authentication. As such audiences can not be pushed directly from Lytics to Optimizely in its current state. You will need to manually configure your audiences inside of Optimizely with a few short steps.

Manually Configuring Audiences

  1. Ensure that the audience you would like to use has been marked as API Enabled inside of Lytics.
  2. Note the ID that is generated next to the Enable API Access box as this will be used inside of Optimizely.
  3. Inside of Optimizely navigate to the Audiences tab.
  4. Click the blue New Audience button at the top right.
  5. Name your audience. We recommend something similar to how it's named inside of Lytics.
  6. Under Audience Conditions drag the Cookie option from under Standard to the builder.
  7. Enter ly_segs for cookie name.
  8. Change equals to contains.
  9. Set the value to the value of your audience id referenced in step 2.
  10. Click Save Audience.

optimizely-audience

Configuring Experiments

Once you have configured your audience following the steps above for either X or Classic all that is left is to configure and test your experiment. Refer to the Optimizely documentation for associating an audience with an experiment.