Forum Moderators: coopster & phranque

Message Too Old, No Replies

Using cookies to track visitors

Where do I start?

         

Ash

10:44 am on Oct 11, 2002 (gmt 0)

10+ Year Member



Hi, I would like to start following the paths of visitors to my site and have determined that using cookies is the best way to go about this. I would just like to clarify a few points.
1. When a visitor accesses my site then my server will put a cookie with a unique id into their browser, can this be done without their logging into my site i.e. the cookie is a unique id for that visitor for that particular session (if their browser allows/supports cookies) and is set when they land on my site by the fact that they've entered my domain, so to speak :)
2. The information from the cookie is entered into my server access logs as part of the referrer string.
3. The script for this would need to be in my sites cgi-bin.
If I have the right idea about this could someone please point me in the direction of a clear tutorial on how to go about this, keeping in mind that I am a complete noob when it comes to perl or php. I have searched this site and the web on 'perl+cookies' and 'php+cookies' and all of the results talk about what you can achieve with cookies but I can't seem to find anywhere that starts at the beginning ie you will need this script which goes in this place on your server and it does this which you can see here.
Thanks for any help.

Robber

12:57 pm on Oct 11, 2002 (gmt 0)

10+ Year Member



Hi Ash,

Working with cookies in perl you basically send a cookie rather than say an html page, eg:

print header(-cookie=>[$cookie1,$cookie2]);

The CGI module makes this simple take a look at perldoc.com and browse to the CGI module, you should find the cookie pages easy enough.

Hope that helps.

Ash

2:36 pm on Oct 11, 2002 (gmt 0)

10+ Year Member



Thats right on the money Robber, thanks a lot.

copongcopong

11:41 pm on Oct 12, 2002 (gmt 0)

10+ Year Member



Anyone do have an information about php+cookies too? I am interested on this topic too. :)