Open Web Analytics with Piwik

307

These days, Google Analytics is extremely popular for tracking and analyzing Web traffic — but it’s a poor choice for organizations that don’t want to depend on a third party, or share their traffic data with someone else. Fortunately, you have a mature free software alternative that runs great on Linux, called Piwik. Let’s look at what Piwik can do for you.

Piwik may not be an exact replacement for Google Analytics or other proprietary Web analytics applications, but it’s pretty close to par with GA. This is especially true if you’re not tied into Google AdWords or running really complex campaigns in Google Analytics.

Installation and Updates

Piwik is a GPL’ed Web-based app that requires PHP and MySQL. You’ll find the latest release at piwik.org/latest.zip. Grab that on your server using wget or download it to your desktop and then upload it to your server, whatever works for your hosting situation. It’s easy to install, and if you’ve already installed something like Drupal, WordPress, or another CMS, you’ll have no trouble installing Piwik alongside it.

The most recent release Piwik 1.4 came out on April 30th. If you haven’t installed Piwik previously, then now’s a good time to do so. If you have, then good news — you can upgrade Piwik automatically from inside its dashboard. This is, of course, good news for people who might install Piwik starting with 1.4 (or later) as well — it’s simple to manage, and easy to upgrade.

Once you get Piwik installed, you have one last task — you need to integrate a piece of JavaScript into your site so that you can actually track visitors. I’m using Piwik to track traffic on my blog, which is run using WordPress. Luckily, WordPress has a Piwik Analytics plugin that easily integrates the code without requiring you to edit any of the templates. It looks like there’s a Drupal Piwik plugin as well but I haven’t tested that one yet.

There’s a downside to the JavaScript requirement of course, it means that visitors have to have JavaScript turned on — so you will see some discrepancies between the information in an Apache log stats package like Awstats and the results you’ll see from Piwik. However, you’re going to get a lot more detailed information from Piwik than what you get from Awstats or other packages that simply parse the Apache logs.

Piwik Features

Once you’ve installed Piwik, you’ll have a “dashboard” that you can customize to your liking to track the elements that you’re particularly interested in. The dashboard has five tabs — the overall dashboard, a tab for visitors, a tab for actions, another for referrers, and a tab for goals.

The Dashboard can be customized with widgets that show the information you’re most interested in. For example, Piwik has widgets that show real time visitors, keywords that have led people to your site, the number of visits by server time, the search engines that are driving traffic to your site, external sites that have driven traffic to your site, and so on. If you want to know what browser people are using, the length of visits, the countries visitors come from at a glance — all that is available.

On the visitors tab, you can drill down into everything you’d want to know about visitors. Everything about their browser settings and operating systems, screen size, whether they have dual monitors or widescreens or mobile devices, and much more. You can also drill down into location information (most of my visitors come from the U.S., followed closely by the U.K. and Germany) and ISPs.

The Actions tab shows what pages users entered and exited the site from, the links they clicked to leave the site, and the most popular page titles. You’ll also see the most popular downloads, if your site has that.

As you’d expect, the referrers tab shows all you’d want to know about referrers — what search engines and keywords led people to your site, what Web sites led people to your site, and campaigns if you have any set up.

Campaigns are for tracking marketing campaigns. It requires you to set up special links set off by a question mark (like adding “?pk_campaign=SomethingSomething”) that will be tracked by Piwik when people visit your site. You can further add keywords that can be used to track specific links in newsletters, etc. This is a level of detail I haven’t spent much time with for my own site, but it’s something that people love in Google Analytics — so now you can have the campaign fun without the need to share your data with the big G.

Piwik’s Goals tab lets you track “business objectives” on your site. For example, you can create a goal based on when users visit specific pages, click a download, or click outbound links. This is quite useful for businesses — and might also be a good feature for FOSS projects that are interested in stepping up their marketing efforts and want to see whether their documentation is being read or whether people are following the links on the site to specific pages. You can find out all about Piwik goals on the Piwik documentation.

Another nifty feature with Piwik is that all of this information is available in a number of ways. You can generate reports from the widgets or by email. So say you need to show your boss or your colleagues what kind of goals you met or just the overall site traffic and where it came from — the Piwik widgets let you export information in several formats that you can slap into a spreadsheet, presentation, etc. Piwik also has a plugin that will generate and send a report (your choice of HTML or PDF) by email. Here you can specify the stats you want to see in a daily, weekly, or monthly report. Note that you can also download the report manually if you need one right away.

Get Going!

I should also mention that Piwik has an API that you can use to extend the application, and it seems to have a pretty healthy community around it. It’s been making steady progress and looks to me like a reasonable replacement for Google Analytics. It may not quite have all the bells and whistles, but it’s getting there — and it’s certainly good enough for many users today.

It also has a major advantage over Google Analytics — and that’s control of your data and the application itself. With Google Analytics, you’re stuck with the features that Google wants to give you. While GA is pretty full-featured, people can extend Piwik in ways that Google may not extend Google Analytics. Piwik also offers an opt-out feature for users, so you can offer your users an easy way to opt out of tracking as well.

If you have a site that needs tracking, check out Piwik today — it’s easy to set up, and you’ll find a lot of interesting and useful information about how people find your site and what keeps them there.