| eKstreme.com PHPCounter VII | ||
Note: If you are upgrading from PHPCounter 5.x, 6.x, 7.0, or 7.1 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.
The PHPCounter 7.x series is not compatible with previous versions. All of the 7.x series versions are compatible with each other and can be used as drop in replacements.
However, as of PHPCounter 7.2, if you upgrade the plugins, you need to upgrade the associated text files. For example, if you upgrade the Search Strings plugin, you need to update the searchstrings.querynames.txt file too. That is because of a change in the plugin algorithm.
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.ini file. To edit settings.ini, 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.ini file.
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
Further, output can be controlled by HTML output plugins. These are PHP files that allow you to customise the output of PHPCounter. The default HTML ouput plugin (in the file called output-text.php) that comes with PHPCounter outputs the following text:
You are visitor number X since Y.
Where X is the number of visitor for that page in the current Epoch and Y is the begining of the Epoch.
You can customise the output by editing the output-text.php file or by writing your own HTML output plugin in PHP.
The setting that controls which output plugin to use is:
OutputCountTextPlugin = "output-text.php"
Output plugins should be in the PHPCounter directory. If not, then you need to specify the full server path to the plugin.
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.
Further, output can be controlled by image output plugins. These are PHP files that allow you to customise the output of PHPCounter. The default image ouput plugin (in the file called output-image.php) defaults to outputing a series of images that represent the count using the above settings.
You can customise the output by editing the output-image.php file or by writing your own image output plugin in PHP.
The setting that controls which output plugin to use is:
OutputCountImagePlugin = "output-image.php"
Output plugins should be in the PHPCounter directory. If not, then you need to specify the full server path to the plugin.
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
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
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 (see below though about keeping the page counts.)
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.
As of version 7.2, PHPCounter allows you to keep the page counts when the log is rotated. If you want PHPCounter to preserve the count when changing Epochs, use the following setting in settings.ini:
KeepCountWhenChangingEpochs = TRUE
If you want PHPCounter to reset the counts at the begining of each Epoch, then set the above setting to FALSE.
By default, PHPCounter saves the hits times' as the server's time. However, PHPCounter can save a time-zone corrected hit time. For example, you can save the hit time in your own time zone.
The time zone correction is defined in hours by:
TimeZoneDifferenceFromServer = 0
If you are East of the server, the time zone correction is positive (larger than zero); for example: 4. If you are West of the server, the time zone correction is negative (less than zero); for example: -4. The default is zero, i.e., the same time zone.
PHPCounter has a powerful system to start the page counts at any count you wish. There are two settings you need to know about.
Firstly, you can set up PHPCounter to start ALL counts at a certain count. THe default is zero (0), but you can change it to any number. To do that, in settings.ini, set the StartCounterAt variable to your base number. The default code is:
StartCounterAt = 0
To make PHPCounter start the count at 1000, change that to:
StartCounterAt = 1000
This makes all new pages start with a count of 1000.
You can also change the start count for a single page as follows: Once you upload the page to your webserver and BEFORE any new hits are registered to the page (i.e., you MUST make sure that you register the very first hit) browse to the webpage, but with this modification. Suppose that the URL to the new webpage is http://ekstreme.com/phplabs/phpcounter.php, browse to:
http://ekstreme.com/phplabs/phpcounter.php?StartCounter=1934
This has the effect of starting the counter at 1934 hits.
These two systems are additive. This means that if StartCounterAt is set to 1000 and you browse to the URL with StartCounter set to 1934, then the page starts with 2934 hits.
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.