Install Piwik - A Free Website Traffic Analytics Tool in Ubuntu 14.04

October 24, 2014 | By
| Reply More

Today I will cover the installation of Piwik on Ubuntu 14.04. Piwik is a free and open source web analytics application that runs on a webserver that support PHP and has a MySQL database. It provides detailed analytics about your website visitors that you can store on your own server. Among many things it provides real time data updates, analytics for e-commerce websites, goal conversion tracking, event tracking, site search analytics, geolocation and a lot of other information.

How to Install Piwik

Before starting the installation you will first have to create a MySQL database and username to use for the data, to do so follow this simple steps:

$ mysql -u root -p
mysql> CREATE DATABASE piwik;
mysql> CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'foopass';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON piwik.* TO 'piwik'@'localhost' WITH GRANT OPTION;
mysql> exit

piwik create db

Note: Please change foopass to your own password or a generated one.

You can get the latest version from piwik download page with wget and use unzip to decompress it. (In case you don't have unzip installed on your system you can use the command "apt-get install unzip" to install it):

$ wget http://builds.piwik.org/piwik.zip
$ unzip piwik.zip

And next you can move the folder to a directory accessible by the Apache server, by default /var/www/html:

$ sudo chown www-data:www-data -R piwik
$ sudo mv piwik /var/www/html/

Note : You can set this directory as sub domain so you could access as example "webstat.domain.com" by setting A record in your DNS to the piwik directory.

Configuration

You can now access the installation script by accessing http://IP_OF_YOUR_SERVER/piwik using your web browser like this:

piwik install welcome

Click on the Next button and you will be presented with a system check, read the page and see if there are any problems, if there aren't any wrong permissions or any extra packages that need to be install you can click the Next button again

piwik system check

On the next screen you will have to input the MySQL information for the username and database you created earlier:

piwik database

After it will create the database the application will ask you to create the administrative account that you will use to manage and view website reports:

piwik admin

After this you will be ask to provide information about the first website you wish to monitor, take note that you can add as many websites as you wish after the initial configuration is finished:

piwik first website

Next you will be presented with a tracking code, this code must be included in the files of your website, and you will have to include it on all pages of the website for the tracking to work efficiently:

pwiki track code

This will finish the installation and redirect you the login screen of your piwik installation that will allow you to access the main interface:

piwik

Now you can have full analytics at your disposable without relying on external services. Piwik website also offers an integration page from where you can download plugins that will help you use it on various platforms such as WordPress, Drupal, Joomla and many many more.

Filed Under : OPENSOURCE, UBUNTU HOWTO

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.