/*
* Track outbound links
*/
$(function() {
// Track outbound links
if(typeof(ga) !== 'undefined') {
// Track outbound links
$('a[href*=http]').on('click', function(e) {
var el = $(this);
var href = el.attr('href');
var http = 'http://' + window.location.host;
var https = 'https://' + window.location.host;
// If the link does not belong to the site then record it
if(href.substr(0, http.length) != http && href.substr(0, https.length) != https) {
var parts = href.split('/');
parts.splice(3);
var domain = parts.join('/');
ga('send', 'event', 'Outbound Link', domain, href);
}
});
}
});