How To Run Server Side Google Optimize Tests With Gtag JS

Easy Landing inserts the experiment and experiment ID into your Gtag Config.

If you have a Gtag JS installed in the standard way, it will look like this in your code:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');

In order to get Easy Landing to work, an experiment attribute needs to be added like so:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID', {
  "experiments": [],
});

If there is already configuration added to your Gtag JS set up, just put in experiments wherever you deem fit:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-147728719-1', {
    "linker": {
        "domains": ["easylanding.io", "www.easylanding.io", "go.easylanding.io"],
    },
    "experiments": [],
});