When it comes to website analytics, Google Analytics is undoubtedly the gold standard. But...it’s by no means the only option when it comes to analytics for your WordPress site. One unique alternative that I’ll feature today is Piwik Analytics.
It’s a neat solution that offers some key differences when compared to Google Analytics. And in this post, I’m going to tell you a bit more about Piwik. Then, I’ll show you the complete process for installing Piwik on your WordPress site.
What is Piwik Analytics?
Piwik is a free and open source analytics software. Think of it like Google Analytics...but open source and hosted on your own server. That is, it helps you track your site’s visitors and activity just like Google Analytics, but keeps you in full control.
Why Would You Use Piwik Analytics Over Google Analytics?
It’s mostly about data ownership and privacy. As detailed as Google Analytics’ functionality is, the fact remains that you’re willingly handing over all of your data to Google. Some people either can’t (for sensitive data) or don’t like that fact.
Because you host Piwik on your own server, you have 100% ownership over your data (barring a security breach, of course).
There are other reasons, like a more user-friendly interface (in my opinion), to consider Piwik. But for most people, ownership, and privacy are the differentiating features.
Should Everyone Use Piwik for Their WordPress Site?
Not really. Though it’s easy to use, it’s still a self-hosted solution. And for most casual WordPress users, that’s an unnecessary hassle.
For that reason, I only really recommend Piwik to power users who are willing to get their hands a little dirty.
Heck, I’m not even actively using Piwik for my casual projects. I have used it in the past (and was happy with it), but nowadays I just stick with Google Analytics for the ease of use because I don’t spend too much time working on my own sites.
All in all…
- If you’re concerned about privacy, use Piwik.
- If you prefer Piwik’s interface (there’s a demo here), use Piwik.
Otherwise, you’re probably fine to continue on with Google Analytics.
Can You Use Piwik Analytics With WordPress?
Yup! Piwik plays nice with WordPress. Unless you’re willing to pay for a cloud-hosted version, you will need to install your own self-hosted version of Piwik. But after that, integrating Piwik with WordPress isn’t any more complicated than installing Google Analytics in WordPress.
For more advanced uses, InnoCraft, the company behind Piwik, even includes some premium extensions that help integrate Piwik with WooCommerce.
How to Install Piwik Analytics on Your WordPress Site
There are two parts to installing Piwik for your WordPress site:
- Set up your own install of self-hosted Piwik on your server
- Add the tracking code from your Piwik install to your WordPress site
I’ll show you how to do both.
How to Install Piwik On Your Server
Like WordPress, Piwik has its own “5-minute install” process (though it might not be quite as famous as WordPress’!). In fact, it’s pretty much identical to WordPress’ install process.
That is, you need to create a database, upload the files to your server, and then Piwik gives you an install wizard that handles the rest.
All that to say, if you can handle installing self-hosted WordPress, you can absolutely handle installing self-hosted Piwik.
To get started, head here and download the latest .zip file of Piwik. Once you have that, you need to extract the files and upload them to your server using your FTP program of choice.
I recommend installing it in a subdirectory like “yoursite.com/piwik” or “yoursite.com/analytics”.
Because you likely already have WordPress installed in your root directory, it’s much cleaner to install Piwik in a subdirectory (and it doesn’t affect Piwik’s functionality at all).
Create a New MySQL Database
Once you upload the files, you’re almost ready to run the install process. But before you do that, you’ll need to head to your host and create a new, empty MySQL database.
If your host uses cPanel, you can do this by going to your cPanel dashboard and clicking on the MySQL Databases option:
From there, you need to:
- Create a database
- Add a new database user
- Add that database user to your database with All Privileges
Make sure to save all of the information for names and passwords because you’ll need it handy when you run the Piwik install process in the next step.
Run the Piwik Install Process
Assuming you have a blank MySQL database and uploaded the files, you’re now ready to run the install process.
You can get started by heading to the subdirectory where you uploaded the Piwik files. For example, if you put it in a “piwik” subfolder, you need to head to “yoursite.com/piwik” to start the install process.
You should see a welcome screen that prompts you to click Next:
Most of the install process is pretty self-explanatory, so I’ll just hit the highlights.
When you get to the Database Setup step, make sure to enter the database details for the empty database that you just created:
You can leave the other options as the default.
Later on, you’ll also need to create a Super User (basically an admin). This is the account that you’ll use to log into your Piwik dashboard.
Then, you can add your WordPress website in Step 7:
How to Add the Piwik Tracking Code to Your WordPress Site
Ok, so you got the tracking code for your site at the end of the installation process. Now what? Well, there are two ways you can add the code to your site:
- Manually paste the code into your site’s header.
- Use the free WP-Piwik plugin. The advantage of this method is that you can also see your Piwik stats inside your WordPress dashboard.
How to Manually Add Piwik Tracking Code to WordPress
As with Google Analytics, an easy way to manually add the tracking code to your site is via the Insert Headers and Footers plugin. While you could just paste the tracking code into your theme’s header, I prefer using Insert Headers and Footers because it works independently of your theme. So even if you change themes down the road, your tracking code will still be intact.
Install and activate the plugin. Then, go to Settings → Insert Headers and Footers and paste in your Piwik tracking code in the Scripts in Header box:
See Piwik Stats Inside Your WordPress Dashboard With WP-Piwik
If you’d like to see your Piwik stats inside your dashboard, the WP-Piwik plugin is another option that both helps you add your Piwik tracking code to WordPress and displays stats inside your dashboard via the Piwik API.
To configure the plugin, you need to go to Settings → WP-Piwik and enter your Piwik install’s URL as well as your Auth token:
You can find the Auth token for your Piwik install by logging into your Piwik account, clicking the gear icon in the top right, and selecting API from the menu on the left:
Once you connect WP-Piwik to your Piwik install’s API, the plugin will add the tracking code and display stats inside your dashboard.
Wrapping Things Up
Using Piwik definitely isn’t for everyone. But if you want full control over your analytics data, it’s one of your best options as far as self-hosted analytics go.
It’s also super easy to get up and running with WordPress. If you can manually install and configure WordPress, you can definitely do the same for Piwik.
And once that’s done, adding Piwik tracking to your WordPress site isn’t any more complicated than Google Analytics.
Now over to you - have you ever tried Piwik? How do you think it stacks up against Google Analytics?