Hit Count Plugin#

By Matt Whitehall

The Hit Count plugin is a simple plugin which generates hit count statistics for any page in which the plugin is inserted. The plugin updates a page called 'HitCountStatistics' which can be viewed to see hit statistics for all pages on which the plugin is inserted. The plugin also optionally returns the hit count for the page. If 'styleClass' is specified, the count will be returned within a <span> tag with the specified style applied. An alternative to this plugin is the database-based Hit Counter Plugin.


Copy hitcount.jar into your wiki's WEB-INF/lib, or include HitCounter.java in your jspwiki project's source.


[{org.goodjava.plugin.hitcounter.HitCounter updateOnly='true'}]
[{org.goodjava.plugin.hitcounter.HitCounter styleClass='myStyle'}]


  • (optional) when set to true/yes/on (case-insensitive), will cause the plugin to only update the count for the page in 'HitCountStatistics', and will not return any HTML to display
  • (optional) applies a css style to the <span> element surrounding the returned count


  • The 'HitCountStatistics' page can also be edited like any other wiki page, but doing so manually may cause problems with the hitcount, so don't do it unless you absolutely know what you are doing.
  • The hitcount is incremented once for each instance of the plugin-insertion on a given page. For example, if you insert the plugin twice on the same page, the hitcount for that page will be incremented twice each time that page is accessed.

Bugs and problems#

  • I installed the plugin as indicated on V2.8.1 and the counter updates a single hit on all pages. That is I reload Main 10 times, then look at the counter on SandBox and it shows 10 too.


I putted these declarations in the 'HitCountStatistics' page:
[{org.goodjava.plugin.hitcounter.HitCounter updateOnly='true'}]
Now I want to remove the declaration about updateOnly in that page but I don't see way how to do that. Any help? Regards--vlatko

its there the possibility to show the "HitCounter" on the bottom of every page in the Wiki?

Thanks for AnswerMe!

--MartinU, 02-Apr-2007

What's your ultimate goal by putting it at the bottom of every page? You could insert it into one of the WikiPages used to assemble each page (like LeftMenu, LeftMenuFooter, or CopyrightNotice), but the counter would increment on every hit of every page. --Joseph Hobbs 11/6/2008

I have installed the plugin but follow Error Message will come, when I go on the Plugin Site:

<< Plugin insertion failed: Error writing counts to file >>

>> Use this ugly hack: add a directory called null to the root of your (tomcat?) installation. The code needs adaption for the recent code base. --Al

--ErichE, 08. Aug. 2008

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
hitcount-src.jar 2.6 kB 2 16-Jul-2005 18:24
hitcount.jar 3.2 kB 2 16-Jul-2005 18:24
« This page (revision-20) was last changed on 05-Jan-2009 13:19 by