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].

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 {{[]}} and then recompiling it. Some common drivers are:
* PostgreSQL: {{[org.postgresql.Driver|]}}
* MySQL: {{[|]}} or {{[com.mysql.jdbc.Driver|]}}
{{databasePath}} has the following format:
databasePath = "jdbc:[driver]://[host]:[port]/[database]";
Now, copy {{[hitcounter.jar]}} 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/}}}.

Before you reload the Wiki (or your servlet container) now, you have to create the SQL table using the file {{[hitcounter.sql]}}: (replace {{{jspwiki}}} with your database name)
* PostgreSQL: {{{psql jspwiki < hitcounter.sql}}}
* MySQL: {{{mysql jspwiki < hitcounter.sql}}}

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&rsquo;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}]

||Option||Default value||Description
|name|[[{$pagename}]|The name of the counter. Each name is associated to a hit count.
|hidden|no|If this option is activated, the counter is only increased and the hit count is not shown.
|increase|yes|If this option is disabled, only the value of the counter will be shown but not increased.
|hits|no|If this option is enabled, every hit will be counted instead of every visitor.