I want to track a JavaScript event on a page, but I don't want to track the page view itself. If I remove the ['_trackPageview']
below will GA still be included on the page correctly and will it track the JavaScript events? Or do you HAVE to track the page that GA is included on?
_gaq.push(
['_setAccount', 'XX-111111-1'],
['_trackPageview'] //get rid of this line
);
(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.getElementsB开发者_Python百科yTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
You do not need to include the _trackPageview
. If you include your own _trackEvent
calls, they'll work fine. But that will mean that information from these pages will be missing from the Content view, and only the data from the Event calls you send will be recorded.
In earlier versions of Google Analytics, calling _trackEvent
without _trackPageview
would trigger a bug, but that is no longer the case, since April 2010.
精彩评论