AB Test Fomo with Google Optimize

do you use Google Optimize to run marketing experiments?

now you can test the impact Fomo has on your website, using your favorite A/B testing tool.

below is an example configuration for showing Fomo to just 50% of your visitors, and then measuring their purchase conversion rate.

step 1 - set up Google Optimize

Google Optimize is a free A/B testing tool, competing with VWO and Optimizely to help personalize and improve websites.

if you haven't already, sign up free here.

inside the dashboard are your Experiments.

Google Optimize experiments dashboard

on the right side are "todos," like connecting your Google Analytics account, and integrating a single line of code for Google Optimize.

Google Optimize setup

don't be concerned about this step - if you can find your Google Analytics (UA-XXXX) tracking snippet, you can do this! no coding required.

if you prefer to skip this step and ask a colleague to help later, it's safe to continue. we can do everything we need without Google Optimize deployed on your site.

step 2 - create an Experiment

click Create Experiment to expose a brief form.

Fomo experiment in Google Optimize

input "Fomo" as your name and select A/B as the test type, at the bottom.

in the URL field, make sure to input a fully resolved URL. ie, if your website is https://somewhere.com/ with no "www" and a slash at the end, enter that.

pro tip - visit your website in a new tab to allow auto redirects and www/naked subdomain to resolve, then copy/paste.

step 3 - configure variants

now we have a few todos, before launching the experiment on our website.

Google Optimize experiment setup

click Create Variant and provide "With Fomo" as the variant name.

Fomo variant in Google Optimize

because Google Optimize already provides a default variant called "Original," we'll make that our control, without Fomo installed. this new "With Fomo" variant will have Fomo enabled.

you'll now have two variants, which is all we need for this experiment.

Google Optimize experiments

make sure to hit Save in the top right, then (optionally) click a variant to adjust the traffic split between the two versions of your website.

we recommend the default 50/50 split, but it's up to you.

step 4 - configure objectives

scroll down to the next section, where we can choose objectives and form a hypothesis.

Google Optimize hypothesis

in this test we're going to focus on the quantity of transactions for an ecommerce store, so our hypothesis is:

If Fomo is enabled, transaction count will increase.

we aren't concerned with sales in terms of dollars, because we are ultimately focused on encouraging more clicks and adds to cart, vs cross sells or up sells.

click "Add Experiment Objective" then "Choose from List" to import a list of Goals from your connected Google Analytics account.

Google Optimize hypothesis

if you did not yet connect Google Analytics, no problem. you can either configure a custom objective, or Save your experiment and connect Google Analytics from the right-side todo list on the Google Optimize dashboard.

Google Optimize objectives

here we're going to select "Transactions" at the bottom, which is a raw count of sales transactions that occur while our experiment is live.

step 5 - targeting specific users

back on our configuration step is a Targeting tab.

Google Optimize targeting basics

while our variants determine the traffic split, we can also "meta" program our experiment to only run a portion of the time.

for example, maybe you want to 50/50 split Fomo vs No Fomo, but only want that split for 10% of your traffic.

we don't advise this kind of tuning down for low traffic sites, but if you have more than 100,000 visits to your chosen web page in a week or month, it's worth considering.

scroll down the Targeting tab to see more options, like the "When" feature.

Google Optimize when targeting

we suggest leaving the "Evaluate" strategy alone.

click Create Rule and then the URLs option.

Google Optimize when targeting rule

to run your AB experiment on every page of your website, select "URL" from the dropdown, input your naked domain (no www/http), and then select "contains" from the other dropdown.

Google Optimize url targeting rule example

this ensures your experiment will run on subdomains (ie: blog.yoursite.com), landing pages, product pages, etc.

the URL checker below this form is useful to understand if a given URL will show or ignore your experiment, so put it to good use!

after adding at least 1 URL rule, make sure to hit Save in the top right.

pro tip - you can do a lot with Targeting Rules. for example, you could configure Google Optimize to only run your Fomo AB experiment to visitors who click on Google AdWords ads, or who visit from social media.

step 6 - add Fomo

our experiment is now prepared, and we just need to inject Fomo into the "With Fomo" variant created in Step 3.

scroll to the Variants section of your experiment and click the "With Fomo" row.

Google Optimize extension

you should be prompted to install the Google Optimize extension, if you haven't already. clicking Install Extension will show a confirmation modal at the top of your browser, where you'll finish installation.

next, click the "With Fomo" variant to open the live editor.

Google Optimize variant without changes

you should be redirected to your website's home page, or whichever URL you inserted in Step 2.

in the top left, click the rectangle icon with dots on each corner.

input "head" in the Element Selector field, then uncheck both boxes below.

next, click Add Change on the bottom right, and select Javascript.

a modal will appear that looks like this:

Google Optimize javascript editor

copy and paste the following code into the text editor:

console.log('running Fomo variant...');

var loadScript = function(location, callback){
  var fileRef = document.createElement('script');
  fileRef.setAttribute('type','text/javascript');

  if (callback) {
    if (fileRef.readyState) {  // IE
      fileRef.onreadystatechange = function() {
        if (fileRef.readyState == 'loaded' || fileRef.readyState == 'complete') {
          fileRef.onreadystatechange = null;
          callback();
        }
      };
    } else {  // Non-IE
      fileRef.onload = function(){
        callback();
      };
    }
  }

  fileRef.setAttribute('src', location);
  document.head.appendChild(fileRef);
};

loadScript("https://www.usefomo.com/api/v1/XXXXXXXX/load.js");

to understand what this code does, [go here](https://developers.optimizely.com/classic/javascript/code-samples/index.html#helpers-external-js" target="_blank).

important - see the "XXXX" on the last line?

this needs to be replaced with your Fomo instance client_id.

finding this is easy - while logged into Fomo, visit your website > scroll down to Embed > copy/paste the section here, after "api/v1":

Fomo embed snippet

your Google Optimize modal should now look like this:

lastly, choose "After opening tag" in the bottom dropdown and click Apply.

in the top right you should see "1 change." click Done to save your variant modifications.

step 7 - verify setup

in your configuration screen, the Variants section should showcase the "With Fomo" variant having "1 change" applied.

the Start Experiment option is now available in the top right corner.

if this option is not clickable, and the admin bar says "Show Steps" instead, one of our previous steps was not followed, or you simply didn't click "Save" yet in the top-right corner.

step 8 - launch

when you're ready, click Start Experiment.

results will begin collecting immediately after enabling the Experiment, however it may take several hours for data to appear in your Google Optimize dashboard.

pending site traffic, check back in a few hours (or days) to determine how Fomo is performing.

step 9 - measure results

below is an actual screenshot from a Fomo customer who ran an A/B test on their ecommerce site.

fomo vwo a-b test results

as you can see, they enjoyed a 31.7% conversion boost from the fomo variation, increasing purchases from 1.67% to 2.20%.

we look forward to hearing how Fomo performs on your site. please email us if you need help setting up, or want your test results featured on our blog.



It's also free to try out.