The Optimizely integration works with session filters and Surveys, enabling you to filter session data based on Optimizely X experiments and target Surveys alongside your Optimizely experiments.
How to enable the Optimizely integration
Visit your Integrations page and select the site that will receive the integration, then click Connect for Optimizely.
Turn on Automatically track recordings with the active experiment. This enables the integration.
How to filter session data by Optimizely X experiments
With the Optimizely integration, your Optimizely Experiments will be available as Events enabling you to filter session data in tools such as Heatmaps, Recordings, Trends, Funnels, and your Dashboards.
Unmask experiment names from inside your Optimizely settings.
By default, Optimizely masks the names of your experiments. Unmasking will enable Optimizely experiments to appear in our Events filter with the descriptive experiment and variant names: [experimentName] / [variantName]. If masking is still applied in Optimizely, then experiments will appear as numerical IDs: [experimentId] / [variantId], making it more difficult identify the experiment and variant you're interested in.
You can unmask experiment descriptive names by visiting your Optimizely Settings and the Implementation tab. Then, unselect the option to Mask descriptive names in project code and third-party integrations.
For more help with this, see Optimizely's Mask descriptive names documentation.
Check that your experiment names are compatible.
Once your experiment names are unmasked, you can make sure they aren't affected by any of the limitations that apply to our Events and Optimizely experiment names:
- The experiment name cannot contain 9 or more consecutive digits, or it will be flagged as personally identifying information, and we will not store the event.
- The experiment name must not exceed 250 characters and can only contain alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and dashes (-).
- There is a 1,000 unique event limit per site, which means you cannot track more than 1,000 unique Optimizely experiments
- It's not currently possible to pass any event properties with the event.
Start the test from within Optimizely.
After visiting your Optimizely X interface and starting the test, users in the active test will have their sessions associated with the experiment event being sent to us.
Apply the Events filter to view session data from the Optimizely experiment.
After at least one session from the experiment has been captured, the experiment name and variant should become available in our Events filter. You can then compare variants in an A/B test by using the Events filter to isolate sessions for one variant and then compare it to another variant by again applying the Events filter using the other variant.
How to target Surveys based on Optimizely X experiments
Optimizely experiments are passed to us as Events that can then be used to target Surveys. This means if you'd like to run a survey or collect a list of user testers on a specific variation that you're testing, you can use Events.
Follow the steps to create a survey until you get to the Targeting section.
In the Targeting section, select Specific pages and choose Event from the dropdown menu.
Enter an event name in the Event field for an Optimizely variation.
You can enter any string that describes the variation you're testing. In the example image below, you would replace the text viewed_optimizely_variation_a with your own string that relates to the variation where you want to trigger your survey.
You can add more Event triggers for other variations by clicking on Add another, ensuring that you use a different event name for each variation.
In the following steps, we'll add our Events API code to your Optimizely variation so the survey can be triggered when the event occurs.
From within your Optimizely experiment, select the variation you'd like to trigger the event on.
Click the Variation Code Editor icon, located towards the top-right.
For more help with Optimizely's Variation Code Editor, see Optimizely's article on Adding custom code to a variation.
Enter the code needed to make calls to our Events API, then click Save & Apply.
In the example code below, the viewed_optimizely_variation_a event is being sent to us. When the event occurs, a survey set up to trigger based on that event name will appear on the variant page.
You'll need to change the event name in the example code below from viewed_optimizely_variation_a to the string that you entered for your own variant in the Targeting section of your survey, as described in the steps above.
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments);};
hj('event', 'viewed_optimizely_variation_a');
The survey will still use the survey behavior rules specified when the survey was first created.
Why don’t I see any Optimizely experiments in the events filter?
If you don’t see your experiments in the Events filter, there are two common places to check for errors:
- Check that your Optimizely experiment names are unmasked (Step 1).
- Check that your Optimizely experiment names are compatible (Step 2).
How can I check that my Optimizely experiment is running?
Optimizely Support would be the best team to help here. You can find more in-depth information in their Developer Docs, including a guide on how to enable debug logs.