HitsLog v1.2.0 (Freeware with source!)
Every webmaster wants to know how many people visit his website and whence
they come. Usually to find out such information the webmasters analyze the
However, in case of shared hosting plans, when one web-server serves several
sites, the access to log files is complicated because of the certain
technical difficulties. For this reason all free and many inexpensive
hosting plans do not allow access to web-server log files. Instead of it,
in the best case, they offer the on-line tools, often very limited.
But if the hosting-plan allows to use CGI, Perl and SSI then webmaster
can use the server-side scripts for producing log files.
Simple Perl script for logging the page hits and file downloads. The HitsLog
produce the standard common or combined log files, which can be processed by
any modern log analyzer (we recommend the ClickTracks Analyzer - powerful and easy to use tool with
The HitsLog use the classical way for embedding into web page - by using the
SSI "include" directive, by remaining, thus, completely invisible for
visitor. For logging the file downloads, is used also classical way -
relocating by script. Main difference from other logging scripts is
possibility to log also sizes of pages and files.
- First of all, you need configure the script. But if your hosting provider
use the mod_perl module or path to Perl interpreter is
/usr/bin/perl, and you are satisfied by the default settings, you
can skip this step.
Open the hitslog.pl file in any text editor and configure the script
for your needs:
- In the first line specify path to Perl interpreter. For example, if
this path is /usr/bin/perl the first line should be
- Set the log file name template by changing the value of $logs
variable. By default, the daily format with .log extension is
used, i.e. the log file for 1 Jan 2002 will be 20020101.log,
for 2 Jan 2002 - 20020102.log, etc.
- Set the log file format in $logformat variable: 0 - the
common log format, 1 - combined, 2 - common with server
name, 3 - combined with server name. The default value is 1.
- If you set the log format with server name, also need to set the default
server name into the $servername variable.
- If you are planning to log also pages and files sizes, set sizes file
name by changing $sizesname variable. The sizes file is plain
text file with pages and files path and their sizes in bytes.
The default name is sizes.txt. If you do not planning to log the
sizes, simply comment this variable or keep as is.
- Set index pages name in variable $indexpage. This variable also
need only for logging the sizes. The default value is
- If you are want to resolve remote hosts addresses to their domain names,
then set the variable $resolve to 1.
- Copy the hitslog.pl file into your cgi-bin directory.
- Embed into every page the script call by inserting such line anywhere
in the every page:
<!--#include virtual="/cgi-bin/hitslog.pl?$SERVER_PROTOCOL" -->
Your pages should have the appropriate extension to handle the SSI
directives. In many cases this is .shtml or .shtm. Ask this
from your hosting provider, if you don't know.
- In every link to downloadable files also insert the script call. For
example, if your link point to file "/files/photo001.jpg", then
change the link to "/cgi-bin/hitslog.pl?/files/photo001.jpg"
- Produce log files in common or combined format, with or without the web server name;
- Fully compatible with any modern log analyzer;
- Fully invisible to visitors;
- Can log the pages and files sizes too;
- Can resolve remote hosts addresses online;
- Very simple to use and fast to execute;
- - possibility to resolve the remote hosts addresses is added.
- - possibility to log the server name is added.
- - incompatibility with the some log analyzers has been fixed.
Yes, currently HitsLog is very simple, but we are planning to develop and
improve it more and more. In the near future, we plan to realize:
- Possibility to log the cookies for better tracking of users.
In more long-term future we plan to add the following features:
- Web interface for configuration, statistics and log management.
- Tools for creating the sizes file.
- any hosting plan with support of CGI, Perl and SSI.
Vote for us!
If you like this script, please vote for it. We do appreciate this much.
All copyrights to HitsLog script are exclusively owned by the author -
This script is Freeware, you may use this product free of charge.
If you have any questions or suggestions about HitsLog script, please
contact by mail to email@example.com.