This is a problem because when I do email campaign, There is a link on the email, that link to my company homepage, I would like to differentiate between the visitor come from another way (e.g. search on google) or the visitor come from the email I have sent.

Is it able to check such kind of information ? Thankyou


Use the Javascript `document.referrer.hostname'. Note that it will be null if the user navigated to your page via the address bar, and it doesn't work in IE, so enclose it in a trycatch block.

For different email campaigns, modify their links. So have one email campaign go to yoursite.com/landing.php?campaign=1 the other to yoursite.com/landing.php?campaign=2

To implement all this, create a php/jsp/asp file, landing.php that can record the email campaign. Make a similar bare-bones page, record.php, that records the sitename and IP. On every page of your site, add the javascript code. If the result isn't your sitename, blank, or null, have the JS AJAX-request the page record.php?fromsite=sitename&ip=IPAddress. Or something like that.

  • Thank you, as it is a email rather than a website (no real url, perhaps? can i find out that kind of information? Also, can it differentiate between mailcampaign 1 and mailcampaign 2? – user782104 Mar 17 '12 at 6:04
  • @user782104 fixed. – Manishearth Mar 17 '12 at 6:22
  • Instead of creating own code , Using google analytics would implement this? Thank you – user782104 Mar 17 '12 at 8:37
  • @user782104 yes, but the email campaign thing would not work. – Manishearth Mar 17 '12 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.