How to migrate from Google Analytics to Matomo Analytics?

Experimental: this content page is experimental as it just tackle how to migrate Google Analytics data to Matomo and not the full configuration (segments, custom alerts, custom reports...) even if some configuration elements will be automatically imported (goals, custom dimensions), check this twice.


Disclaimer:

  • The data migration process from Google Analytics to Matomo may be subject to change as both technologies are evoloving (Google Analytics database + API) so as Matomo.
  • This technique does not import raw data, just the report data. Which mean that there are a lot of limitations to the data you will get. To compare it with the real world, raw data are apples, sugar, flour, salt, butter. Report data are apple pies. As a result if you would like for example to make an apple pie with only 60 grams of sugar... it won't work. So to say, features such as segments won't work, so as the possibility to access raw data reports so as the visit log.
  • This process takes time as the API of Google currently restrict the number of calls to their API.

Ok, so let's start. Your organization decided to move permanently from Google Analytics to Matomo and you are desperate to see that all your history in Google Analytics is going to disappear. By chance the great guys at Matomo developed a plugin in order to export from the Google Analytics API all the data which are within it and import them within Matomo. Like this if you are forced to delete your Google Analytics account you will still have a record of a part of your data somewhere providing you with data visualization. This is what this plugin is about.

How to make the import?

The data import relies on two things:

  • some credentials (in fact you need to give the hand to a script in order to make the import, and the script needs to have the authorization to make the actions of exporting/importing)
  • a script which is packaged within a plugin to make the process easier, https://plugins.matomo.org/GoogleAnalyticsImporter

It is not that hard to do as far as you follow the documentation here that we are detailing below.

Getting the credentials
  • Go to https://console.developers.google.com/
  • Create a new project.
  • Select your project once created.
  • Click on Librabry and select the Google Analytics Reporting API.
  • Enable the API.
  • Then you need to perform the same action for the Google Analytics API (no idea why there are two APIs here as the GA API is about the configuration and the report data).
  • Then you need to click on Credentials just below the Library button. And create what they call an OAuth Client. They will then ask you to give a name to the product you would like to create, you can keep the name you choose at the beginning, for example "Matomo Import". According to the Matomo documentation you need to mention the domain of your Matomo instance to which you will insert data to. In our case this is localhost.
  • Then choose Web Application as an application type, as a name, insert the name of your web instance, for example localhost, then as authorised JavaScript origins insert your domain name, for example http://localhost, then as authorised redirect URIs insert, your tracker location with the additionnal parameters included in the Matomo documentation  for example for us: http://localhost/matomo/piwik/index.php?module=GoogleAnalyticsImporter&action=processAuthCode

Once done, click on create, congratulations you now have your config file done. So please download it as you need it for the next step.

Installing the plugin

Installing the plugin is really straightforward, all you need is to have a version of Matomo to support it and then to be a super user in order to install it from the back-end of Matomo.

Once installed you will have a dedicated back-end in order to upload the configuration file. Once uploaded you need to click on the Authorize button in Matomo's plugin.

Then you can start your import you will need to indicate:

  • the date at which you would like to start the import.
  • the property ID you would like to import.
  • the view ID.


Last modified: Saturday, 24 August 2019, 6:11 PM