Dean Moses
Dean Moses

Reputation: 2382

Google Analytics: can I combine trackEvent and trackPageView into a single call?

I am combining Google Analytics' _trackEvent and _trackPageview into a single call, like the following:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20822178-2']);
_gaq.push(['_setCustomVar', 1, 'My Custom Page View Variable', 'My Value']);
_gaq.push(['_trackEvent', 'My Category', 'My Action']);
_gaq.push(['_trackPageview']);
[...GA snippet insertion...]

This generates two __utm.gif requests to Google. This would be okay except that the request with the _trackEvent information ALSO contains the CustomVar info, which leads me to believe that Google counts the pageview on BOTH requests. I don't want to double count my page requests... so is Google smart enough to throw away the pageview info sent with the _trackEvent call?

Thanks!

Upvotes: 0

Views: 1574

Answers (1)

CrayonViolent
CrayonViolent

Reputation: 32532

It won't double count page views but it is double counting your custom var. If you don't want that, reorder the pushes, make the trackpageview come first, then the custom var, then the event

Upvotes: 2

Related Questions