Configure Advanced Audience Targeting with ODP (beta)
You can integrate Optimizely Web Experimentation with Optimizely Data Platform (ODP) to use customer segments from ODP as audiences in your Optimizely Web Experimentation experiments.
Note
Advanced Audience Targeting with Optimizely Data Platform (ODP) is currently in Beta.
Contact your customer success manager for more information.
Prerequisites
You need to meet the following requirements for the integration between Optimizely Web Experimentation and ODP to work:
- You must have both Optimizely Web Experimentation and ODP
- Configure the integration within Optimizely Web Experimentation
- Add the Optimizely Web Experimentation snippet to your site
- Add the ODP snippet to your site
- You must have real-time segments set up in ODP (pre-built and/or custom)
Configure ODP Advanced Audience Targeting
To enable ODP Advanced Audience Targeting:
- In Optimizely Web Experimentation, go to Settings > Integrations > Optimizely Data Platform Advanced Audience Targeting.
- Toggle the integration status to On.
- Click You can find your API key in ODP to navigate to the APIs page in ODP.
- On the APIs page in ODP, copy the value in the KEY fields on both the Public and Private tabs.
- Navigate back to Optimizely Web Experimentation and paste these values into the corresponding fields (ODP Public Key (required) and ODP Private Key (required)).
- Select your region from the ODP Host (required) drop-down list.
Add the Optimizely Web Experimentation and ODP snippets to your site
You must add both the Optimizely Web Experimentation and ODP snippets to your site's tag. The ODP snippet must be before the Optimizely Web Experimentation snippet so that the Optimizely Web Experimentation snippet can pull the ID that the ODP snippet generates.
Add the Optimizely Web Experimentation snippet to your site
If you already have the Optimizely Web Experimentation snippet added to your site, you can skip this step. Otherwise, to add the Optimizely Web Experimentation snippet to your site:
- In Optimizely Web Experimentation, go to Settings > Implementation and copy the snippet.

- Paste the snippet into your site's tag.
Note
For more details on implementing the Optimizely Web Experimentation snippet on your site, see Implement the one-line snippet for Optimizely Web Experimentation.
Add the ODP snippet to your site
If you already have the ODP snippet added to your site, you can skip this step. Otherwise, to add the ODP snippet to your site:
- In ODP, go to Account Settings > Integrations > Javascript Tag.
- Click Copy to Clipboard.

- Paste the snippet into your site's tag.
Note
For more details on implementing the ODP snippet on your site, see Install the Optimizely Data Platform JavaScript tag.
Use ODP real-time segments in your Optimizely Web Experimentation experiments
Now you can begin building audiences in Optimizely Web Experimentation using ODP's pre-built and custom real-time segments.
Note
The segments on the Customers > Segments page in ODP are not available for use in this integration.
Create an audience using ODP's real-time segments
You can create and add an audience directly on your experiment (described below), or you can create the audience outside of the experiment (using the audience builder) and then add it to your experiment later.
To add an audience directly to your experiment:
- Within your experiment, go to Audiences.
- From the Search and add audiences drop-down list, select Create New Audience.

- Fill in the Name (required) and Description (optional) fields as desired.
- In the audience condition options on the right, expand Optimizely Data Platform Advanced Audience Targeting.
- Drag and drop either Custom Segments or Pre-built Segments to the Audience Conditions section.
- Configure the audience as desired (the real-time segments from ODP display in the Select an audience drop-down list).

- Click Save Audience.
- On the Audiences page, click Save.
Note
You must add the audience to an experiment. The Optimizely Web Experimentation snippet does not evaluate ODP real-time segment membership unless you add an audience that uses ODP real-time segments to a live experiment that is being activated. In other words, you need to add the audience you create (using the steps above) to an experiment to see this integration function on a particular webpage.
This also means that if you are checking for a value that could change ODP real-time segment membership mid-session, a page needs to be activated for an experiment using an audience to force re-evaluation (as it normally would for any other audience condition). For more information, see order of activation.
Troubleshoot the integration
Check which real-time segments you are assigned to in ODP
When Optimizely Data Platform Advanced Audience Targeting is enabled, Optimizely Web Experimentation makes a request to the ODP GraphQL API to retrieve the current visitor's assigned real-time segments. To inspect the data returned by that call, open the developer console and check the value of this attribute:
window["optimizely"].get("visitor")['vendor.odp']['audiences']
The content of this array should be populated with any real-time segments to which you are currently assigned.
If you do not see any real-time segments in the odp.audiences[]
array, first check to see if you are a member of the returning_visitors
real-time segment by navigating away from the page and returning to it. If you see yourself in the returning_visitors
real-time segment on your second visit to the page, the problem most likely is that you do not belong to any other segments, or those segments have not been enabled for that page.
If, however, you are not in the returning_visitors
real-time segment, it is likely that the ODP tracker is disabled. This often happens when a visitor deletes their browser cookies mid-session. In this case, the ODP tracker needs to reacquire a tracking cookie before it can identify the user. If the ODP JavaScript snippet cannot find the cookie, ODP returns an empty array of audience memberships. You can reset the cookie by logging out and back into the site.
Updated 15 days ago