implementing tracking of outbound links

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 năm cách đây
Anyone familiar with google analytics ?

I'm trying to add to my analytics - i need to be able to monitor some outbound links - got the information i need from google :
http://support.google.com/analytics/answer/1136920?hl=en-GB

and I've implemented the code in root.head.cshtml


<script type="text/javascript">
function trackOutboundLink(link, category, action) {

try {
_gaq.push(['_trackEvent', category , action]);
} catch(err){}

setTimeout(function() {
document.location.href = link.href;
}, 100);
}
</script>


then called the function in my link (the link is included via the editor for the product description) like so :


<a href="http://www.example.com" onClick="trackOutboundLink(this, 'Outbound Links', 'example.com'); return false;" target="_blank">


All the code renders fine in the page that's delivered to the browser.


But this isn't registering on my analytics - anyone know why/why not ? am I not waiting long enough for the results to be recorder or is there a problem ?

also, despite including target="_blank"  the new link opens up in the same page.

Any ideas would be much appreciated.
11 năm cách đây
Google is typically on a 24 hour cycle for updating reports, except some of their new real-time reports.
11 năm cách đây
just not working even after 10 days, can't see any problem with the implementation :(
10 năm cách đây
Hi haydie,
am also trying for that thing..
is it working fine?
and tell me the code if u did any modifications on it..
and when i paste following link in product description..it is visible for user also..but user should see only link ,and no need to see total code..

<a href="http://www.example.com" onClick="trackOutboundLink(this, 'Outbound Links', 'example.com'); return false;" target="_blank">
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.