Heap will deprecate this integration on July 1st, 2023, due to Google’s removal of Universal Analytics properties.
Additionally, Heap does not track tests built with Google Analytics 4 (G4) properties and does not plan on tracking them in the future.
Moving forward, we will continue to support our integrations with AB Tasty, Optimizely X, VWO, and other A/B testing products. For more options, see our full list of supported Heap Integrations.
To learn how Heap stacks up against GA4, see Heap vs. Google Analytics 4.
Synchronous Loading Recommended
Loading Google Optimize asynchronously can cause inaccuracies in Heap data capture, as it may create a scenario where Heap loads first and misses experimentation data from before Google Optimize loaded. For this reason, we recommend setting up Google Optimize to load synchronously.
Heap’s Google Optimize integration automatically captures all active experiment variations as a Heap property attached to every event on a given page. With this source, you can answer questions like:
- How does an A/B test impact long-term retention?
- Do users exposed to an experiment convert faster than others?
- Did a given experiment influence behavior that isn’t directly related to the functionality changed?
Heap currently supports only client-side implementations of Google Optimize.
To configure the Google Optimize source, you’ll need to have the following privileges:
- Admin or Architect privileges in Heap
- Access to your Google Optimize console
Turn on Google Optimize in Heap
To get started, click Set Up on the Google Optimize page. Once connected, Heap will automatically capture all active experiments and exposed variations as a property on all events for a given page.
By default, Heap will automatically capture all active Google Optimize experiments and attach a pageview-level property to all events on that page in the user’s experience (including custom events). The format of the property follows the pattern of
Google Optimize: [Experiment Key] with the value of
[Variation Number]. An example in this format might be:
Google Optimize: yq-WQr_5T_iXAMF3MgZEtw as the property name and
1 as a value.
Map Google Optimize data through defined properties in Heap
To get the most value out of the Google Optimize source, you’ll want to map the experiment keys and variation numbers Heap autocaptures to a human-readable experiment, and variation names to be used in analysis. Please follow these steps to complete the process:
1) Access your experiment in Google Optimize
- Log in to your Google Optimize account and select the corresponding Google Analytics container associated with the site Heap is capturing data on.
- Select the experiment you’d like to map from the list of experiments. Once selected, you should see a view similar to the screenshot below:
Not sure if your experiments are set up correctly? Google has a tool to help you check.
2) Define a new property in Heap
- Within Heap, visit your properties view and click
+ New Property.
- For the name of the property, please input the name of the experiment as shown in Google Optimize. For this example, we’ll enter
Homepage Footer Tagline. For the ease of organization, you can also include the source name by titling the property
Google Optimize: Homepage Footer Tagline.
3) Map the property values to variation names
- Within the property creation view in Heap, please ensure that the property type is set to Event as the properties captured by this source are event-level properties (not user-level).
- For the first
case, select the property in Heap that corresponds with the ID of the experiment in Google Optimize. In our example, this is
Google Optimize: yq-WQr_5T_iXAMF3MgZEtw. The ID can be found under the Measurement and objectives header of the experiment view in Google Optimize:
when clause by specifying when the aforementioned property
is equal to to the first variation number in Google Optimize. To receive this variation number, click on any variation name within the
Variants section of Google Optimize which will launch the Google Optimize experiment editor.
Within this view, click on the variation name drop-down in the top-left of the toolbar to see all variations associated with their variation number. In the example screenshot below, you can see our two variations
Answer Questions with their respective variation numbers
- In this example, the first
whenstatement should read:
When Google Optimize: [experiment ID] is equal to 0.
- To finalize the first variation mapping, you’ll need to enter the variation name as the constant value for this case. The entire case statement for this example should read:
When Google Optimize: [experiment ID] is equal to 0 set value to a constant value Original.
- Repeat the case definition process for any other experiment variations and save your property. A complete definition for this example would look like:
That’s it! You’re now able to use human-readable Google Optimize properties in analysis. You’ll need to repeat the property creation process entirely for any other experiments you’d like to map.
Once the mapping process is complete, you’ll now have a property available in Heap entitled
Google Optimize: Experiment Name with the values of
Variation Name that is attached to every page view where the experiment was active. This property will be available throughout all analysis in Heap!