Forum Moderators: open
I was wondering if somebody know how can I do this:
- If somebody comes from an external page, (an affiliate, referral send me this person), I would like to load PAGE X with Y text.
- If somebody find me by organic search (google, yahoo...)or any other way (google ads...) I would like to load page W with text Z
The idea is that I would like to load different pages based on the incoming link... maybe and IF something is enought...
"If incoming link something like
http://"affiliate code...could be ANY word here".somedomain.com(same domain all the time)/yyy/www so GO TO THE AFFILIATE SALES PAGE
IF NOT LOAD THE REGULAR PAGE..."
So guys can you help me with this one...
Please
Thank you! :)
[edited by: DrDoc at 6:40 pm (utc) on Jan. 21, 2006]
[edit reason] delinked non-link text [/edit]
document.referrer and string matching (using regular expressions). For example: <script type="text/javascript">
if(document.referrer.match(/example\.com/)) {
location.href = "./someotherpage.html";
}
</script>
This obviously doesn't work when JavaScript is turned off. It also wastes time by requiring an extra trip to the server. Something like this could be handled much better using a server side solution -- preferrably
[b]mod_rewrite[/b] Finally, be aware and take into consideration that the referrer is not reliable. Sometimes it is not sent. Other times it is not correct. And, it can easily be spoofed.