jcalfee314
jcalfee314

Reputation: 4830

Google Analytics custom variables not showing up

I have been running this code for some time now on all pages. This custom variable has never shown up.

Sorry to ask this again, I don't see another post that solves my case. This has to be the simplest case in the world, this is the same code with only the UA changed:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-12345678-1']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_setCustomVar', 1, 'User', 'jc', 3]);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

I did not modify the (function()...) .. Do you see the problem? I'm using slot 1 with the page level (3) scope. The same code appears on each page for a given user.

Upvotes: 1

Views: 761

Answers (1)

CrayonViolent
CrayonViolent

Reputation: 32532

_setCustomVar does not trigger a request to GA. _trackPageview does. You have to move the _setCustomVar above the _trackPageview.

Upvotes: 5

Related Questions