Goodbye Google Analytics. Hello Piwik.

This is a clone post from

(Because people on Hackernews “DDOS’ed” the original content :-))


A few days ago I saw this link on Hacker News:
Why to use Twitter, Facebook and Google Plus share links and not buttons

Here’s the important part:

But I am not going to discuss if you should or should not insert sharing buttons in your blog, what I am going to show you here is how to do it with out exposing your visitors to the big groups of the Internet, yes, Facebook, Twitter, Google, those who are now tracking you and sharing the info with governments.

I think is each one responsibility to protect your visitors, and try not to expose them to tracking, and keep their info as save and private as possible. Now, when you use Facebook or Twitter buttons, or the G+ button, you are loading scripts from their sites, and thus giving them the possibility to track your visitors.

And then I felt bad for using those buttons on FreedomSponsors.
If there’s anyone who should be protecting Software Freedom, it’s us.

“Well, that’s a quick fix” – I though – “but what do I do about Google Analytics?”
I was convinced that GA would have to go away. Even if I had to build an alternative from scratch.

Turns out there was no need for such drastic measures.

My good friend Iuri told me about Piwik – an Open Source alternative to GA that meets all the requirements I needed:

  • Must be Open Source
  • Must work the same way as GA (all you need to do is add a javascript file on your pages)
  • The backend must be easily deployable separately from the website being monitored, preferrably in a free cloud host service like Heroku or Appengine.
  • Must have basic reports that display website usage and growth.

Actually, Piwik is much better than what I though I would find.

I’m actually happier with Piwik’s reports than GA’s.
And thanks to Openshift, installation was RIDICULOUSLY easy.

If you have a website, you should care about not exposing your users.
I’ll tell you how to do it. I bet you’ll be able to switch your site from GA to Piwik in, like, half an hour.

1) If you don’t have one, create an account on Openshift.

2) If you don’t have already, install rhc, the Openshift command line tool.

3) Then take a look at this repo on github:
This is pre-configured Piwik just for Openshift.

4) Follow the instructions on the repo readme. Make sure to take note of mysql “Root user” and “Root password”.
If all goes well, you’ll have a Piwik instance up at http://piwik-$
There’s more to do. Too bad the repo readme stops here.

5) Point your browser to your new Piwik instance – http://piwik-$
You’ll see a configuration wizard, go along with it.

6) One of the steps is configuring the database. This is a little tricky.
You’ll need the mysql “Root user” and “Root password” that you took note before, that’s easy.
But you’ll also need the database IP address, which is not so obvious.

7) To get the database IP address, you’ll need to ssh into your piwik instance.

Go to
Click “My apps”, and then “Piwik”
A ssh command will appear (something like “ssh”)
Copy and paste that into a terminal: you’re ssh’ed to your piwik instance
Type “env” to see a list of environment variables
Look for a variable called “OPENSHIFT_MYSQL_DB_HOST” – that’s your mysql IP address
8) In another step, Piwik will give you a snippet of Javascript. Grab it and replace the Google Analytics script on your website with it.

9) Finish the wizard and you’ll see Piwik’s Dashboard. Open your site and see the stats get updated on realtime.

Note 1 – After I did the procedure above, there was a version update warning.
Clicking on it suggested me to update to version 1.12. Piwik self-updated automatically without problems. I just had to click “next”

Note 2 – The main dashboard is a collection of widgets. One of those widgets kept giving an error and breaking the layout of the whole site. Removing that widget from the dashboard (by clicking the X button) solved the problem.
– Piwik looks like a great product with user experience that surpasses expectations.
– Openshift makes things even better.
– You should replace your Google Analytics script with it.

If you like Piwik, consider donating.
They have also been running their own crowdfunding campaigns to further fund its development. Help them out!

(we’d rather see their campaigns on FreedomSponsors, but we’ll forgive them this time 🙂 )