ga('create', 'UA-62871049-1', 'auto',{ 'name': 'tfsw_original'}); ga('tfsw_original.send', 'pageview'); // Using jQuery Event API v1.3 function gaSendEventCustom2(href, ident, text) { ga('tfsw_original.send', 'event', { 'eventCategory' : href, 'eventAction' : ident, 'eventLabel' : text, 'hitCallback': function() { } }); } $(document).ready(function(){ $(function(){ $("a").on('click', function() { var currentURL = window.location.href; if ($(this).parents('#global-dropdown','.dropdown-menu').length) { gaSendEventCustom2(this.href, 'global-dropdown', $(this).text()); } if ($(this).parents('#footer-global-links').length) { gaSendEventCustom2(this.href, 'global-footer-links', $(this).text()); } if ($(this).parents('#social-stack').length) { gaSendEventCustom2(this.href, 'global-footer-social', $(this).text()); } if ($(this).parents('.footer-buttons').length) { gaSendEventCustom2(this.href, 'global-footer-buttons', $(this).text()); } if ($(this).parents('.footer-disclaimer').length) { gaSendEventCustom2(this.href, 'global-footer-disclaimer-links', $(this).text()); } if ($(this).parents('#main-container','#mainnav').length) { if (this.hostname == $(window.location).attr('hostname')) { gaSendEventCustom2(this.href, "main-container_"+$(this).closest("[id]").attr("id")+'_'+currentURL, $(this).text()); return true; } else { gaSendEventCustom2(this.href, 'outgoing-links_'+$(this).closest("[id]").attr("id")+'_'+currentURL, $(this).text()); } } }); }); });