IP.Board Tutorials
How To Add A Hit Counter
Submitted by theezy, 30-01-2015, 09:21 AM, Thread ID: 858
Thread Closed
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:
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:
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:
Below that put:
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.
Example of how it looks:
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:
Code:
// SETUP YOUR COUNTER
// 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:
Code:
<li class='clear' data-tooltip="{$stats['info']['most_time']}">
<span class='value'>{$stats['info']['most_online']}</span>
{$this->lang->words['online_at_once']}
</li>
Below that put:
Code:
<li class='clear'>
<span class='value'><script language="Javascript" src="http://www.site.com/counter/counter.php?page=boardindex"><!--
//--></script></span>
Unique Visitors
</li>
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.
Code:
https://dl.dropbox.com/u/92751728/text_counter.zip
Users browsing this thread: 1 Guest(s)