Availability
The HitCounter plugin can be downloaded from the blojsom plugins download page
.
Overview
HitCounter Plugin generates two maps of hit counts sorted first by date and then by flavor and the other way around. In addition one can generate an bar chart image of the hit counters (now all flavors are supported). The plugin only lists a certain amount of days on per day basis and all the data afterwards go into a single bucket called 'rest'.
Screenshot

Changelog
v0.1 (24-03-2006): Initial release. Requires Blojsom 2.28 or later (feel free to test it on earlier version it may run).
v0.2 (30-05-2006): Bugfix release including the support for all flavors for the histogram and additional properties for the image setup.
Build
HitCounter Plugin uses Maven 1.x
to build the source.
maven
Installation
The HitCounter plugin are actually two plugins: one for the counting the hits and the other to generate the hit count histogram. In order to display the image you also must install a servlet.
Note: All the setup files (properties, velocity template as well as a patch for the web.xml file) can be found inside the archive. The counter histogram plugin/servlet is optional and so you can disregard any installation instruction for it if you do not plan to use it.
Place the blojsom.counter.plugin-version.jar in your WEB-INF/lib directory.
For the Hit Counter add the following line in your global /WEB-INF/plugin.properties file:
counter-log=com.madplanet.blojsom.counter.CounterLogPlugin
For the Hit Counter Histogram add the following line in your global /WEB-INF/plugin.properties file:
counter-histogram=com.madplanet.blojsom.counter.CounterHistogramPlugin
You may then add "counter-log" as well as the "counter-histogram" to one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file.
Note: that 'counter-log' should be placed somewhere at the end of the chain and that, if used, the 'counter-histogram' plugin is listed aftewards!
html.blojsom-plugin-chain=..., all-entries, ..., counter-log, counter-histogram
Add the HitCounterServlet that will generate the dynamic graph image. This is referenced in /WEB-INF/web.xml.
<servlet>
<servlet-name>CounterLogHistogram</servlet-name>
<servlet-class>com.madplanet.blojsom.counter.CounterHistogramServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CounterLogHistogram</servlet-name>
<url-pattern>/counterloghistogram</url-pattern>
</servlet-mapping>
Place the counter.properties and counter.histrogram.properties file in the respective /WEB-INF/blog-id directory.
On environment without display make sure the following property is set:
-Djava.awt.headless=true
Usage
Copy paste the following snippet to your template or include the template counter_html.vm inside your template which would look like this:
Note you can can select any of the listings or the image separately.
Configuration
You can configure the place of the hit counter file, the supported flavors and the number of days that are managed on a day per day basis:
You can configure the size of the display, the margins and border thickness as well as the colors of the various parts of the histogram:
The color settings are hex colors (RGB). E.g. red is represented as ff0000, green is 00ff00, blue is 0000ff.
The other settings are pixels.
Usage and URL Parameters
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| COUNTER_HISTORY |
Output |
com.madplanet.blojsom.counter.CounterManager |
Manages the hit counter maps as well as provides the necessary iterators |