最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to track events before page redirect with google analytics? - Stack Overflow

programmeradmin4浏览0评论

I use GA's trackEvent to record user's click event on search autoplete of my site. When user click on item of autoplete, I record two event, and then page redirect to the result page. But the problem is: the amount of the two action "click" and "view" is not equal, the amount of "click" > the amount of "view". I see the two request are sent in firebug, but they are both canceled because the page redirect. Even though they are canceled, I can see the result in GA.I just can't understand why they are not equal? The later one failed sometimes?

Here is the code part:

//trackEvent just use _gaq.push("trackEvent", xxx)
trackEvent("search", "click");
trackEvent("search", "view");
window.location.href = des;

I use GA's trackEvent to record user's click event on search autoplete of my site. When user click on item of autoplete, I record two event, and then page redirect to the result page. But the problem is: the amount of the two action "click" and "view" is not equal, the amount of "click" > the amount of "view". I see the two request are sent in firebug, but they are both canceled because the page redirect. Even though they are canceled, I can see the result in GA.I just can't understand why they are not equal? The later one failed sometimes?

Here is the code part:

//trackEvent just use _gaq.push("trackEvent", xxx)
trackEvent("search", "click");
trackEvent("search", "view");
window.location.href = des;
Share Improve this question asked Aug 20, 2012 at 6:20 user1610957user1610957 1011 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Here's the answer to your question:

Google Analytics - Setting the Hit Callback

发布评论

评论列表(0)

  1. 暂无评论