jquery(function($){ function sendAnalytics( name, type, cat, act, label, extra ) { if (cat =='service') { if (act =='hidden_description' || act =='description') { return; } } else if (cat =='filter') { if (('' + label).indexOf('apply') == -1) { return; } } if (cat ==='organization' && (act ==='show_phone' || act ==='call_phone')) return; window.ga.apply(null, arguments); } $(window).off('track-event.analytics').on('track-event.analytics', function(e, cat, act, label) { sendAnalytics('send', 'event', cat, act, label); }); // @TODO unused? remove! $(window).off('track-event-nonint.analytics').on('track-event-nonint.analytics', function(e, cat, act, label) { sendAnalytics('send', 'event', cat, act, label, { nonInteraction: 1 }); }); $(window).off('track-pageload.analytics').on('track-pageload.analytics', function(e, cat, act, label) { sendAnalytics('send', 'pageview'); }); $(document).off('click.analytics').on('click.analytics', 'A.js-external', function(e) { sendAnalytics('send', 'event', "Outgoing urls", href); var href = $(this).attr('href'); if ($(this).attr('target') !='_blank') { setTimeout('document.location ="' + href + '"', 100); return false; } else { return true; } }); }); <