clicktrack
05-30-2012, 07:05 PM
I am trying to check the referring domain and match certain domains and got part way there but not all of the way.
Ideally I want to check referrer and if it matches google, yahoo, bing, msn, etc. I want to get which one so I can change some stuff on the site for them.
So far I have something like this.
var url = document.referrer;
patternstring = /^https?:\/\/(\w+\.)?(google|yahoo|msn)\./;
matcher = url.match(patternstring);
This will match but gives back more than I want. I would only want it to give back google or yahoo or msn.
Any help would be appreciated.
Ideally I want to check referrer and if it matches google, yahoo, bing, msn, etc. I want to get which one so I can change some stuff on the site for them.
So far I have something like this.
var url = document.referrer;
patternstring = /^https?:\/\/(\w+\.)?(google|yahoo|msn)\./;
matcher = url.match(patternstring);
This will match but gives back more than I want. I would only want it to give back google or yahoo or msn.
Any help would be appreciated.