No Prying Google Eyes: Piwik Web Analytics For WordPress

I call it WordPress Analytics for Paranoids. Just joking. Sort of

There have been times when I wanted to take Google Analytics off of all my sites. The paranoid angle may not be all that wrong:

Blackhat SEOs may be leery of using Google for analytics, but regular site owners should be reassured.
-- Matt Cutts

As we know, black hat is what Google defines as blackhat.

Plus there is just the fact that Google uses your data to perfect their system. Let me put that in less vague terms. You have a new product, it starts getting traffic and Google starts suggesting that keyword to your competitors in Adwords. Anonymous data can still screw you.

I looked for a tool that could replace Google Analytics on my WordPress web sites.


  • no separate accounts: I love having the stats for all of my sites lined up in a row in one place. I'm lazy.
  • unified dashboard: logging into each site to check stats is not an option.
  • runs on my own domain so I can extend and do SQL queries on the database to pull custom data out.
  • works with WordPress single installations and WordPress multisite

Piwik Web Analytics (free)

One WordPress tracking plugin caught my eye, Piwik.

Piwik Analytics is touted as the open source alternative to Google Analytics. It installs separately. The plugin for WordPress accesses your own Piwik installation through it's API.

You can look at all of your sites stats at once. Piwik Analytics has a very nice interface.

Piwik Analytics has enough to do what's needed. Where is my traffic coming from?

It's open source and updates regularly; the Piwik community is very active. Updates run in the browser, just like WordPress does.

Installing & Setting Up Piwik for WordPress

Let's get Piwik running on your site: I'll point you in the right direction for detailed instructions.

Step 1: Get WordPress Multisite Running

First you are going to need at least a VPS, because you are going to have to wildcard your domain. This allows every knew blog you create with WordPress 3 to have a url like rather than If you are on shared hosting you are stuck with the second option.

Once you have WordPress installed in Multi-site mode you can create networks. Which means you can add new domains to the current installation which also can have subdomains.

Details: Create a Network (WordPress Codex)

Step 2: Install Piwik Analytics

If you can install WordPress, you can install Piwik. It's about the same process.

Make sure you have a database created for your Piwik installation.

Pick a folder like stats or piwik and upload the piwik files via FTP. Run the browser based installation script.

Details: Installing Piwik (Piwik docs)

Step 3: Install the Piwik Analytics Plugin

Download the Piwik Analytics WordPress plugin. Upload it.

Alternatively, use the add new plugin feature in your WordPress dashboard.

Details: manual installation of WordPress plugins and WordPress built-in plugin installer (WordPress Codex)

Step 4: Add the site to Piwik Analytics

While setting up Piwik (step 2) you've already added a site to track. You'll need to add every domain or subdomain you want to track to Piwik.

Step 5: Activate and Configure the Piwik Analytics Plugin

Activate the plugin from the WordPress plugin menu and then you are required to configure it.

Enter the URL to your Piwik installation and your API key, which you can find in the API menu in Piwik. Click the activate button.

The page will reload. Now you can select from any site you added to Piwik.

Select the site you want to work with. The plugin will give you the JavaScript code to add to your blog or you can check the checkbox to automatically added the code to wp_footer().

Most of the time, you will only have to check the box. Some themes don't use wp_footer(). You can then either:

  • paste the JavaScript manually into footer of your WordPress theme, just before the </body> tag, or;
  • add <?php wp_footer() ?> just before the </body> tag so Piwik can insert the JavaScript for you.

Step 6: Repeat step 4 and 5 for every WordPress blog you create

Now that everything is set up, you can add each new subdomain you create in WordPress to Piwik, turn on the Piwik plugin and choose your site from the list. Plus you even get a dashboard widget for quick overview.


There are many reasons why a webmaster might not want to use Google Analytics: security, privacy and shall we say SEO trickery (remember, Google defines what is trickery and it always gets redefined).

Piwik is an easy install. It will handle as may sites as you throw at it. And you have complete access to every bit of your data.

Piwik itself can be extended with plugins just like WordPress.

Check out the Piwik demo here.

About the Author: Stephan Miller

Stephan Miller blogs randomly about random things at his SEO blog but tries to keep them related to SEO, website development, affiliate marketing and ecommerce.

Kansas City SEO

Additional Posts

How To Protect Your Website From Malware

What Is A Landing Page And How Is It Used?

How To Plan Your Business Blog

Read previous post:
How To Protect Your Website From Malware

There are multitudes of bots out there, and they're not all as friendly as this guy. Evil Robots Want In...Read...