Question

I have setup Google Analytics script in my web site, I am using Analytics.js

<script type='text/javascript'>

  (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-xxxxxxxx-1', 'wfihotspotnet.in');
  ga('send', 'pageview');


  var dimensionValue1="21";
  ga('set', 'dimension1', dimensionValue1);
  var dimensionValue2="male";
  ga('set', 'dimension2', dimensionValue2);
  var dimensionValue3="India";
ga('set', 'dimension3', dimensionValue3);


</script>

In My Custom Reports Dashboard I have created Three reports with,

Custom Dimension Age and Metrics Pageview

Similarly for Gender vs PageView and Location vs Pageview

I have more than 400 Pageviews but In custom Dimension No data is displayed

I used Chrome GA.debug Extension and it is displaying that data is processed

what silly Mistake I have done ?

Was it helpful?

Solution

You have sent your pageview before you've set the dimensions. Custom dimensions need an interaction call to be sent to the server so in your example they are not event sent. Move the "set" calls between the lines that create the tracker and the pageview call and you should be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top