Piwik

Piwik Logo

Piwik http://www.piwik.org is an open source web analytics application, similar to Google Analytics, but more customisable and wholly controlled by you.
A single Piwik installation can monitor an "unlimited" number of web sites and will display both graphical or tabular information on such elements as

  • Number of hits
  • Referrals from search engines
  • Those keywords entered into the search engine to be referred to your site
  • Hits by server time
  • Browser used
  • Web sites linking directly to your site

Piwik


Installation

Piwik requires PHP version 5.1.3 or later, and a MySQL database to store configuration information in. Detailed installation instructions can be found on the Piwik web site. In this example I used the free CentOS (http://www.centos.org) Linux distributon, version 5.2

Install a base installation of CentOS including the Web Server and MySQL database server roles.
Start both the httpd and mysqld services and set both to start automatically using the chkconfig command.
Create a MySQL database for Piwik to use. You may want to download and install webmin (http://www.webmin.com) in order to do this easily.

Download the latest version of Piwik from the web site. The package will come down as a ZIP file, extract the contents to the /var/www/html/ directory on the server. If you select a sub-directory, make it writable with a chmod 777 command.

Now browse to the server from a web browser and follow the on-screen instructions. You will be prompted to enter the details of the MySQL database to use, as well as the details of the administrator account.
Once installed, you will be prompted to enter the URL of the first web site you want Piwik to monitor.
Piwik will then automatically generate some HTML code that you will need to paste into the source code of your web site. NOTE - if the code generated contains the internal IP address or name details of your Piwik server, and the web server to be monitored is not on the same network as the Piwik server, you may need to edit the server URLs. As best practice you should use the external DNS name of the Piwik server and configure internal and external DNS appropriately. Ensure that HTTP port 80 is allowed through to the Piwik server on any firewalls.
To return to the Piwik server at a later stage browse to its address and enter the details of the administrator account you specified during the installation.


Integrating Piwik with Drupal

An optional Piwik module for Drupal is available that removes the need to edit the underlying source code of your web site. The module can be downloaded from the Drupal web site: http://drupal.org/project/piwik

Once installed and enabled, the module can be configured within the administration pages:

Piwik

You will be prompted to enter the number of the site as it is configured on the Piwik server (1 by default if only one has been configured), the address of the Piwik server as well as a username and "Token" to access the Piwik server.
The username and token are configured on the Piwik server. Log into the administration page of the Piwik server and browse to Users. Create a new user account. Enter a username and assign it 'View' permissions on the target web site. A token will be generated automatically:

Piwik

Your Drupal site is now being monitored.

Addendum

Clients for Piwik are also available for both the iPhone - http://blog.brightpointuk.co.uk/piwik-web-analytics-iphone

and Android - http://blog.brightpointuk.co.uk/piwik-web-analytics-client-android