The most current version is 1.1, released 2011-08-17.
Piwik is an open source real time web analytics software
that aims to be like Google Analytics and its use is considered appropriate to German
dataprotection laws.
In order to activate Piwik one has to add a small Javascript snippet to all pages that
should be monitored. With tons of static HTML pages this can be quite challenging or
for a test you might not even want to fiddle with the templates of a CMS.
This is the situation where addpiwik will help you. Using the apache webserver module mod_ext_filter one can modify the HTML code on the fly, injecting the Piwik Javascript code snippet right before the closing </body> tag.
Apache configuration:
ExtFilterDefine add-piwik mode=output cmd="/path/to/addpiwik" intype=text/html outtype=text/html \ enableenv=PIWIK_IDSITE
Please note that there are no quotes allowed for the parameters, except for cmd.
Now we have an output filter called add-piwik that is only active for data with a content type of text/html (so it won't be used for eg. images) and the environment variable PIWIK_IDSITE has to be set for the filter to be active.
Activate the filter for a directory:
<Directory /var/www/html/piwiktest/> SetEnv PIWIK_URL "www.example.com/piwik" SetEnv PIWIK_IDSITE "1" SetOutputFilter add-piwik </Directory>
The http:// or https:// part must be omitted in PIWIK_URL, as the Javascript snippet checks for the protocol used and adds the correct prefix itself.
The software is licensed under a BSD style license. See license.txt.
To install the program it should be sufficient to either
$ chmod 755 addpiwik.py or $ cc -o addpiwik addpiwik.c
and then copy it to whatever location you like.
Markus Stumpf <srv-src-extfilter-piwik@maexotic.de>