Targeting Window.location.pathname
I have a url similiar to this: www.mysite.com/products/ I was using this to test against the pathname: if (/\/products\//.test(window.location)) { _gaq.push(['_trackPageview', '/p
Solution 1:
Add a $
at the end of your regexp:
if (/\/products\/$/.test(window.location)) {
_gaq.push(['_trackPageview', '/products/landing']);
}
example: http://jsfiddle.net/niklasvh/feK4A/
Post a Comment for "Targeting Window.location.pathname"