WordPress Traffic Counter Widget
Description: Counts the (unique) visitors / visits of your blog, and shows the traffic information on a widget.
License:
- You may use the code any way you wish under the terms of GNU General Public License
- If you enjoy it, and find it useful please donete 2 Euro here: http://www.pixme.org/wp-content/uploads/widget-traffic-counter/
Plugin Name: Traffic Counter Widget Plugin
URI: http://www.pixme.org/wp-content/uploads/widget-traffic-counter/
Author: Bogdan Nicolaescu
Version: 1
Author URI: http://www.pixme.org/
Since WordPress 2.8
PHP Version: 5.2.9
MySql Version: 5.0.91-community
Installation:
- Download Traffic Counter Widget zip file from here: http://wordpress.org/extend/plugins/traffic-counter-widget/
- Upload it to your plugin directory: i.e. http://www.youtblog.com/wp-content/plugins/
- Unzip it
- Go to Admin Panel -> Plugins
- Activate Traffic Counter Widget
- Go to Admin Panel -> Widgets and add the Traffic Counter Widgets to one of your blog sidebars

Wordpress Traffic Counter Widget
Pe aceeasi tema:






@Crystal
… this is a conflict problem between TCW and AddButtons Plugin… they use the same funcion name for detecting robots… I wasn’t aware of this, so thanks for pointing that out…
In order to have both plugins functional the function name “is_bot()” should be changed in one of them…
To change it in TCW you can do this:
- Go to Admin -> Plugins
- Find Traffic Counter Widget and click Edit
- Search for “is_bot()” and replace it with “wtc_is_bot()”
This should work for you… I will make this change in the next release also…
Hello. I have enjoyed your widget. It is perfect for my needs of displaying traffic.
One question, I have it defaulted to display “Pages” upon page load. And these statistics are correct. However, if I click either “Hits” or “Unique”, which also display the correct stats, and then click BACK on “Pages” the statistics are incorrect. You may see a working example on my website (listed in your admin panel with this message).
If you can help me resolve this issue, I would be happy to make a reasonable donation to your paypal.
Thank you!
Tambien, mi espanol es no bueno, pero gracias por tu ayudo!
@Josh – Let’s put it this way: “OH!!! Sh**ttt!”
This is a “Locale” bug :d. I’ve seen this before, on other blogs, but I didn’t pay attention…
Your blog Locale settings use ‘,’ (comma) to separate groups of 3 digits in numbers. For instance, the number 3000 is shown like: 3,000 and not like 3.000 as in my case. It’s a language matter.
The Ajax call returns the correct data in your case:
Pages,424,1,333,2,782
… but unfortunately I use ‘,’ (comma) to split the data
… dumb
…. I should use some other, uncommon, character like ‘^’, ‘~’ or whatever, in order to mark the per day / per week / per month data…
In your case instead of
424
1,333
2,2782
it shows
424
1
333
… because it splits the numbers by ‘,’ which is also your Locale Nubmer Format Separator :d…
I will fix this in the next release
OK everybody: some bug fixing in the new release: 2.0.2, after updating the plugin please refresh your blog in your browser (or press F5)… the browsers usually cash the scripts and I made some small changes to the js/ajax scripts…
How can a set a margin for the text on the widget? Cuz the text comes in flush on the edge of the box… Check my website to understand what I am talking about lol…
Thank in advance !!
@Alan – it’s again a Theme problem… I did not want to hardcode anything, instead I gave the WordPress Theme all the control over how everything is shown… It seams your theme sets no margins for ULs in widgets …
However, there is a kind of dummy workaround
… you can put a space (or more) before ‘Le dernier 24 heures’ and the other stats…
Like:
‘ Le dernier 24 heures’
…..
If it doesn’t work try:
‘ Le dernier 24 heures'
Great product! For some reason, the on-line now function is not working properly. My site analytics tell me I have 15 people online, but the your counter tells me I have 5.
Please let me know what I need to do. As I said, I love your product!!!!
does this plugin count the visits only on the page the widget is on or does it count the visits to all the pages and posts of a WordPress site.
I would appreciate your answer. Thanks.
@ER – actually it’s very difficult to say how many users are online at some moment in time. You can never know when a user has closed the browser, or switched to an other tab, or just leave the PC with the browser opened… Usually you can suppose some user is online if he or she did some action (like opening an other page) in the past few minutes.
Furthermore, for each user PHP opens a session on the Server which is not closed once the user leaves your site but expires in some preset amount of time (usually 10 minutes) after the user’s last action. In order to have a good estimation of how many users are online at some moment in time you can only count the unique IPs in the past 10 or 15 minutes, or whatever the session expiry time is set to…
I cannot guarantee TCW online users counting is correct, but I can guarantee there’s no software in this world that can give you an exact number!
@Patricia – it only logs the data for the pages it shows on… WordPress doesn’t give me the possibility to log the users data and not show the widget… So in order to have real statistics you should have the sidebar with the widget on, on all the pages / posts / archive / search page etc…
Very interesting. I am going to have to give the plugin a try and see how it goes. thanks for the information.
Hello,
I want to replace the title of the widget by an image. How I can do it ?
thank you
Me parece que es uno de los mejores scripts que he encontrado en la red, y funciona corrcto sobre wordpress, gracias por el aporte.
Saludos.
Salut, si felicitari pentru widget. Te rog frumos daca ma poti ajuta ca sa adaug o linie cu vizitatorii totali nu doar pe ultima luna sa mearga in continuu ca pe acest site http://audit-constructii.ro/
Multumesc anticipat.
@Victor – e ceva mai complicat, pentru ca logurile se sterg dupa o luna ca sa nu-ti umple baza de date cu informatii despre utilizatori… daca ai loga toate vizitele te-ai trezi peste o anumita perioada ca nu mai ai spatiu pe disc… Programatic s-ar putea face, dar cumva fara loguri ci cu un counter…
Hello,
I have installed the plugin before. But, suddenly my staff remove the plugin without my permission. So, I asked her to put it back. The problem is, the counter has been reset. I need to meet some of my potential advertiser by the end of this week.
So, my question is, is there any ways I can get back the previous hits? Or I can just tweak the coding to make it higher?
Thanks.
Hi Putera,
Your story is funny
, but I cannot leave the logs on client’s server when the plugin is uninstalled. The logs occupy some space on your server depending on the traffic you make. So it’s important to free that space when you don’t need the plugin anymore. The logs cannot be restored…
Nevertheless, you can do some hacking in order to make the widget show more traffic than you actually do.
traffic-counter-widget/wp-traffic-counter-widget.php
find:
<ul>
<li><?php echo $options["wp_wtc_WidgetText_LastDay"].”: <span id=’wtc_lds’>”.get_traffic(86400,$wtcuni); ?></span></li>
<li><?php echo $options["wp_wtc_WidgetText_LastWeek"].”: <span id=’wtc_lws’>”.get_traffic(604800,$wtcuni); ?></span></li>
<li><?php echo $options["wp_wtc_WidgetText_LastMonth"].”: <span id=’wtc_lms’>”.get_traffic(2592000,$wtcuni); ?></span></li>
<li><?php echo $options["wp_wtc_WidgetText_Online"].”: “.get_traffic(600, true); ?></li>
</ul>
add
get_traffic(86400,$wtcuni) + 1000 , or whatever number you wanna add to what widget shows…
How come Total Page view counter goes down?
Example: I open website, counter says “Last 24 hours 345 total page views”. I leave window open. I got have coffee, eat, then come back. I refresh web page and counter goes down “Last 24 hours 325 total page views”.
What does this happen?
You can see my counter at http://livehappyandsuccessful.com
Thank you,
Luke
Luke,
Probably you had some intense traffic on your site, the day before, just about the time you went for the coffee next day
. It’s no error… the plugin logs all traffic and then sums up the numbers… You didn’t lose any of that traffic as the logs still count for the last week’s / mounth’s traffic…