Google Optimize

Enriching your feedback with the variant id of specific experiments you are running could give you valuable insight and additional information about the experiment you are running.

We make use of the gaData object, which is part of Google Analytics UA, to collect information on the running experiments.

Adding variants for specific experiments to feedback

Data on current experiments being run by Google Optimize can be found on your website in the global object gaData. You can find this by opening the developer tools of your browser and then typing in gaData.

 

The experiments can be accessed by using the Google Analytics container ID in bracket notation:

gaData['UA-7506974-26'].experiments

To then get the variant that is being used on the page we can then also pass the experiment id in bracket notation:

gaData['UA-7506974-26'].experiments['VMpCdSoTTvuAPsA5dLhqCw']

The experiment ID can also be found in the Optimize dashboard under the Measurement and Objectives heading.

Website data element

In your feedback form add a website data element and add a JS variable to in, set the name of the variable to (replacing the CONTAINER_ID and EXPERIMENT_ID with your own):

gaData[CONTAINER_ID].experiments[EXPERIMENT_ID]

Feedback inbox

Your feedback will now contain the variant version if feedback is recorded from a page where an experiment is active.