The GoogleAnalyticsImporter plugin imports reports from Google Analytics into a Matomo instance.


You will to use the latest Matomo 3.11.0 beta version to use the Google Analytics importer.

Beta testing

We’re starting the beta test of the tool as of July 2019.

-> Please leave your feedback in this Github issue.


Not all data in Google Analytics is accessible through the API, however, so some of your data will not show up in Matomo.

  • The importer only imports aggregated report data, not the raw visit and action data. This means the Visitor Log,
    Ecommerce Log and Segmentation features will not work for imported reports.
  • Some reports in Matomo are not supported in Google Analytics, such as the “Search Keywords with No Results” and Contents reports. These reports will not show data after import.


Before we can start exporting Google Analytics data from their API and importing it into your Matomo, there are two setup steps to go through: 1) Creating Google OAuth Client Config and 2) Authorizing Matomo to export your Google Analytics data. These two steps need to be done only once.

1) Creating Google OAuth Client Config

Follow these steps to get your OAuth Client Config:

  1. Sign in to the Google API Console

  2. Click Select a project in the menu.

  3. To create a new project click the “Plus” button in the overaly:

  4. Give your new Project a useful name (for example Matomo Import).
    New Google Project For Import

  5. After your project has been created, select it manually in the project list and click “open”.
    Select Google Project

  6. Click on Library in the menu on the left, then search for Google Analytics.
    Google Analytics Libraries

  7. Click on the Google Analytics Reporting API row and enable the API.
    Google Analytics Reporting API

  8. Then go back and do the same for the Google Analytics API.

  9. Now you will create the OAuth Client Credentials. Click on the Google logo at the top, to get back to the dashboard, afterwards click on Credentials in the left menu. Then click Create credentials and choose the OAuth client ID option:
    Google API Create Client

  10. You will now be advised to create a product name for the OAuth consent screen. Click on the link Create consent screen and enter a product name (for example Matomo Import). As authorized domain you need to add the top level domain of your Matomo instance (for example for a cloud hosted Matomo) .You can leave the other fields blank. Click Save.
    Importer OAuth Consent Config

  11. Now you will create the credentials. You should be able to click under Application type a radio button called
    Web application. (If you cannot see this, click again on Create Credentials and choose the OAuth client ID option). Now you need to fill in the following fields:

    • Name: we recommend to set it to your Matomo URL for example:
    • Authorized JavaScript origins: set it to your Matomo URL domain for example:
      Note: This needs to be a domain. If you have installed Matomo into a subdirectory, you need to enter the domain without the path. (so
      https://my-website.example in case of https://my-website.example/matomo/)
    • Authorized redirect URIs: needs to be set to your Matomo URL with this special URL/query
      /index.php?module=GoogleAnalyticsImporter&action=processAuthCode added at the end. For example:
      Note: the URLs above are HTTPS: we highly recommend you run your Matomo instance over SSL.
      If your Matomo doesn’t support https yet, you can replace the URL and use http.
      Create OAuth Client ID
  12. You can now download your OAuth client credentials by clicking the download icon on the credentials overview page.
    Google API Download Client Config

2) Authorizing Matomo

Once you have downloaded your OAuth client credentials, you can authorize your Matomo to have access to your Google Analytics data:

  1. Login as a Super User in Matomo and go to Administration.

  2. Click on Google Analytics Import on the left menu.

  3. Upload the OAuth client credentials you downloaded in How to set up Google OAuth Client config by clicking Configuration File, selecting the file, and clicking Save.
    Upload Client Config for Importer

  4. Now, click Authorize and follow the prompts to give Matomo access to your Google Analytics data.
    Authorize the Importer

Running the Google Analytics import

Once you’ve authorized Matomo, you can begin importing data. This is done on the command line and can take a long time depending on how much data you are importing.

  1. First you’ll need some information. In your Google Analytics dashboard, open the property selector.
  2. Take note of the Property ID and the View ID for the property/view you want to import.
  3. ssh into your Matomo instance
  4. Run the following commands to import your site:
    $ cd /path/to/my/matomo
    $ ./console googleanalyticsimporter:import-reports --property=<property-id> --view=<view-id> --dates=<dates>

    For property-id and view-id substitute the GA property ID and view ID you noted above. For dates specify the date range of date you’d like to import, for example, 2015-01-01,2019-04-31.

Then just wait until the import finishes, which could take some time.

Once the import finishes, you can remove the authorization you granted earlier. Matomo only needs access to Google Analytics while importing data, afterwards there’s no point in keeping it there.