Practical Joomla!’s RSS Feeds

Resetting Joomla! Article Hits Counters to Zero

When you have been busy setting up a Joomla! site, checking all the pages multiple times, and you want to release the site officially, you will find that you either have to live with all the article hits counters set to the number of times you visited these articles, or you have to reset the hits counter for each article separately using the Article Manager.

My problem was a bit different: I want to clear all hits at the start of the month, so I can see which articles are most popular that month and so I can show the most popular ones on my site. Well… since I have sites with quite a lot of articles on them, I do not want to reset the hit counter for each article individually by hand, of course!

Browsing around a bit gave me the solution to this hits counter reset issue!

Most Joomla! sites will be hosted by a host providing cPanel. If not, you should have it!

The hits counter resides in your MySQL database in table jos_content. Of course, you need to know which database name you are using. You can find that in your Joomla! admin interface:

  • Go to Site | Global Configuration
  • Go to tab Server
  • Under Database Settings, you can see the database name

Now to reset all counters for your Joomla! site:

  • Log on to cPanel, scroll down to Databases and click on the phpMyAdmin icon
  • In phpMyAdmin, go to tab SQL
  • Type in the following command in the box:

use <full database-name>;
update jos_content set hits=0;

  • … where the database name is the name you found in the Global Configuration
  • Click the Start button

Example:

use johnny_jo100;
update jos_content set hits=0;

This will set all article hits counters to zero for that particular Joomla! site!

 

When you have multiple Joomla! sites residing on your host, you can set the hits counters for all sites to zero in one SQL query like this:

use <1st database name>;
update jos_content set hits=0;
use <2nd database name>;
update jos_content set hits=0;
use <3rd database name>;
update jos_content set hits=0;
use <4th database name>;
update jos_content set hits=0;
use <5th database name>;
update jos_content set hits=0;
use <6th database name>;
update jos_content set hits=0;

etcetera…

Save the commands in a text file, so you can use it next time as well.

 

The method is a bit tedious – Joomla! should have something like this built in, in my opinion, preferably with a time and date selection when the reset needs to happen – but at least it does the job!

Bookmark and Share
_____________________________________________________________________________________________

Robin Roelofsen

"I think complexity is mostly sort of crummy stuff that is there because it's too expensive to change the interface."
Jaron Lanier

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">