Created
October 15, 2013 09:22
-
-
Save simondahla/6988950 to your computer and use it in GitHub Desktop.
This file contains 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
/* Track 0 Serch Results with if statment */ | |
var content = document.getElementById('middlewrapper'); | |
if (content.innerHTML.search('Inga produkter hittades!')) { | |
var sn = "q"; | |
var sr = new RegExp(sn+"=[^\&]+"), | |
p = document.location.pathname, | |
s = document.location.search, | |
sm = s.match(sr).toString(), | |
srs = sm.split("="), | |
sre = sm.replace(sr,srs[0]+"=no-results: "+srs[1]+"&cat=no-results"), | |
sf = s.replace(sr,sre); | |
_gaq.push(['_trackPageview', p + sf]); | |
} |
This file contains 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
/* Track 0 Serch Results */ | |
var sn = "q"; | |
var sr = new RegExp(sn+"=[^\&]+"), | |
p = document.location.pathname, | |
s = document.location.search, | |
sm = s.match(sr).toString(), | |
srs = sm.split("="), | |
sre = sm.replace(sr,srs[0]+"=no-results: "+srs[1]+"&cat=no-results"), | |
sf = s.replace(sr,sre); | |
_gaq.push(['_trackPageview', p + sf]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment