Last active
August 29, 2015 14:01
-
-
Save yratof/30cb927ee09009b4d18e to your computer and use it in GitHub Desktop.
Track Zero Search Results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function gup( name ) | |
{ | |
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); | |
var regexS = "[\\?&]"+name+"=([^&#]*)"; | |
var regex = new RegExp( regexS ); | |
var results = regex.exec( window.location.href ); | |
if( results == null ) | |
return ""; | |
else | |
return results[1]; | |
} | |
var SearchTerm = gup('s'); | |
_gaq.push(['_trackEvent', 'Search', 'ZeroResults', (SearchTerm ? SearchTerm : 'blank')]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment