abbyd77023085, modern browsers like Chrome and FireFox try to optimize resource usage as much as possible, so when we use code like this:
<script>
$('a').click(function(){
adobe.target.trackEvent({mbox:'quicklinkclick'})
});
</script>
What happens behind the scenes is the following:
- User clicks the link
- Click event listener is executed and a click tracking request is fired
- At the same time browser sees that he has to load a new page, because user clicked on a link, so Chrome and FireFox will "cancel" the click tracking request and that's why we see the "abort" message being logged
To fix this we'll have to do the following:
- Prevent default click handling
- Load the page referenced by the link manually
The code could look like this:
<script>
$('a').click(function(e){
e.preventDefault();
adobe.target.trackEvent({
mbox:'quicklinkclick',
success: function() {
location.href = $(a).attr('href');
},
error: function() {
location.href = $(a).attr('href');
},
timeout: 500
});
});
</script>
NOTE: it is important to use a timeout, so we don't block the page navigation for too long. Also it is important to use success and error callbacks to make sure that we navigate away ONLY when Target request succeeded or failed.