I found a great page hit and download counter. It is a free perl script. No spyware, just a nice clean little script that you install yourself. And it's quite easy to do.
Unicounter Free Perl Script Download
Filezilla Free FTP Solution
First download the unicounter file. In the script directory, find and take out unicounter.pl. If your FTP program does not allow you to upload in ASCII, then you also need to download the free Filezilla FTP program. It will allow you to upload to your server in ASCII.
Next create a directory in the cgi-bin, and name it "counters". Upload unicounter.pl in ASCII to the counters directory and change the permissions of the folder and the unicounter.pl file, to 755.
You can now test the upload in your browser. Put this line in your browser address bar:
http://www.yourdomain.com/cgi-bin/counters/unicounter.pl?name=test&create=23
Change the domain name, of course, and load. If it is working correctly, the returned value should read document.write('23'); This will appear in the main window of the browser. If it fails, go here and read more detailed directions.
So lets assume it all went correctly. Now put the javascript into your webpage.
Copy the above javascript exactly into a test web page. Loading the webpage will create a data file in the counters folder that is tied to the javascript on that webpage.
I put &cache=0 to make sure caching was turned off. Also &trackip=8 can be set as high as 16. There is more detailed instructions about cache and tracking if you go here.
You should now have a working page hit counter.
To make sure it is working properly, I found I had to test from a different computer outside my home wifi network . So I called my sister and my son and we made sure it was incrementing properly.
You can dress it up by putting a around the javascript, changing background color and border color. You can change the wording of the javascript document.write("Page hits = "); even eliminating all the words within the quotation marks, which will make it just write a number.
In order to make a hidden counter, add &write=0 to the parameters in the javascript on the webpage. Then repeat the javascript on a hidden page, but replace the write parameter with &inc=0. This will write the counter to the hidden page, rather than the actual page. You can have a running list of multiple counters on one hidden page by adding each identifying javascript to that page.
For a download counter, you need the original javascript, but also, you need to do two things: First, add the following line to your webpage.
NameOfCounter &deliver=http://www.yourdomain.com/downloads/YourDownload.zip">Download Link Text
* blue lettering denotes items that you will name.
and second: add the parameter &inc=0 into the javascriptscript on the actual webpage. Then if you want it hidden, add the parameter &inc=0 to the hidden script. Test by downloading a file on a computer outside your network.
If you want to change the number on the counter, using an FTP client such as Filezilla, simply delete the counter data file (not the perl script). Then call the perl script from your blank browser address bar using a url of the form:
http://www.yourdomain.com/cgi-bin/counters/unicounter.pl?name=NameOfCounter&create=123
It's a great script and I am really glad I found it. If you want more detail about installing this script, go here. |