Moving from Piwik to Matomo on Drupal

Sat, 09/06/2018 - 11:37 -- James Oakley

I'm a big fan of Piwik, an open source analytics suite. Think Google Analytics, StatCounter, Sitemeter, etc. … only self-hosted an open source. There are many benefits of using it:

  • It's self-hosted, so you have all the analytics data you collect.
  • This helps your privacy policy, as it's one less 3rd party company that has data on your website visitors.
  • Because it's open source and free, you don't have to pay to have access to data over 30 days ago, or to use it on an https site, or anything like that. (There are some paid plugins).
  • There's an extensive plugin system that lets you extend what it can do, but you only add the complexity if you need the specific extra features.

Only it's not Piwik anymore. It's Matomo.

On January 9th 2018, they announced they were changing the name:

After an epic 10 year journey creating and perfecting the best open digital analytics solution, we felt it was a good time to refresh our brand to reflect how far we have come and to reaffirm our vision: To create, as a community, the leading international open source digital analytics platform, that gives every user full control of their data.

If I'm honest, I don't understand what that means. I'm unclear how "Piwik" does this less effectively than "Matomo". In fact, having taken 10 years to build brand-awareness, they were beginning to be a recognised name. They've just reset that. Now, when you talk about Matomo, you have to add by way of explanation "which used to be called Piwik".

Their announcement hints there was potential for some trademark conflict over the Piwik name, whereas nobody else currently has anything called "Matomo" so they can protect their brand by getting in first and registering it. Apparently, another factor is that "Matomo" means honesty in Japanese. Unless you're Japanese, (in my opinion) that's a hipster argument not a real reason to rename.

Like it or hate it, the name has changed, and it's here to stay.

The change pushes some work downstream to other people who integrated with Piwik Matomo.

Drupal Module

Happily, for those of us who use Drupal, there is / was a Drupal module named Piwik. It's actively maintained by Drupal member hass, Alexander Hass, who also maintains the Google Analytics module. This is a good thing, because lots of the logic is similar. It means that any security-level fixes that affect both can be fixed together. (See SA-CONTRIB-2016-042 and SA-CONTRIB-2016-043.) It also means that the Piwik module does everything that the Google Analytics module does, in terms of features like controlling which user roles / pages have the tracking code and so on.

Migrating Drupal from Piwik to Matomo

It's one thing to release a new version of the module that changes the name strings from Piwik to Matomo.

But ideally, the Drupal module needs renaming. Renaming a module is not an easy thing to do, but hass has done it brilliantly. You just have to follow the instructions very carefully, and it will all work perfectly.

The instructions below are for Drupal 7, but the process for Drupal 8 is very similar.

In summary, what he did was create a new project named "matomo". There's then a new release to the piwik project that will migrate everything in your site over to the matomo project. So, the steps are as follows:

  1. Download the Matomo project to your site. Either use "drush dl", or download the tarball and extract it into your modules directory.
  2. Download the new version of the Piwik project (7.x-2.12 or 8.x-1.4). Either use "drush dl", or download the tarball and extract it into your modules directory. (You could use "drush up", to do this and the next step in a single move. Personally, I prefer to download as one step, then run database updates as a conscious next step).
  3. Run the database updates. Either use "drush updatedb", or go to /update.php on your site.

This step will do the following: It will enable the matomo module, migrate all your settings and configuration from piwik to matomo, disable piwik, uninstall piwik so that your configuration settings are longer there, and block you from re-installing piwik.

That's pretty impressive. And it works.

There's one last step you need to do manually:

  • Remove the piwik directory from your modules directory, so you don't have old and unused code sitting around.

This is another example of something I wrote about a couple of days ago: It's very important to remove modules that you're no longer using.

Thank you

A big thank you to hass for doing such a complete and easy-to-use job on this.

And a big thank you to the team who maintain and develop Matomo. I still don't quite understand why you had to cause us all this additional work, but I'm sure there's a good reason somewhere. It's a great project, and I commend it to all my readers.

Blog Category: 

Add new comment

Additional Terms