$( ".fire-fb-lead" ).click(function( event ) { event.preventDefault(); fbq('track', 'Lead'); var url = $(this).attr('href'); window.open(url, '_blank'); }); $( "a" ).click(function( event ) { if (window.location.href.indexOf("virtual-admission-resources") > -1) { event.preventDefault(); fbq('track', 'ViewContent'); var url = $(this).attr('href'); window.open(url); } });