Track outbound links in Google Analytics
I wanted to try and find a way to track all of the outgoing links on my client website, without haven to modify the html of the link. What I found was that using javascript listeners would probably be the best solution.
With a bit of searching I found a script that you can place in the header file at the top of each of your pages (you might need to edit the templates if you run WordPress). The script tracks clicks to external links and reports them in Google Analytics.
Read more about Google Analytics: How to track all your outgoing links the easy way
Step 1
Place the Google analytics code in head tag rather than body tag as follows:
Step 2
Custumize the Google code as follows:
<script>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script>
function recordOutboundLink(link, category, action) {
try {
var pageTracker=_gat._getTracker(“UA-XXXXXX-X”);
pageTracker._trackPageview();
pageTracker._trackEvent(category, action);
setTimeout(‘window.open(“‘ + link.href + ‘”)’, 100);
}catch(err){}
}
</script>
Step 3
Add onclick attribute on outbound links which you wants to track as follows.
onClick=”recordOutboundLink(this, ‘Outbound Links’, ‘trackingname123);return false;”
E.g.
<a href=”http://www.ichotelsgroup.com” rel=”nofollow” target=”_blank”>Reservations</a>
Step 4
Check the outbound links in Google analytics under left menu >> Content >> Event Tracking.
Popularity: 3% [?]
Windows based barcode maker software offers excellent option to create barcode labels in simplified and effective manner.