Once you’ve authorized Matomo, you can begin importing data. This is primarily done through the admin page, though you can use the command line as well. Depending on how much data you are importing it can take a long time to finish (more than one day in most cases).

Note: Google imposes a daily limit on the number of API requests you can make each day (at most 50,000). The import will hit this limit after importing about 4 months of data where every day has data. This takes just a couple of hours. This means the import has to be run over several days until the entire data set is imported.

Using the admin page

To use the admin UI:

  1. Go to the Google Analytics Import admin page.
  2. Fill out the Schedule an Import form and click Start:

    Schedule An Import Form

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

    Import Jobs List

    Refresh the page to get an updated status at any time.

  4. Once the import is marked as finished, feel free to delete the status. If an import fails, you can view the logs located in /path/to/your/matomo/tmp/logs/. There should be one for each job.

Using the Command Line

You can also run the import on the command line if you’d like to see more information about it’s progress as it’s going:

  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
    $ php ./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.

If you would like to resume an existing import, supply the --idsite=<idSite> parameter with the site that was created for this import (this will be in the import status table in the admin page).

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.

Importer Options

Importing a Mobile App Property

If your GA property is for a mobile app, then you will need to check the Mobile App checkbox before starting your import:

Import Mobile App

This will ensure that Matomo imports the correct data. The Screen Views metric in Google Analytics will be imported and used as the Pageviews metric in matomo. The Screens reports will be imported into the Page Titles reports in Matomo.

If you don’t check this box and your property is for a mobile app, the importer will ignore this data.

Importing Unsupported GA Dimensions

Some GA dimensions do not exist in Matomo, such as the demographics dimensions. You may want to hold onto this information when importing, and it is possible to do so by importing the data into a custom dimension.

In the import form, fill out the “Extra Custom Dimension Mappings” field with the GA dimensions you’d like to import:

Extra Custom Dimension Mappings

Use this list to find the proper IDs for GA dimensions.

When importing, one custom dimension slot will be used up in the imported site for each extra mapping. (Note: there will be an error if there are not enough custom dimension slots in your Matomo.)

After your import

After you finish importing data into Matomo it is a good idea to back up your Matomo’s database. If the imported report data were to be purged or somehow deleted, you would have to re-import the data from GA. And if your GA property has been deleted, the data will be gone forever.

If you regularly backup your database (or your host does it for you), then you don’t really need to worry about this.

Previous FAQ: Setting up the Google Analytics Import