Matomo can import historical data from Google Analytics using the Google Analytics Importer plugin. This feature is available by default in Matomo Cloud. For Matomo On-Premise, install and activate the Google Analytics Importer from the Marketplace.

You will need to authorise Matomo to access Google’s API using OAuth credentials. This guide explains how to configure that access using the Google Analytics Reporting API. It is intended for Matomo On-Premise users and Matomo Cloud users with high-traffic websites who require a manual setup..

If you use Matomo Cloud and manage a small or medium-traffic website, use the Quick Connect with Google Analytics feature. It requires minimal setup and lets you start importing data quickly.

warning icon
You do not need to submit your application to Google for verification at any point in this process. If Google prompts you to submit the app and you cannot cancel or decline the request, it usually indicates a missed step or added information that triggered Google’s verification workflow. Review this guide carefully.

Create the Google OAuth Client Config

This process involves creating an application that allows Matomo to request authorised access to your Google Analytics data securely. It requires creating a project in Google Cloud Console, and configuring the OAuth consent screen and client credentials.

1. Create a project in Google Cloud Console

  1. Sign in to the Google Cloud Console and open the project selector.
    select project in google cloud console
  2. Click the New Project option.
  3. Provide a project name (for example, Matomo GA Import) and click Create.
  4. A notification will appear. Click Select Project to open the new project.
    notification when new project created

2. Enable the Google Analytics API

  1. Open the main Google Cloud menu and go to ProductsAPIs & Services.
    google cloud api menu
  2. Click Library and search for ‘Google Analytics Data API’.
  3. Select the API and on the product details page, click Enable.
  4. Do the same for the Google Analytics Admin API only if you want to migrate Google Analytics 4 data.
  1. Open the Google Cloud menu and go to ProductsAPIs & Services > OAuth consent screen.
  2. Click Get started to go through the project configuration wizard.
  3. Enter the App Information (name and email) and click Next.
  4. Select the Audience: Internal or External.
    select audience for app
    • Internal apps do not have a 7 day expiry time and you only have to authorise Matomo once. Note that internal apps are only available to users that have purchased Google Workspace to run imports from Google Analytics.
    • External apps can be created by anyone. For most cases, we recommend creating a published, external app to ensure import works seamlessly. If you do not publish it, Google limits authorisation to seven days. After that, the authorisation expires and you must manually re-authorise Matomo every seven days until the import finishes.
  5. Complete the required details and click Create.
  6. The OAuth Overview page opens where you will set up a new client.

4. Create the OAuth client

  1. After creating the app, click Create OAuth client from the OAuth Overview page.
  2. Select Web Application as the Application Type.
  3. Set a name for the application.
  4. Scroll down to Authorized JavaScript origins and click on Add URI.
  5. Provide your Matomo URL domain. This needs to be a domain. If Matomo is installed in a subdirectory, enter the domain without the path, for example https://matomo.my-website.example/.
  6. Scroll down to Authorized redirect URIs and click on Add URI.
  7. Enter your Matomo URL and add the following at the end of the URL /index.php?module=GoogleAnalyticsImporter&action=processAuthCode
    Because the URLs are HTTPS, we highly recommend running your Matomo instance over SSL.
  8. If you are using Matomo for WordPress, the URL must begin with the entire path to Matomo’s admin page, for example https://mysite.com/wp-content/plugins/matomo/app/index.php?module=GoogleAnalyticsImporter&action=processAuthCode
  9. Once you have entered the two URIs, click Create to finish.
  10. A pop-up will show the newly-created credentials. Click on DOWNLOAD JSON to save the file as you will need to upload this to Matomo later.
    google client credentials file

If you change any settings above, for example to fix a typo in one of the values, download the OAuth credentials again and re-upload it in Matomo.

5. Configure the OAuth app

  1. Open the Google Cloud menu and go to ProductsAPIs & Services > OAuth consent screen.
  2. In the left menu, go to Branding to view and update the app information.
  3. Important: Do not upload an App logo here, doing so will require you to submit your app to Google for verification which can take several months to complete.
  4. The Authorized domains must display your Matomo domain, for example, matomo.cloud.
    google cloud app config
  5. Click Save.
  6. In the left menu, go to Audience to manage the app’s publishing status.
  7. When your app is ready to be published, click Publish app.
  8. You can add Gmail users to give them access to test the app while its in Testing status.
  9. In the left menu, go to Data Access to manage restricted scopes.
  10. Save your changes.
  11. If you receive a warning, Google hasn’t verified this app, you can safely continue by clicking on Advanced and then Go to matomo.cloud (unsafe) or Go to yourdomain.com (unsafe).
  12. Your OAuth Client Configuration is now complete.

Authorise Matomo to access GA data

Once you have downloaded your OAuth client credentials, you need to authorise Matomo to access your Google Analytics data.

  1. Log into Matomo as a superuser and go to Administration > System.
  2. Click Google Analytics Import. If you do not see this option, check the GoogleAnalyticsImporter plugin is installed and active.
  3. Select the option, Advanced Google OAuth client configuration.
  4. Upload the OAuth client credentials you downloaded when creating the OAuth client earlier.
  5. Click Authorize and follow the prompts to give Matomo access to your Google Analytics data.
  6. Click Continue to authorise your app if prompted by Google.
  7. When Matomo is authorised, configure the schedule for your import in System > Google Analytics Import.

Matomo will validate the connection and begin importing data from your selected Google Analytics property. Depending on the date range and traffic volume, the initial import may take several hours.

Previous FAQ: Import to Matomo Cloud – Quick Connect (recommended)