Google Optimize for Google Analytics 4 (GA4) was released in February 2022. There are many differences between GA4 and Universal Analytics, which is also true for their Optimize integrations. When it was released, Optimize for GA4 had a list of features that were different from how Universal Analytics integrated with Google Optimize. Some of those differences included:
- The limit of how many experiments you can run at one time (down to 10 from 24 on free accounts)
- Google Ads targeting available to all accounts (previously exclusive to 360 users)
- A maximum experiment duration of 35 days (down from 90 days)
But the most significant difference between Universal Analytics and GA4 for Optimize is that experiment dimensions do not show up natively inside GA4. With Universal Analytics, Google Optimize populated the experiment name, experiment ID, and variant dimension for you, and you could use them in all your custom reports.
What this means is that it’s not possible to report on secondary metrics or primary metrics that don’t fall into the Google Optimize default conversion objectives, which are:
- Purchases
- Purchase Revenue
- Pageviews
Unlike Universal Analytics, in its current state Optimize for GA4 does not allow you to select an event as your primary objective.
With that said, there is still a way to get your experiment data into GA4 so you can report on your experiments like you’re used to and report on any event or conversion in your account.
Adding new experiment dimensions in GA4
The good news is that Google Optimize and GA4 have already done some of the work required for us to capture the correct data. When you launch an experiment, Google Optimize is already sending events to GA4 about the experiment.
Google Optimize sends an experiment impression event. It also sends an experiment ID and a variant ID parameter with that event. The experiment ID will match the experiment ID of the experiment you’re running in Google Optimize. Your variant ID will be your experiment ID plus your variant ID. Google Optimize variant IDs always show up as zero for control, one for B, two for C, etc.
Now that we know that the experiment impression event is being sent and has the experiment ID and variant ID parameters that we need, we can create custom dimensions inside of GA4 to capture those values.
In GA4, set up the following three new custom dimensions in the Configure -> Custom Definitions screen:
Dimension Name | Description | Scope | User/Property Parameter |
optimize_experiment_id | Experiment ID sent from Google Optimize | Event | experiment_id |
optimize_personalization_id | Personalization ID sent from Google Optimize | Event | optimize_personalization_id |
optimize_variant_id | Variant ID sent from Google Optimize | Event | variant_id |
When you’re done, it should look like this:
Once the dimension setup is complete, run an experiment for 24 hours to let the data populate under the new custom dimensions. Then you’ll be ready to use them in your Exploration reports.
I’d recommend running an A/A experiment on a low-to-medium traffic page to validate that it’s working as expected.
Keep in mind that Google is always working on Optimize and the GA4 integration. While this works today, a future product iteration will likely build these dimensions in natively, so keep an eye out for it.
Reporting on your Optimize experiments in GA4’s Exploration reports
Now that we are capturing our experiment ID and variant ID, we will be able to create custom segments and use those custom segments in Explore reports.
First, start a new Explore report, and create a new user-based segment.
Next, in the first segment condition dropdown menu, select optimize_experiment_id, select the “exactly matches” operator, then paste in the Optimize experiment ID you’d like to report on.
You can find your optimized experiment ID inside of Google Optimize on the details page under measurement and objectives:
Next, add another segment condition for optimize_variant_id, select the “exactly matches” operator and paste in your experiment ID again, but this time add a “.0” to the end to select the control variant. Finally, select “within the same session” from the condition scoping dropdown.
Repeat this process for as many experiment variations as you have, remembering to change the optimize_variant_id for each one of your variations. The variant ID of your control will be “0”, the ID of your first variation will be “1” and so on.
When you’re done, your segment should look something like this:
For each experiment you run and want to report on inside of GA4, you’ll have to create new segments.
With your segments built inside a freeform Explore report, drag your new segments into the segment comparison area. Then, drag the metrics you’d like to report on into the values area. Finally, switch the pivot option to “first row”—the first-row pivot option displays all of your segments as rows and your metrics as columns.
When you’re done, it should look something like this:
Now that your experiment IDs and variants are being captured inside of GA4, and you know how to set up your first experiment report, you’ll be able to report on your Google Optimize experiments just like you used to in Universal Analytics.
To learn more about reporting and analysis, check out our Beginner’s Guide to GA4.
GA4 Integrations Webinar Series
With a new platform comes new ways to integrate with Google tech for an end-to-end view of your customer. Join us as we explore the latest GA4 integration updates across: Google Ads, Search Ads 360, BigQuery, and Display & Video 360.
This is a 4-part series.
Three-Part GA4 Training Series
The shift to GA4 is much more involved than a simple UI change; it is a complete measurement paradigm shift. Learn how to plan your adoption roadmap, integrate across the Google tech stack, and more.