Integrating FullStory and Google Optimize

Jan 17, 2021

If you use FullStory (session replay tool) and Google Optimize (a/b testing), you can automatically send your experiment data into FullStory for filtering and further analysis.

For example, I'm running an experiment on www.nerdydata.com that adds a banner to promote our Free Website Inspector Chrome Extension. Naturally, I wanted to watch Fullstory sessions to learn how people interacted with theĀ banner, who was clicking it, andĀ if it caused any bugs or issues.

Benefits

Adding Google Optimize experiments in Fullstory will let you:

Code Snippet

Copy and paste this javascript code anywhere on your website (or in a Google Tag Manager HTML tag). It only needs to run once and it will handle experiments activated before or afterwards.


<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("optimize_experiment", {
                experiment_id_str: name,
                experiment_value_str: value
            });
            window.FS.setUserVars({
                optimize_experiments_strs: experiments
            });
        }
    }
})();
</script>

How It Works

Any time an Optimize Experiment is activated, the code will do two things:

  1. Log a FullStory Custom Event

  2. Log FullStory User Vars

Every Google Optimize experiment has an Experiment ID (located in the Details tab of the experiment), and each user is assigned to a variation when an experiment is activated.

The variation value will be a number (as described in the documentation), or empty in the case of a Personalization experiment (with no variations).
For example, 0 = original, 1 = variant 1, etc.


P.S. Have you tried NerdyData's Free Website Inspector Chrome Extension? Use it to analyze any website's tech stack and see their annual tech spend. Plus, if you install it from the banner you'll help that experiment variation win!