Leading Free & OpenSource Web Analytics – Piwik

When you have a blog, a website, an e-commerce, etc… it’s always valuable to have some insight on your visitors. (How many?, from where?, using which keywords, etc…) and can help you monitor the success of your SEO improvement (do you use SEO Panel?), or your marketing campaign, etc… or simply your effort to provide quality content in timely manner.

Although plugins usually exists on most of blog platforms (WordPress, Dotclear, etc…), you might have better information with dedicated tools, and could apply to many websites, pages, etc…

And this is where Piwik enter!

Piwik the probably the most popular free and opensource Web analytics. But in the past year, they made a lot of changes and improvement. They launched a professional version, redesign their web interface and website and honestly, it looks great!

Piwik is a free software, smartphone friendly, very easy to install that allow you to track and analysis your visitors experience (Number of visitors, geo-localization, referrers analysis, monitoring of downloaded files, page overlay, campaign tracking, and many more). It can also be integrated in several CMS like WordPress, Drupal, Joomla, etc…in very easy way (Plugins, modules, …)

I’m a big fan of this website but the best for you will be to give it a try using their demo!

Now let’s be serious \o/, let’s install it:


As usual, you will need a webserver such as Apache, Nginx, IIS, etc. but also MySQL and PHP. If you don’t have it, you can read my article on LAMP.

1) Download and extract the latest archive in your /var/www

cd /var/www
wget http://builds.piwik.org/piwik.zip
unzip piwik.zip
rm How\ to\ install\ Piwik.html piwik.zip

You should now have a folder called piwik. We just need to change the owner of the folder (if you didn’t use the webserver user) and then follow the 8 steps web installation.

2) Change the owner of the folder /var/www/piwik to your webserver user.

chown -R www-data:www-data /var/www/piwik

3) Now simply go to http://YourIP/piwik

– Make sure you don’t have any missing modules, etc… during the step 2 “System Check”.

– Then you will need to set the database. I strongly recommend you to set up a dedicated database/user/password combo to improve a little bit the safety of your system (If a user is compromised, it will not have access to others databases). If you don’t know how to create a MySQL database/user/login, I recommend you to use PHPMyAdmin, but if you are not a big fan of PHPMyAdmin, there is always Adminer.

– Then create a “Super” user (admin)

– Set up your first website to track

– And add the Tracking code to the footer of your website, or simply use the official plugins for most of popular platforms.

You will find your Auth token into the API link of your Piwik web interface (drop list from your username)

After few minutes, you should start to see the results (If any new visitors, etc…)

But I also recommend you to force SSL connections and for the best, use a more userfriendly subdomain name, like piw.freedif.org

Virtualhost configuration

What you will need:

1) Create a A redirection in your DNS server/registrar with piw.domain.tld to your IP

2) Have SSL certificate ready. If not you can read this tutorial. (Optional)

3) Create your virtualhost as following:

In /etc/apache2/sites-enabled/, create a file called piwik (In root):

nano /etc/apache2/sites-enabled/piwik

and paste the following content:

<VirtualHost *:80>
        ServerAdmin webmaster@domain.tld
        ServerName piw.domain.tld
        Redirect / https://piw.domain.tld

<IfModule mod_ssl.c>
<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/myblog.pem
        SSLCertificateKeyFile /etc/ssl/private/myblog.key

        ServerAdmin webmaster@domain.tld
        ServerName piw.domain.tld

        DocumentRoot /var/www/piwik
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        <Directory /var/www/piwik>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Adapt the content (Servername, webmaster, SSL certificate and directory).

When done, save the file (CTRL+X then Yes) and reload apache: (In root)

/etc/init.d/apache2 reload

You should now be all set and ready to use piwik service in a more secure way!

A lot of information is available on their official user guide pages. Definitely worth reading.


Loves to discover web-based apps to install on his own server@home and write articles about it


Add a comment