0

I'm running a google analytics experiment, and I'm only getting sessions for one variant.

  • The original page redirects to the variant page when testing.
  • "Distribute sessions evenly" option is set to on.
  • Both pages validate in the google experiment admin
  • Experiment code is immediately after the opening <head> tag, on original page only. Variant page only has the normal GA tracking code.
  • GA script tag and ga.create is right before closing </head> tag on both pages
  • ga.send('pageview') is right before closing </body> tag, as well as some js code to send events to GA when user clicks links.

186 sessions on the experiment, and 186 sessions on original page only. No sessions on the variant page.

Also, when I'm redirected to the variant page, I get the plain url without any UTM codes in the querystring.

I'll post the HTML if needed.

...

Here's the original page HTML. Variation page is the same, except without the Content Experiment code, just the analytics tag. I do get events record in analytics from the variation page, just not in the experiment:

<html><head>

<!-- Google Analytics Content Experiment code -->
<script>function utmx_section(){}function utmx(){}(function(){var
k='###',d=document,l=d.location,c=d.cookie;
if(l.search.indexOf('utm_expid='+k)>0)return;
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
</script><script>utmx('url','A/B');</script>
<!-- End of Google Analytics Content Experiment code -->

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

...

<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','https://www.google-analytics.com/analytics.js','ga');

  ga('create', '###', 'auto');
</script>
<script
  src="http://code.jquery.com/jquery-3.2.1.min.js"
  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  crossorigin="anonymous"></script>
</head>
<body>
...

<script type="text/javascript">
  ga('send', 'pageview');

  $('a.red_button').click(function(e) {
    ga('send', 'event', 'Click', 'red_button', 'conversion');
  });

</script>

</body></html>
  • You can use Tag Assistant Chrome Extension to check if the variant has the proper GA tracking code. Also make sure it has the same property tacking code and that both pages have pageviews/events in the same view. – Osvaldo May 5 '17 at 18:23
  • I did each of those. All good, but still nothing in analytics experiment reports. I'll update my answer and show code. – stampede76 May 6 '17 at 0:20
1
+50

I'd use Google Optimize (not to be confused with Optimizely, which is a similar service created by former googlers).

With it, you can run experiments on page variations with ease, it's an included service on the Google Platform. You'll be able to track sessions on the variations without having to jump into the source code.

Though it may seem like you prefer your current route, I figured I'd include this option just so you're not losing time on A/B tests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.