Google Analytics AB Testing

This is a test to see how the experiments feature on GA works. It resets the cookie on each page load to understand how "ChooseVariation" works.

by nathanziarek

HTML

<script src="https://rawgit.com/carhartl/jquery-cookie/master/src/jquery.cookie.js"></script>
<div>Variation 
    <span class="A1"></span>
</div>

<script>
    $.removeCookie('__utmz');
    $.removeCookie('__utma');
    $.removeCookie('__utmb');
    $.removeCookie('__utmc');
</script>

<script src="//www.google-analytics.com/cx/api.js?experiment=Y9Wa54VURCOw_ibs25_JdA"></script>

<script>
     variation = cxApi.chooseVariation();
    $(".A1").text(variation);
</script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-36863627-3', 'auto');
  ga('send', 'pageview');
</script>