This is a small plugin that allows you to insert a number into a Wiki page that increases with every visitor of the Wiki page (a visitor is figured out by his session id). It saves the data in an SQL database that is accessable via JDBC, such as PostgreSQL or MySQL. Thus you can see it as a database-based alternative to the Hit Count Plugin.

The usage description is also available in German, see HitCounterPlugin Benutzung.
Eine deutsche Benutzungsbeschreibung siehe auf HitCounterPlugin Benutzung.

Installation

By default, the plugin uses Postgres as database, the username is postgres and the password is empty. You can change this by editing databasePath, databaseUsername, databasePassword and databaseDriver in HitCounter.java(info) and then recompiling it. Some common drivers are: databasePath has the following format:
databasePath = "jdbc:[driver]://[host]:[port]/[database]";
Now, copy hitcounter.jar(info) to your WEB-INF/libs/ directory (or your own HitCounter.class to WEB-INF/classes/de/cdauth/jspwiki/). If you want to access the plugin by short syntax, finally add de.cdauth.jspwiki to your jspwiki.plugin.searchPath in the file WEB-INF/jspwiki.properties.

Before you reload the Wiki (or your servlet container) now, you have to create the SQL table using the file hitcounter.sql(info): (replace jspwiki with your database name)

  • PostgreSQL: psql jspwiki < hitcounter.sql
  • MySQL: mysql jspwiki < hitcounter.sql

Usage

The plugin is rather easy to use:
[{de.cdauth.jspwiki.HitCounter name=Counter}]

As name you can define whatever you want, every name will be associated to a several count that is increased. If you don’t pass the name attribute, the name of the page will be used instead. If you have added de.cdauth.jspwiki to your jspwiki.plugin.searchPath, you can use the short form:

[{HitCounter name=Counter}]

Options

OptionDefault valueDescription
name[{$pagename}]The name of the counter. Each name is associated to a hit count.
hiddennoIf this option is activated, the counter is only increased and the hit count is not shown.
increaseyesIf this option is disabled, only the value of the counter will be shown but not increased.
hitsnoIf this option is enabled, every hit will be counted instead of every visitor.

Discussion

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java
HitCounter.java 4.7 kB 3 15-Aug-2006 17:40 Candid Dauth
jar
hitcounter.jar 3.1 kB 3 15-Aug-2006 17:40 Candid Dauth
sql
hitcounter.sql 0.3 kB 2 15-Aug-2006 17:41 Candid Dauth
« This page (revision-8) was last changed on 16-Aug-2006 12:00 by Candid Dauth [RSS]