There are two versions of Optimizely
. If you're using Optimizely Classic, check this article out instead.
What version do you have?
This is what the Optimizely Classic user interface looks like.
This is what the Optimizely X user interface looks like.
- Optimizely X Web Experimentation
- Optimizely X Web Personalization
- Optimizely X Web Recommendations
This article will help you:
- Integrate Google Universal Analytics to read data from Optimizely.
- Add Google Universal Analytics integration code to your page.
- Track Google Universal Analytics metrics as experiment goals.
- Create custom dimensions and reports in Google Universal Analytics to track and report on Optimizely data.
If you use Google Universal Analytics (UA) to monitor your site's traffic, you can view the results of your Optimizely experiments alongside the rest of the data that Google UA collects.
Here are a few reasons to integrate:
Get a direct view of how Optimizely experiments affect the metrics you track in Google Analytics
See Google Analytics data for each variation in your experiment (or experience in a campaign)
Filter your Google Analytics reporting by visitors who were successfully included in an Optimizely experiment and exclude those who weren't
First, enable Google Analytics in your Optimizely project if you haven't already.
Here are a few other details to keep in mind:
To integrate Optimizely with Google UA, you'll need an available custom dimension in Google Analytics to populate with
Optimizely experiment data.
Use the number (or index) of the custom dimension to configure and send data to your Optimizely experiment. To access your Google UA custom dimensions and create one for Optimizely, scroll down to the
Create a Google UA custom dimension section
Use one custom dimension per concurrently running experiment or campaign to keep experiment names and variations from overwriting each other.
If your page's Google UA setting has the setDomainName function call on your page, make sure that it doesn't use a leading period or "www".
Your Optimizely experiment or campaign must be running for Google UA integration to work.
If you've been using the integration for Optimizely Classic, we've made a few updates in Optimizely X:
Your Optimizely and Google UA snippets can now be placed in any order.
You no longer need to make the
activateUniversalAnalyticsAPI call (but it's a good idea to keep it if you're still using Optimizely Classic.
Optimizely X no longer sends Optimizely data with the 'pageview'. It sends a separate 'non-interaction event', independent
of the 'pageview'.
The reason for having one custom dimension per concurrently running experiment is data attribution.
For example, suppose Experiment A and Experiment B both use Custom Dimension 1. If a visitor lands on Experiment A within page 1 and lands on Experiment B on page 2 within the same session, the visitor's actions are attributed
only to Experiment B from that point on.
In the same scenario, if Experiment A and Experiment B
have their own unique custom dimensions, Experiment A
will continue to collect data for the visitor even after they're bucketed into Experiment B.
1. Enable Google UA integration
Optimizely uses Google UA's custom dimensions to tag your visitors with the experiments and variations to which they've been added. Here are the steps in configuring
Optimizely X to start sending this information to Google UA:
Choose an experiment.
In the Manage Experiment menu, click Integrations.
In the Google Universal Analytics section, click to select the Tracked checkbox.
Select the custom dimension that you want Optimizely to use. Remember, this is a Google UA custom dimension, not the Optimizely feature. Make sure that this custom dimension isn't already in use for another part of your site or
a concurrently running Optimizely experiment.
setDimension code on your page. If you include the
ga('set', 'dimension1', dimensionValue); code on your site, you might overwrite the Optimizely-Google UA integration.
If you're using a custom event tracker other than the default, choose one in the Custom Tracker (optional) field. This changes Optimizely's
integration call to use the custom event tracker instead of the default. For example, if your website uses this call:
...you'll enter tracker2 in the Custom Tracker (optional) field, and Optimizely will integrate with tracker2 instead of the default tracker.
2. Create a Google UA custom dimension
To integrate Optimizely with Google UA and view reports based on the integration data, you need a Google UA custom dimension. This custom dimension and the name you give it are used to create reports that leverage your Optimizely
integration data for filtering.
Here's how to create a Google UA custom dimension:
Log into your Google UA account as an Admin and click the Admin tab.
Click Custom Definitions and select the Custom Dimensions sub-item.
If you see the custom dimension you want to integrate your Optimizely experiment with, note its name and index number--no need to add a new one.
If you want to integrate with a custom dimension that isn't listed, you do need to create a new one. Click New Custom Dimension, and give the new dimension a name and a scope.
Your custom dimension is now available for integrating with Optimizely experiments.
Although we recommend integration scope at the session level, you can configure your integration scope at the user level. Optimizely's default integration uses session-level scope to minimize the possibility of overwriting your
experiment data sent to Google UA. But if you're tracking complex conversions that span multiple sessions, you might prefer a user-level scope. Choose the scope that's better for the types of conversions you want to track.
For example, you might want a session-level scope if the experiment is running site-wide or if a visitor will always go back through the experiment pages before converting. But you'd want a user-level scope if it's possible for a user to leave the site, then come back and convert without seeing the experiment again.
If you do this, be cautious of reusing custom dimensions in Google UA. For consistency between Google UA and Optimizely's Results page, set the Google UA reporting range to the same duration as your experiment.
Check out Google's documentation on scoping for details.
3. Create a custom report
You'll want to see reports on your experiments within Google UA, so you'll need a custom report for each experiment. Here's how to create custom reports:
Log into your Google UA account and click the Customization tab.
Set up a custom report for each experiment with which you have integrated Google UA: click New Custom Report, give the report a title, and add the metric groups you want to view in the report.
To filter the report for only your Optimizely experiment, choose the custom dimension you set up as one of the Dimension Drilldowns.
Add the custom dimension in the Filters section.
Enter the regular expression ("Regex") match for
the experiment ID or campaign ID you want to filter for. Use Experiment IDs for Web Experiments and Campaign IDs for Optimizely X Personalization Campaigns. This
will ensure that your report shows only the Google UA data for that particular experiment.
Leave the fields in the Filters section empty when you're creating a custom report for an iOS experiment.
Now you can access your report and update the date filter as needed!
4. Confirm your integration
Google UA's custom dimensions contain visitor-specific information that can be sent along with events and pageviews. It can take up to 24 hours to populate that data into Google UA, but the custom dimension is set immediately when you integrate
Google UA and Optimizely. This means you can confirm that the custom dimension is set correctly with the Google Analytics’ debugger tool.
Using the debugger tool, look for the variable
x is the slot that corresponds to the Optimizely experiment. The variable is set with the Optimizely experiment, followed by the variation
you were bucketed into. Here's an example:
dimension7 (&cd7) Optimizely_Onboarding (1645002506): Variant#1
If you would like to learn more on our naming convention, please take a look at our "Naming Conventions for Analytics Integrations"
Troubleshooting your Google UA integration or seeing discrepancies in your reports? See our GA troubleshooting article.
When a decision event is made, Optimizely X sends that event to Google UA as soon as possible, polling for availability of the Google UA object.
If the Google UA object isn't ready when a decision is made, Optimizely X checks back every 200 ms for 10 seconds see if Optimizely can send the UA string. This helps with delayed
activation experiments (and if they fall under delayed activation, it helps with geo-targeted experiments too).