To import the historical Google Analytics data in your Matomo, you will need to install the Google Analytics Importer plugin from the Marketplace.

TRANSCRIPT: With the Google Analytics Importer plugin, you can import your historical reports from the Google Analytics API into your Matomo account.

So you can take full advantage of the benefits that come with switching to Matomo; like 100% data ownership, no data sampling in your reports, added features, and protection of your user’s privacy; {} without losing all the valuable data and insights you’ve accumulated over the years with Google Analytics.

Let’s get started!
Firstly, the requirements
If you’re using Matomo On-Premise, you’ll need to be using Matomo 3.12.0 or newer to use the Google Analytics Importer. It’s highly recommended that you do that now if you havaen’t already. {}
Now to the setup, which has two steps you must go through
Step one, creating the Google OAuth Client Config; and
Step two, authorising your Matomo to export your Google Analytics data. These two steps only need to be done once.
{Popup displayed on screen} Step one: Creating Google OAuth Client Config
Follow these steps to get your OAuth Client Config:
First, go sign in to the Google API Console

Click Select a project in the menu.

Create a new project by clicking the “Plus” button in the overlay located in the top right:

Give your new Project a name; for example, Matomo Import.

After your project’s been created, select it manually in the project list and click “Open”.

Click on Library in the menu on the left; search for “Google Analytics”.

Then click on the Google Analytics Reporting API row and click “Enable”.

Go back and do the same by clicking “Enable” for the Google Analytics API.

Now you’ll create the OAuth Client Credentials.

Click on the Google logo at the top. Note: 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.

You’ll now be advised to create a product name on the OAuth consent screen. Click on the link called Create consent screen and enter a product name, for example, Matomo Import.

Under “Authorized domains” 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.

Now you’ll create the credentials. Under Application type, click on the Web application radio button. If you cannot see this, click on Create Credentials and choose the OAuth client ID option. Now you need to fill in the following fields, follow the examples shown here:

Name: we recommend to set it to your Matomo URL for example: {}
Authorised JavaScript origins: set it to your Matomo URL domain
Note: This needs to be a domain. If you have installed Matomo into a subdirectory, you need to enter the domain without the path. {example https://my-website.example instead of https://my-website.example/matomo/}
Authorised redirect URIs: needs to be set to your Matomo URL with this special URL query added at the end.
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.
12. Now you can download your OAuth client credentials by clicking the Download icon on the credentials overview page located on the far right of the screen.
You’ve now completed step one.

{Popup displayed on screen} Step two: Authorising Matomo
Once you’ve downloaded your OAuth client credentials, you can authorise your Matomo to have access to your Google Analytics data:
First, login as a Super User in Matomo and go to Administration.

Then click on Google Analytics Import on the left menu.

Upload the OAuth client credentials you downloaded in step one by clicking the Configuration File button; select the Google OAuth Client config file; then click Save.

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

Once you’ve authorised Matomo, you can begin importing data. There are two ways this can be done.
One, The import is usually done through the admin page

Or two, by using the Command Line.
Depending on how much data you’re importing it can take a while to finish, more than an entire day in some cases.
Follow either step to start importing your reports into Matomo.
{Popup displayed on screen} Step two, option one: Using the admin page
To use the admin UI, go to the Google Analytics Import admin page.

Then fill out the Schedule an Import form and click Start:

As the import continues, you will be able to monitor progress through the Import Jobs table below:

You can refresh the page to get an updated status at any time.

Once the import is marked as finished, feel free to delete the status. Or if an import fails, you can view the logs located in the URL displayed here {/path/to/your/matomo/tmp/logs/}. There should be one for each job.
For option two, importing data by using the Command Line, learn how to do this in five easy steps by visiting the Google Analytics Importer doc in the link below.
Now, once the import finishes, you can remove the authorisation you granted earlier. Matomo only needs access to Google Analytics while importing data, afterwards there’s no need to keep it there.
There you have it! You’ve successfully imported your data and made the switch to a privacy-friendly alternative. You’re now in complete control of all your data!
For more information about the Google Importer Tool, visit the Matomo website, and as always, happy analytics!

Previous FAQ: [Video] How to Install Matomo Analytics using Self-Hosted