Who Clicks Where

Every click on a web page is important. To maintain a good, useful web site you need to keep track of what works and what doesn't work for your visitors. By looking at the web server's Log Files, you can get a better idea of how people use your web site.

However, when you provide links to other web sites, like this, this or even this, you'd like to know when someone clicks on the link. Well, here's a simple Perl script that will let you do just that.

Download This Week's Script - redirect.pl

Here's how to use the script: Now, try it out online (if my web server is online):

Jump to Yahoo.com

And, click here to view the log of people who've been redirected:

View Redirection Log

Finally, you can modify the contents of the log by changing the following line in redirect.pl:

print F "$date - $ENV{'REMOTE_ADDR'} => $toURL\n";

This line includes the current date $date, the user's IP address $ENV{'REMOTE_ADDR'} and the destination URL $toURL. You can use it to include just the information that you want in a format that's useful.

Author: Doug Steinwand
Date: [03/31/98]
More articles about CGI
More articles by Doug Steinwand
Author Biography