eKstreme.com PHPCounter VII

PHPCounter VII Help File

Table of Contents

Back to the index page.

Introduction

Thank you for downloading PHPCounter 7!

PHPCounter 7 is a real time website counter that can track an unlimited number of pages using a single script. The only requirement for using PHPCounter is that your webserver supports PHP. PHPCounter does not use any database, as all information is stored in text files.

PHPCounter has evolved through previous versions to become a complete real-time logging and analysis tool. It allows a webmaster to view statistics about the tracked pages using different 'plugins'. PHPCounter is written in such a way that you can write your custom plugins to analyse the data as you wish!

PHPCounter comes with a set of 'Core Plugins' that give a thorough analysis in their own right. You can view all hits, the last 10 hits, see which browsers and operating systems your visitors use and more! If you have any suggestions for plugins, please contact me (details below).

PHPCounter has several important features, including:

Obtaining PHPCounter

The lastest version of PHPCounter can always be found at http://ekstreme.com/phplabs/phpcounter.php. Please make sure you are using the latest version as it will contain the latest fixes and features.

Installing PHPCounter 7

Note: If you are upgrading from PHPCounter 5.x or 6.x, please see the notes below.

PHPCounter is very easy to install. The following installation instructions will get PHPCounter installed using the default settings. Please read the Settings section below to learn how to customise PHPCounter.

Your installation is now ready to use!

Using your web browser, browse to the information.php file in the COUNTER directory to get the PHP code you need to start tracking pages. For example, if you installed PHPCounter to http://ekstreme.com/counter/, then browse to PHP code you need to start tracking pages. For example, if you installed PHPCounter to http://ekstreme.com/counter/, then browse to http://ekstreme.com/counter/information.php.

Settings for PHPCounter

The default settings for PHPCounter allow you to quickly start using PHPCounter without having to edit any files. However, you can customise PHPCounter to suit your needs as follows.

All of the customisable settings are stored in the settings.php file. To edit settings.php, use a text editor. You can find my recommendations for text editors on the eKstreme.com Freeware Page.

All of the following code excerpts are for the settings.php file.

HTML Output

By default, PHPCounter outputs the count as HTML. The default code is:

$OutputCountText = TRUE;

If you do not want PHPCounter to output the count as HTML, then change the value to FALSE:

$OutputCountText = FALSE;

Image Output

PHPCounter can output the count as images. The images can be of ANY file format you want, such as .jpg, .gif, or .png. By default, PHPCounter does NOT output the count as images. PHPCounter comes with a (simple) set of images for you to use, but you can make your own as use them! See the Custom Output Images section below for instructions on how to do this.

If you want PHPCounter to output the count as images, you need to specify 3 things:

$OutputCountImage = TRUE;
$ImagesURL = "http://ekstreme.com/counter7/images/";
$OutputCountImageExtension = "jpg";

Firstly, you need to set $OutputCountImage to TRUE. Also, you need to specify the URL where the images are stored. Finally, you need to specify what is the file extension (file format) of the image files. The example above states that the images are found in http://ekstreme.com/counter7/images/ and that they are JPG (.jpg) files.

Invisible Tracking

You can use PHPCounter to log your visitors invisibly, i.e., without any output. To do this, just set $OutputCountText to FALSE and $OutputCountImage to FALSE:

$OutputCountText = FALSE;
$OutputCountImage = FALSE;

Ignoring Multiple Hits

PHPCounter allows you to ignore multiple hits to the same page from the same visitor. These would include page refreshes. To do this, PHPCounter defines a time span during which any new hits to the same page by the same user are ignored.

This time span is set in seconds, and the default is 300 seconds, which is 5 minutes. The code is as follows:

$TrackRecentHits = TRUE;
$TimeDifference = 300;

If you do NOT want PHPCounter to ignore multiple hits, then set $TrackRecentHits to FALSE; the setting for $TimeDifference is then ignored:

$TrackRecentHits = FALSE;

If you want to change the time span during which PHPCounter ignores multiple hits, then change the $TimeDifference. Remember that it is set in seconds. 1 minute is 60 seconds, 5 minutes is 300 seconds, 10 minutes is 600 seconds, 1 hour is 3600 seconds. For example, to ignore multiple hits for 1 hour:

$TimeDifference = 3600;

Automatic Log Rotation

By default, PHPCounter automatically starts fresh log files every week. This time-based automatic log rotation can be customised to occur at defined spans. These time spans (such as the 1 week default) are called Epochs. This means that at the end of each Epoch, PHPCounter starts a new Epoch (called the Dawn of the Epoch) and a fresh (empty) set of log files.

Epochs are defined in seconds. This means that the shortest possible Epoch is 1 second! The default of one week is 604800 seconds.

Epochs are an integral concept of PHPCounter, but some people prefer not automatically rotate log files. To circumvent this, set the Epoch length to be a very large value, such as about 10 years (314496000 seconds).

Epoch lengths are defined with the following code:

$EpochLength = 604800;

Change the value to whatever you want.

You can also trigger a new Epoch manually by uploading a fresh copy of the dawn.txt file that came with PHPCounter.

Custom Output Images

For image output, you can use your own custom set of images with PHPCounter. This will allow you to integrate PHPCounter more into your website.

The images should be named as 0, 1, 2,..., 8, 9 with the appropriate file extension. For example, to use a set of GIF files, the file names should be 0.gif, 1.gif, 2.gif,..., 8.gif, 9.gif. Place these somewhere accessible on your webserver, and specify the URL they are located at as per the instructions above.

Plugins Help

There is a separate help file for the Data Analysis Plugins that come with PHPCounter.

Contact Details

PHPCounter evolved based on valuable user feedback, for which I am very grateful. I always welcome constructive comments, feedback, and suggestions. If you would like to contact me for whatever reason, please use the contact form on eKstreme.com.

Link Back!

I would very much appreciate if you link back to eKstreme.com from your website. I maintain a set of buttons to use at the eKstreme.com Linkback page. However, a simple text link would do! Thank you very much :)

License

Essentially, noncommercial users, including academics, personal websites, charities, etc, get to use PHPCounter for free. All others need to give back something. The instructions above have more details. If you have any questions, please contact me.