Tracking link in different browsers

I use adobe analytics and try to track links using this:

$(document).on('click', 'a', function() { 
    s.tl(this, 'e', 'link', null, 'navigate'); 
    return false; 
});

or

$("a").click(function() { 
    s.tl(this, 'e', 'link', null, 'navigate'); 
    return false; 
});

and when I tested it and click in a link in Chrome I receive for the first the status page canceled and using the second option in chrome everything works fine but in Firefox I receive status 0 GET (NS_BINDING_ABORTED) .

Is there any workaround which could run without problem in all browsers or should I fix anything to the previous?

From here is the example I use using the second box as example

I found this solution:

https://marketing.adobe.com/developer/es/forum/general-topic-forum/custom-link-tracking-capturing-issue

Which proposes this as a work around:

<script language="javascript">
function pejTracking(linkname,url) {
var s=s_gi('myprodsuite');
s.tl(this,'o',linkname,null,navigate(url));
}
function navigate(url) {
window.location=url;
}
</script>

<a href="#" onclick="pejTracking('mytest', 'mytestpage.com');return false;">This really works!</a>

Is it possible to make it to work with the JQuery document or a onclick function as I have at the start of my post and there is any need to have the onclick in every link?


This is common, and (probably) isn't a problem.

This error occurs because the link tracking image request is designed to let the browser proceed to the next page before waiting for a response from the Adobe data collection servers.

Adobe Reference: NS_Binding_Aborted in Packet Monitors

Update:

You commented:

Yes I have seen this but is it possible to fix it?

You are asking to "fix" this as if it's something that is broken.. my point is that it's not broken.

But if you insist on wanting to make sure this doesn't show up, you will need to do the solution you already posted in your question.

The jQuery equivalent would be to make use of event.preventDefault() and then update window.location after the s.tl call (in navigate callback) same as the non-jQuery solution.

You also asked:

And what about chrome?

What about it? This isn't browser-specific. It has to do with timing. Try it enough times in Chrome and you should see that NS_Binding_Aborted error in Chrome, too. Maybe. Depends on connection speed, current CPU resources, internet traffic in general, how the stars are aligned, etc. - you know, all the things that make requests and response happen later rather than sooner.

链接地址: http://www.djcxy.com/p/71684.html

上一篇: 分配一个新的调用堆栈

下一篇: 跟踪不同浏览器中的链接