Jquery Analytics tracking onclick NS_BINDING_ABORTED

核能气质少年 提交于 2020-01-15 10:33:34

问题


Hey I am adding an onclick event to track clicks on certain videos, the 3rd party tool we are using is webtrends.

I am adding the onclick event and it works fine. The thing to note is the url in the link makes the user browse to a different url.

When I track the onclick event in httpfox I see the error NS_BINDING_ABORTED.

My jquery

$j(document).ready(function () {
$j('a.wt_video').click(function (e) {
    var title = ($j(this).attr("title"));
    if (title.length != 0) {
        handleDynamicVideoWebTrendsClick(title);
    }
});

});

Any ideas what I can add to prevent this error ?


回答1:


I have found that we have to do two things to avoid the "Aborted" error.

1) use setTimeout 2) use mousedown - Especially for FireFox, because it views click as both mousedown and mouseup

    $("#someBtn").live("mousedown", function(){
    var mT7 = setTimeout("myFunction()", 50); // 1000 would be a second
});

var myFunction = function(){
var wtArgs = ['WT.dcs_id', 'youridgoeshere', 'DCSext.myFirstVar', varArray[varArray.length-2], 'DCSext.mySecondVar', varArray[varArray.length-1], 'DCSext.myThirdVar', tempArr[0]];
    dcsMultiTrack.apply(this, wtArgs);
}

Hope that helps




回答2:


According to the answers posted here: Google Analytics: delay needed for tracking link clicks? , using a delay seems to be the most indicated solution to ensure that GA request is finished before a new page is loaded, as a result of clicking on a link.

I also had this problem: all my clicks were generating a NS_BINDING_ABORTED in HTTPFox, until I modified the code as suggested there. Since then, everything worked fine



来源:https://stackoverflow.com/questions/15794197/jquery-analytics-tracking-onclick-ns-binding-aborted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!