Here is the scope of the script:
Users comes to my site signs up for a demo of a software product. I need to know which website the user came from.
Step 1. Capture URL where user came from.
Step 2. User surf around my site and still retain the capture original URL (URL parameter must be able to pass from one page to another).
Step 3. The referrer URL must be stored in a cookie that maybe accessible when the users returns
Step 4. When the user fills out the form that URL must be inputed into a hidden field (The form has been created, I will provide you with a sample form page to insert the hidden field).
Step 5. Must ensure this script works on popular browsers (IE 7, IE 6,
FireFox and Opera).
Here is a scenario of the above script:
1. User Y search for an X product on Google. Clicks on the link and lands on my product page.
2. The PHP script captures the Google URL and stores it in a cookie.
3. The user Y decides not to sign up form.
4. User Y comes back 2 days later surf around the website and decides to fill out the signup form.
5. PHP script checks the cookie and sees that the user Y had visited the site 2 days prior, and retrives the referrer URL from user Y's cookie.
6. PHP script writes that info into a hidden field in signup form.