JeffS
JeffS

Reputation: 2737

Google Analytics Custom Page Variables not showing up in gif request

So I have the following javascript on a page:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<our account number>']);
_gaq.push('_setCustomVar',1,'page_type','main', 3);
_gaq.push(['_trackPageview']);

(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);
})();

However, if I look at network traffic, I see one request for a __utm.gif, but the utme parameter is not set, as I would expect it to be.

Upvotes: 0

Views: 241

Answers (1)

KnowHowSolutions
KnowHowSolutions

Reputation: 680

You still need square brackets: (google custom vars)

 _gaq.push(['_setCustomVar',
      1,                   // This custom var is set to slot #1.  Required parameter.
      'Items Removed',     // The name acts as a kind of category for the user activity.  Required parameter.
      'Yes',               // This value of the custom variable.  Required parameter.
      2                    // Sets the scope to session-level.  Optional parameter.
   ]);

Upvotes: 4

Related Questions