If you are using shared hosting it is possible that your hoster is simply terminating the process after a set amount of time. This isn’t something either Matomo or you can fix. You will either have to talk to your hoster or find another way to host Matomo.

If neither of those options work for you, you can try the following workarounds:

  • Try importing data through the CLI command instead of through the UI. When you do this, make sure the PHP executable you are using is the CLI php version instead of another (for example, php7-cli vs php7-fcgi). You can see which version it’s using by running php --version. Look for output like PHP 7.2.1 (cli). It’s possible your hoster will allow CLI PHP executions to run for longer.

  • If the process is reliably terminated after a certain amount of time, you can setup a cron job to restart the import. For example, if your import is terminated after 15 minutes, you can setup a cron to run every 20 minutes that will resume the import. To do this, start the import in the UI and make note of the ID of the newly created site. Then add a cron using the googleanalyticsimporter:import-reports command with the --idsite= option (eg: php /path/to/matomo/console googleanalyticsimporter:import-reports --idsite=<your Site ID>).

Previous FAQ: My Google Analytics import never continues