Hi @craig_rouse, I've taken your code and extended it - the following seems to work :) I forgot, of course, that I'd need to set up mapping between the extension and the GA tag for the variables created - once I'd figured that out, it was fairly simple. I've tried to automate the population of subdomains, have incorporated some tracking for subdomains that use hash values for navigation, and have added timeouts to ensure that GA returns a 200 response before the link is followed. Does this look OK to you? (function () {
// Collect internal URLS only
var int_urls = new RegExp(window.location.host);
if ((int_urls.test(obj.link_url)) && window.location.hash.length > 0 && obj.link_type != "download link") { // Record virtual Page View for hash tabs on same subdomain
utag.view({
ga_virtual_page: obj.link_obj.pathname+obj.link_obj.hash
});
}
else if (!int_urls.test(obj.link_url)) {
// Record exit link clicks
utag.link({
ga_EventAction: 'Clicks',
ga_EventCategory: 'Outbound links',
ga_EventLabel: obj.link_url
});
} else if (obj.link_type === "download link") {
// Otherwise record file downloads
utag.link({
ga_EventAction: obj.link_type,
ga_EventCategory: 'Downloads',
ga_EventLabel: obj.link_text
});
}
}());
... View more