Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In

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:

Configure ODP Advanced Audience Targeting

To enable ODP Advanced Audience Targeting:

  1. In Optimizely Web Experimentation, go to Settings > Integrations > Optimizely Data Platform Advanced Audience Targeting.
  2. Toggle the integration status to On.
  3. Click You can find your API key in ODP to navigate to the APIs page in ODP.
  4. On the APIs page in ODP, copy the value in the KEY fields on both the Public and Private tabs.
  5. Navigate back to Optimizely Web Experimentation and paste these values into the corresponding fields (ODP Public Key (required) and ODP Private Key (required)).
  6. 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:

  1. In Optimizely Web Experimentation, go to Settings > Implementation and copy the snippet.
  1. 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:

  1. In ODP, go to Account Settings > Integrations > Javascript Tag.
  2. Click Copy to Clipboard.
  1. 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:

  1. Within your experiment, go to Audiences.
  2. From the Search and add audiences drop-down list, select Create New Audience.
  1. Fill in the Name (required) and Description (optional) fields as desired.
  2. In the audience condition options on the right, expand Optimizely Data Platform Advanced Audience Targeting.
  3. Drag and drop either Custom Segments or Pre-built SegmentsΒ to the Audience Conditions section.
  4. Configure the audience as desired (the real-time segments from ODP display in the Select an audience drop-down list).
  1. Click Save Audience.
  2. 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.