Below is the CGI program to track a visitor's browser from page to page and from domain to domain.
The program maintains a simple database that records
Note that some browsers do not provide the referring URL (such as when security and privacy settings cause the referrer to be suppressed), in which case the URL of the page is stated
- the visitor's ID (which is "ID" plus the system time as set by cookie the first time the visitor arrived at any of the monitored domains),
- the system time when the visitor arrived at the current page, and
- the URL of the page.
as: [unknown] Installation instructions:
All edits must be done with a plain text word processor such as NotePad or BBEdit. In the article, the example named the script monitor.cgi, but you may name it as you wish.
Ensure that the first line of the script points to the perl on your server. (This script requires Perl version 5+)
Replace the digit in the
my $DaysCookieLives = 1;line with the number of days you want to cookie to live in your visitor's browser. Maximum 3652(10 years) and minimum 0 (automatically deletes when browser closes).Replace the image file name in the
my $ImageFileName = 'image.jpg';line with the file name of the image the program shall send to the browser.Replace the tracking file name in the
my $TrackingFileName = 'tracking.txt';line with the file name you prefer.Upload the script into a directory on your cookie handler domain that can run Perl CGI scripts. Upload it with FTP as ASCII/plain text, not binary.
Ensure the script has global execution permission, 0755 on Unix/Linux.
Upload the image the script will use into the directory where the script is installed.
The related article was first published in WillMaster Possibilities, titled, "Multi-Domain Cookies." Please see the article for additional informaiton. It is linked from the WillMaster Possibilities archives.
Here is the CGI program: