Piwik: Open-Source Analytics Software You Can Install on your WordPress Blog

Introduction

So… you built yourself a stellar website to display your digital humanities project. Is anyone viewing it? How did they get there?  What country are they from? Analytics software let’s you keep track of this type of information.

One of the most popular platforms is Google Analytics which is free, easy to set up, and easy to interpret. A potential concern one may have with this option though is that, as with all Google software, what you do not pay in money you pay in data and privacy. That is to say: by installing this service, you end up sharing all the information you glean about your site traffic and your site users with Google, which can “retain and use” that information. Whether or not that is a concern is a topic of ongoing debate. You can read the Google Analytics privacy statement and read online forums to decide if Google Analytics is suitable for your needs.

The post will outline how to install and use an alternative: Piwik. This free and open source web analytics application– utilized on hundreds of thousands of websites– can help you profile your audience, better understand a user’s journey through your webpage, and more. One advantage it has over competitors is that it lets you retain total control of your data; the data is stored on your own server in your own MySQL database, and is not transmitted to their servers.

Set Up

Piwik boasts a five-minute setup time. It took me a lot longer, but with this handy-dandy demonstration you might be able to do it closer to five. This demo shows you how to install Piwik on a WordPress site, and specifically on a Reclaim Hosting server, but the process should be very similar on other servers.

1) Download the latest version of Piwik for free from their website. You should end up with a .zip file.

Download the latest version of Piwik

2) Head over to your cPanel, scroll down to file manager, and add open the “public_html” directory.

files

Enter cPanel, scroll down to file manager.

open-the-public_html-folder-directory

Open the “public_html” directory

3) Next, we want to create a new folder called “analytics” and fill it with the piwik files we downloaded.

The easiest way to do this, without utilizing an FTP client seems to be renaming the .zip file you downloaded “analytics.” Then, from within the file manager, you can “upload” the zipped file to the public_html folder.

upload1

Once uploaded, you can press the “extract” button on the top header to unzip the folder.

You can now access the contents on this folder by navigating to, for example, http://yourdomain.org/analytics/.

If you go navigate to the “analytics” subdomain of your web page you will find an installation menu. But before we do that, we’re going to have to set up a new MySQL database.

4) Set up a new mySQL database.

Back inside the cPanel view, scroll down to “Databases” and click “MySQL Databases.”

database

From here, you can create a new MySQL database. For example, “dustinmi_piwik.”

Screen Shot 2015-11-10 at 1.16.17 PM

You should then create a new user. Again, I used “dustinmi_piwik.” Create a user name and password.

user

Finally, use the “add user to database” menu to link that new user to that new database.

add

You are now ready to go through the piwik installation!

5) Navigate to your “analytics” subdomain and complete the installation process!

Navigate to, for example, http://yourdomain.org/analytics/, and you should encounter the piwik installation menu.

1-welcome1

The process is pretty quick and easy: Piwik will perform a systems check, then prompt you for the MySQL database information you just created, then ask you to create a login for a “super user”, and finally enter the URL of the website you wish to track.

You can use the Piwik documentation to help you through this section.

When you complete these steps, you will presented with a “Javascript Tag” to embed in your sites code. The easiest way to do this is with a WordPress plugin called “WP-Piwik.” Which brings us to…

6) Embed your Javascript Tag on your site using the “WP-Piwik” plugin.

The plugin can be installed from your wordpress dashboard. Click here for a tutorial if you have not installed plugins on your site before.

Once installed, you must activate the plugin, then head over to the settings page to configure it. Setting up the plugin will require an “Authentication Token.”

Screen Shot 2015-11-10 at 3.25.45 PM

Where does one find this authentication token, you ask? Once again, head to http://yourdomain.org/analytics/. This time, log in with the super user login you created.

Once logged in you, click your username on the top, and then click “API” on the left side bar, and you will find your authentication token.

PiwikAuthToken

Note: Screenshot taken from the piwik blog (http://piwik.org/blog/2015/05/wordpress-integration-wp-piwik-1-0/)

Copy and paste your token into the setting menu for the plugin and you should be good to go!

Now, simply by navigating to http://yourdomain.org/analytics/ and logging in with your super user login info, you will be able to see a very rich analysis of your site traffic!

 

piwik1

An example of the Piwik display. Image taken from: http://wptavern.com/piwik-redesigned-open-source-web-analytics-software-gets-a-fresh-look

From here…

As you continue exploring and configuring Piwik, here are a few things to keep in mind.

  • Piwik has many of its own plugins that you can use to enhance the functionality of your Piwik.
  • You may want to create a “Privacy Policy” page on your website, disclosing what information you collect and how that information is used. I don’t not believe this is required for a non-commercial site, but it could be considered a best practice. You can learn more about drafting a privacy policy here and here.

Dustin

3 Comments

  1. This is awesome! I’ve always wondered who has been viewing my site and where they’re from. I particularly like this because it has everything in one place. In addition, mentioning this as an alternative to Google’s platform was appreciated! I had no idea that’s what happened.

  2. Dustin,

    This is a very well written and organized tutorial and your introduction very clearly explained why you might want to choose this tool over Google Analytics for privacy concerns. (Although I do find it somewhat paradoxical that this tool lets you become the “google” in a way by keeping “your data” on other users on your own server, but you do address this issue in the privacy policy discussion at the bottom.)

    I particularly like how your tutorial is focused on the steps necessary to set up Piwik on a reclaim hosting server, and how you did not try to cover every single step but linked out to other relevant tutorials where needed for topics like installing WordPress plugins. This is a good practice for writing tutorials on the web: don’t duplicate if something is already out there, but add to existing knowledge by providing a different angle, use case, or context.

    Your screenshots were great and your use of formatting made the sections very easy to follow. I got a little concerned that you were sharing too much information about your own setup in the MySQL section (the admin database user is a powerful piece of data), but you didn’t share any passwords or specific tokens, so you’re probably okay. Thanks for sharing!

    • Austin,

      It is true that Piwik lets you collect lots of information about your visitors and thus become the “google” in a sense. However, since that information is stored locally on your server and not transmitted to Piwik, it does not get attached to any other information about what those visitors do on other sites. I think that’s the big difference.

      Google and other analytic services, to my understanding, attempt to track a user as they move between sites that employ their service, to construct a detailed narrative about a person’s interests and activities, which they can use to better target advertising. Privacy advocates worry about nefarious uses of that potentially misleading narrative, such as wrongful persecution by law enforcement or unfair treatment from companies.

      Since the data Piwik collects is not attached to any other data, I can gain insight into how people use my site without contributing to the narrative companies like Google are building about them. Also, Piwik by default does not track users who have the “Do Not Track” setting enabled in their browser.

      Just some thoughts! I still have a lot to learn about this topic.

Leave a Reply to Austin Cancel reply

Your email address will not be published. Required fields are marked *