Someone reminded me recently that I haven’t posted the click tracking software I mentioned during PodCamp Toronto. This is it – to use it, edit the URL at the top of the code, then copy and paste it into its own directory on your server, naming the file index.php. Next, link to that directory – for example, https://www.FinancialAidPodcast.com/bumrush/ and it will automatically record a few statistics and then bounce the user invisibly to the destination you want them to go to.
The statistics it collects are:
- IP address
- Referring URL
No personally identifying information is collected, unless for some reason you mapped your static IP address to your personal domain, in which case, you probably want people to know that anyway. The stats themselves will be in a text CSV file stored in that same folder, broken out by day. It collects raw clicks, so if someone comes and visits you over and over again, it’ll record it each time.
Here’s the code:
url=”https://www.christopherspenn.com/youve-discovered-the-missing-link/”; //change to end destinationip = _SERVER[‘REMOTE_ADDR’]; // gathers IP address of userrefer = _SERVER[‘HTTP_REFERER’]; // gathers referring page of user – good to see where clicks are coming fromtimestamp = date(“Y-m-d H:i:s”, time()); // timestamp
filedate = date(“Ymd”, time()); // creates file-friendly date format for logfile = “filedate-clicklog.csv”; // the log file namehandle = fopen(file, “a”); // open the file in write modestream = “ip,refer,timestamp\n”;
// now redirect the user!