Kenneth Luna
Kenneth Luna

Reputation: 11

Visitor Custom Variable Google Analytics Help

I am using Google Analytics Custom Variables for a site I am working on. Here is the code snippet uploaded on the page.

   _gaq.push(['_setAccount', 'UA-xxxxxxxxx-1']);
 //]]>
 </script>

 <script>
  //<![CDATA[
    _gaq.push(['_trackPageview', 'searches/new/registration/complete']);
    _gaq.push(['_setCustomVar', 1, "member type", "registered", 1]);
    _gaq.push(['_trackEvent', 'registration', 'signup',,1]);

Although I am aware that the _trackPageview needs to be placed after the _setCustomVar call, I am still seeing numbers flow through into Google Analytics as 'member type=registered'. I do not want to dismiss these numbers and I want to make some sense of it before I amend this error in how the snippet was placed.

Any reason why I stil received visits for this Name-Value combination?

Thanks -

Upvotes: 1

Views: 142

Answers (2)

George
George

Reputation: 6104

Because your custom variable's scope is set to 1, it'll still get fired by "trackEvent" (even without "trackPageview".

If your scope was set to 3 (page-level), it will then rely on "trackPageview" and will not register well with "trackEvent"

Upvotes: 0

Augusto Roselli
Augusto Roselli

Reputation: 220

The Custom Var is set with a GA cookie, and is actually stored and sent on your next _trackPageview, that's why you can still see it, all you are doing to sending the data probably in a moment you don't want to (the next pageview).

Edit: Also as pointed out, it could go with your _trackEvent method, wich will end up doing the same thing, sending the data in a particular time you dont intent to, specially with events, wich are linked to interactions, so if no one triggers those in the page you are trying to set the customVar, it wont get set at all.

Upvotes: 0

Related Questions