Robert Granlund
asked on
PHP tracking a visitor
I have a website that has multiple "Partner" pages on the site. If a customer comes to the site (Enters the site) through a partner page and ends up making a purchase, how do I track that customer so as that I know the customer came from a specific partner page?
The reason for this is that the specific partner get's a credit.
The reason for this is that the specific partner get's a credit.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Ray, after I read the article and did further research, I decided to use the $_SESSION variable. I works 100% the way I want it to. Thanks Ray.
Great - thanks for the points and best of luck with it! ~Ray
Open in new window
On your site you should parse out the arguments and look for the referer.
$referer = $_GET['referer'];
Then you will know where they came from. That is an easy way of doing it. There are other ways as well. PHP has a $_SERVER['HTTP_REFERER']
This is typically set in the request headers. They are sometimes empty though like if someone directly comes to your site by typing in the url then these will be empty. Also if someone accesses your site programatically (cURL) they may be empty.
The easiest way is to ask your referrers to add the referer=xyz.com to the link