Say hello to Piwik!

Hey all,

Not to be creepy, but I want to know more about you. I’d like to know how you get to my site, what links you click on, etc… I promise I’m not doing this to keep tabs on you, I’m just trying to make my blog better for you.

The JetPack plugin for WordPress gives me some basic stats, but I need something a little more in-depth. I could use Google Analytics, but you can probably guess how I feel about that. I considered a few options:

Ultimately, I ended up going with Piwik. It’s open source, seems to have the most features, and seems to be the easiest for a newbie to setup. Initially, I thought it would be a super-simple install since BlueHost offers SimpleScripts. However, at the time of this writing, BlueHost (via SimpleScripts) is offering v2.0.3, while Piwik is currently at v.2.4.1. In fact, the Piwik team no longer suggests you install Piwik through SimpleScripts and advises you to install it manually. Turns out, that process is super-simple as well. Check it out below, if you’re interested.

Installing Piwik

Step 1 – Getting started

Make sure you read the installation requirements and the installation instructions before you install Piwik. Then, visit this page to download Piwik to your desktop. You’ll also need a FTP client, I recommend FileZilla.


Step 2 – Backup your current WordPress installation

Remember, you need to backup your database and website files.


Step 3 –  Setup a MySQL database

Piwik will need its own MySQL database, as well as a database user.

First, login to cPanel, scroll down to Database Tools, then click on MySQL Databases.



In the Create New Database box, pick a name for your database, then click Create Database. You should see a message saying the database was created.



In the Add New User box, create a new user for the database and choose a strong password, then click Create User. You should see a message saying the user was created.



In the Add Users to Database boxes, select your newly created user to add to your newly created database. Click Add.



In the Manage User Privileges screen, select the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES.


Click Make Changes and you should see a message saying the user was added to the database.


Step 4 – FTP installation files

Next, you’ll need to unzip the Piwik file you downloaded and FTP the contents to your server. Typically, you’ll want to setup an “analytics” sub-directory under your public www directory (e.g.,



After you’ve FTPed the files, visit the link where you uploaded the installation files (e.g., If everything worked, you should see the Piwik installation screen. Click Next.



Step 5 – System Check

Here, the Piwik installer will do a check to make sure you meet all the installation requirements. Click Next.



Step 6 – Database information

Here, you’ll need to enter information about the Piwik database you created earlier. Click Next.



If you’re using BlueHost, the database and username fields need to be the full names, usually structured as BlueHostUserName_PiwikDBName (e.g., logan_testdb) and BlueHostUserName_PiwikDBUser (e.g., logan_piwik).



Step 7 – Create super user

Next, you’ll create a super user account to login to Piwik the first time. Click Next.



Step 8 – Setup your website

Enter the information about your website. Click Next.



Step 9 – Get your JavaScript tracking tag

Creepier than it sounds. This tag needs to go into the bottom of all of your pages, or preferably, into the footer file of your theme. There is a Piwik plugin you can use to do this, or you can follow below where I’ll be putting it into my footer.php file. Click Next.



Step 10 – Login

That’s it! Click Continue to Piwik and then sign into Piwik with your super user credentials.



Step 11 – Insert tracking tag

This is really as easy as it sounds. First off, make sure you’re using child themes. Then, from your WordPress dashboard, head to Appearance, then Editor, then select Footer.php from the right-hand menu. Scroll down to the bottom and add your Piwik tracking tag right before </body>.

<!-- #sidebar -->

<?php tha_body_bottom(); ?>
<?php wp_footer(); ?>



Click Update at the bottom of the page to save your footer. Now, open a new tab and go to your website. If you check the source code, you should see the tracking tag at the bottom.

Optimizing you Piwik instance

The Piwik team offers multiple guides on how to optimize, secure, and maintain Piwik. Definitely give some of that documentation a read through. Some really useful features are below:


All-in-all, I couldn’t be happier with Piwik. Give it a chance if you haven’t already!


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.