Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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

share|improve this question
    
crossposted at SO: stackoverflow.com/questions/9747772/… –  gnat Mar 17 '12 at 13:41

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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