How To Add A Hit Counter

by theezy - 30-01-2015, 08:21 AM
Closed Account
Jan 2015
3 Years of Service
Posted: 30-01-2015, 08:21 AM
In this tutorial I will show you how to add a hit counter to your IPB website. This will fit in with your current style and will appear at the bottom of your board index next to Total Posts, Total Members, Newest Member and Most Online.

Example of how it looks:
[Image: 5h5Bz6k.jpg]

Download the file from the bottom of this post then continue with the tutorial.

Configuring your hit counter
1. Extract the zip file.
2. Open "counter.php" in a text editor.
3. Go to line 36 to find the following configuration options and edit them to your needs:

// Count unique visitors? 1 = YES, 0 = NO
$count_unique = 0;
// Number of hours a visitor is considered as "unique"
$unique_hours = 24;
// Minimum number of digits shown (zero-padding). Set to 0 to disable.
$min_digits = 0;

If you want it to track unique visitors like I did then change $count_unique to 1. You can then also lower the number of hours as visitor is considered as unique below that. Just edit it to your liking.
4. Now save the "counter.php" file and proceed to the next step below.

Installing your hit counter
1. Go to the directory of your IPB install.
2. Create a new folder called "counter". Example: /public_html/counter
3. Upload all counter files and folders to the folder you just created.

Placing your hit counter

1. Login to your ACP and go to Look & Feel > SKINNAME > Board Index > boardIndexTemplate
2. Find:

<li class='clear' data-tooltip="{$stats['info']['most_time']}">
<span class='value'>{$stats['info']['most_online']}</span>

Below that put:

<li class='clear'>
<span class='value'><script language="Javascript" src=""><!--
Unique Visitors

3. Change the URL in the code above to match your website URL.
4. Save.
Note: You can change the text "Unique Visitors" to whatever you want. If you are not using unique hits in the config file then change it to something like "Total Hits"

That's it, you're done! If you need any support with this then please just post below!

Credit for the text counter goes to PHPJunkYard.

The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Log into an existing account.
1 Guest(s)