Filter Google Analytics external links tracking

Since SEOPress 2.6

function sp_gtag_link_tracking_ev($html) {
return "jQuery(document).ready(function() {
 jQuery('a[target=\"_blank\"]').click(function(e) {
 gtag('event', 'click', {'event_category': 'external links','event_label' : this.href});
 });
});
";
}
add_filter('seopress_gtag_link_tracking_ev', 'sp_gtag_link_tracking_ev');

Last modified: April 1, 2018