Need help with this script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

Need help with this script

Post by jaymoore_299 »

I'm trying to track where the surfer came from and how many clicks were generated from the site of origin.

I made all the links on my site like this http://www.domain.com/out.php?url=LINK ADDRESS
and inside the out.php I recorded the http_referer and recorded a click of one in a database. The idea was that for every click, that click would be recorded in the mysql database for that particular referer.

This does not work because his http_referer will always be from my site because he is clicking the links from my page.

I tried giving the surfer a cookie with his own http_referer in it as he came to my site, and tried to access that with every click to the out.php script, however this fails because the out.php cannot seem to read the cookie made when the surfer arrived at the main page. (I have no idea why)

I'm running out of ideas. How do I save the original http_referer that the surfer had when he came to my page and have it accessible to out.php ?

surfer comes to domain.com with his http_referer, now how do I have code this information so that domain.com/out.php can have access to this? Any ideas?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you tried saving the referrer to a session variable?

Mac
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

Post by jaymoore_299 »

I haven't done that yet. I think I have the cookies working.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

fyi, http_referrer won't always exist

(incase you didn't know)
Post Reply