Generating Website Statistics With Piwik, An Open-Source, Google Analytics-Like Web Analytics Tool

Version 1.0
Author: Falko Timme

This guide explains how you can install and use Piwik for generating website analytics. The reports generated by Piwik are similar to the ones generated by Google Analytics. Piwik is an Open-Source (GPL) tool that you can download and host on your own servers which means you are in full control over your data. In addition to that, Piwik's functionality can be extended by plugins.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using the web site here with the document root /var/www/ I'm assuming that the web site is working, and that PHP 5.1 or newer is installed on the server. I'm also assuming that you have an empty MySQL database that you can use for the Piwik installation. I'm using the database c0piwik with the database user c0piwik and the password piwik here (ask your hoster to create an empty MySQL database for you, or create it yourself through your control panel, e.g. ISPConfig).


2 Installing Piwik

Download Piwik to your desktop and unzip it. This will give you a folder latest/piwik/. Upload the piwik/ folder to your document root (e.g. with FTP). In my case where the document root is /var/www/ this will result in a folder /var/www/

Now open a browser and go to to start the Piwik installer. If you see something like this...

... either run the shown commands in the command line (if you have shell access)...

chmod 777 /var/www/clients/client0/web1/web/piwik/tmp
chmod 777 /var/www/clients/client0/web1/web/piwik/tmp/templates_c
chmod 777 /var/www/clients/client0/web1/web/piwik/tmp/cache

(In my installation, /var/www/ is a symlink to /var/www/clients/client0/web1/web/, that's why you see /var/www/clients/client0/web1/web/ instead of /var/www/ here in the screenshot and the command.)

... or change the folder permissions in your FTP client:

(In my installation, the tmp/ folder was empty, so I did not have to change permissions for tmp/templates_c and tmp/cache.)

Then refresh the Piwik page in your browser. You should now see the welcome page of the installer. Click on Next:

On the next page, the installer performs a system check to see if all prerequisites are fulfilled. If there's a problem with the config folder,...

... scroll down, and you should see the command to execute to solve the problem (if you don't have shell access, you can as well fix the permissions with your FTP client):

chmod a+w /var/www/clients/client0/web1/web/piwik/config

After you have fixed the problem, scroll down and click on the Refresh the page link:

The system check should now succeed. Click on Next:

Now we come to the database settings. Fill in the database name of your empty database as well as the database user and the password. You can leave the table prefix (piwik_) as it is. The same goes for the MySQL server (localhost) unless it is located on a remote server:

The installer creates the necessary database tables. Click on Next:

Share this page:

0 Comment(s)