Badger Cat
Badger Cat

Reputation: 966

Is the utmt parameter needed when sending a custom variable gif request in google analytics?

I am trying to use google analytics on the server side using custom variables.

Google says the following about the utmt parameter:

Indicates the type of request, which is one of: event, transaction, item, or custom variable. If this value is not present in the GIF request, the request is typed as page.

However when I use http headers, I do not see the utmt parameter being sent even when I am defining custom variables. Is it necessary? If so, could you provide a query string example?

EDIT: This is the javascript code that I'm using:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-123456789-1']);
_gaq.push(['_setCustomVar', 1, 'Test', 'Test', 2]);
_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);
})();

</script>

Upvotes: 1

Views: 1108

Answers (1)

greg
greg

Reputation: 2349

Contrary to what the documentation suggests, you can't set a customvar outside a pageview or event tracking. And _setCustomVar don't call the GA servers by itself.
utmt parameter value can only be 'event', 'item', 'transaction', and has a pageview value if not set.

Custom variables are passed with calls from pageview or event (as briefly explained here)

In your exemple, the custom variable is send with a _trackPageview call (you can see it at utme=8(Test)9(Test)11(2)).
Pageview is the default value for utmt, so there is no need to specify it here.

Note : the "custom variable" in the documentation refer to the old _setVar function which is deprecated.

Upvotes: 3

Related Questions