Use Piwik for more Reliable Visitor Statistics (avoid referral spam and ad blockers)

Online marketers rely on statistics about their visitors to constantly adapt offers and learn about traffic sources. Google Analytics is the current tool of choice for most of them. Unfortunately GA is suffering from two major issues that won’t go away any time soon:

  1. Ad Blockers: A rising number of users blocks ads with these browser plugins. All of them will prevent GA from loading. On tech-heavy sites this will lose you around 1/3 of visitors. Even iOS supports Ad Blockers.
    Google Analytics blocked by Ad Blocker.
    Google Analytics blocked by Ad Blocker.

     

  2. Referral Spam: Due to the client-side nature of Java Script and thus Google Analytics, it’s easy to fake website visits and just poison your statistics with any data. Spammers know that webmasters are interested in sites referring to them. So they place spam links to lure them to e-commerce or malware sites.

Solution

Piwik allows you to self-host a statistics system very similar to GA with most of the features and none of the issues described above. By default Ad Blockers will block piwik as well, but since it’s under your control, you can simply redirect your endpoints. For Nginx these lines are enough:

Then your tracking code should point to the new endpoints:

When visiting this site with an Ad Blocker, you should still see your stats coming in.

As an added benefit there are no cookies involved. So you don’t need one of these annoying notices.

Ethics

Is it ethical to track people who are using Ad Blockers? Most users use these plugins to avoid downloading ads and thus get a faster browsing experience. Their next-highest concern is probably being tracked across all sites to serve them personalized ads. The data your one site is gathering won’t be correlated with their Facebook and Google profile. So I’d say it’s OK to use this technique. The same data can be obtained from web logs.