How to Integrate Google Optimize With Fullstory

Learn how to send Google Optimize experiments data to FullStory to be able to filter and watch recorded sessions by variants.

Google Optimize and FullStory are two great product analytics tools. They are even greater when integrated. You can send experiments’ data from Google Optimize to FullStory. That way you can filter recorded sessions by a specific variant, to better understand how users interact with them.

The two doesn’t have an official integration, but they can be easily integrated using this code:

add_action('wp_head', 'fullstory_google_optimize_integration'); function fullstory_google_optimize_integration() { ?> <script> (function() { var experiments = []; window.dataLayer = window.dataLayer || []; window.gtag = window.gtag || function() { dataLayer.push(arguments); }; window.gtag('event', 'optimize.callback', { callback: callback }); function callback(value, name) { var experience = name + '=' + value; if (experiments.indexOf(experience) === -1) { experiments.push(experience); window.FS.event("Google Optimize Experiment", { experiment_id_str: name, experiment_value_str: value }); window.FS.setUserVars({ optimize_experiments_strs: experiments }); } } })(); </script> <?php }
Code language: JavaScript (javascript)

After the data flows, you can either filter session by users:

Or by events:

You can find the experiment ID in the experiment Details tab on Google Optimize, and the experiment value is the variants key, starting with 0, according to the order they show in on Google Optimize.

Leave a comment

Your email address will not be published. Required fields are marked *