开发者

Including google analytics on a page without tracking that page?

开发者 https://www.devze.com 2023-03-03 15:25 出处:网络
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 tr

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号