Where to review data from Google Analytics import for past years of data in Matomo?

I’m attempting to import Google Analytics data into Matomo for the past few years. The timestamps were progressing and now I’m receiving a timeout in the logs, eg:

This:

INFO [2020-03-19 04:23:45] 7445  Archived website id = 2, period = month, 0 segments, 990 visits in months included in: 2017-10-31,2018-02-09, Time elapsed: 3.937s

And this:

  Daily rate limit reached, try again tomorrow. (Note: GA by default sets a daily limit on the number of API requests made each day to 50000. It looks like you've reached this limit. Continue the import tomorrow.)

So this seems somewhat normal, but in Matomo itself I’m not seeing how to retrieve the old data details and am seeing an error:

Any thoughts on:
a) what may be going on here
b) how to get more details about this past data and
c) how to troubleshoot this error?

Hi,

This is indeed normal, it should continue to import more data tomorrow.

Without the exact error message it is hard to guess the error, so please check the php error log

Is this what you’re referring to? I did notice the following in the log after the rate limit and not sure if this exception is just part of the GA limit:

  [Piwik\Plugins\GoogleAnalyticsImporter\Google\DailyRateLimitReached]
  Daily rate limit reached, try again tomorrow. (Note: GA by default sets a daily limit on the number of API requests made each day to 50000. It looks like you've reached this limit. Continue the import tomorrow.)



Exception trace:
 () at /var/www/matomo/plugins/GoogleAnalyticsImporter/Google/GoogleAnalyticsQueryService.php:177
 Piwik\Plugins\GoogleAnalyticsImporter\Google\GoogleAnalyticsQueryService->gaBatchGet() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Google/GoogleAnalyticsQueryService.php:100
 Piwik\Plugins\GoogleAnalyticsImporter\Google\GoogleAnalyticsQueryService->query() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Importers/VisitorInterest/RecordImporter.php:59
 Piwik\Plugins\GoogleAnalyticsImporter\Importers\VisitorInterest\RecordImporter->queryVisitsByDuration() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Importers/VisitorInterest/RecordImporter.php:34
 Piwik\Plugins\GoogleAnalyticsImporter\Importers\VisitorInterest\RecordImporter->importRecords() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Importer.php:386
 Piwik\Plugins\GoogleAnalyticsImporter\Importer->importDay() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Importer.php:347
 Piwik\Plugins\GoogleAnalyticsImporter\Importer->import() at /var/www/matomo/plugins/GoogleAnalyticsImporter/Commands/ImportReports.php:213
 Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportReports->execute() at /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at n/a:n/a
 call_user_func() at /var/www/matomo/core/Console.php:140
 Piwik\Console->Piwik\{closure}() at /var/www/matomo/core/Access.php:644
 Piwik\Access::doAsSuperUser() at /var/www/matomo/core/Console.php:141
 Piwik\Console->doRunImpl() at /var/www/matomo/core/Console.php:93
 Piwik\Console->doRun() at /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/matomo/console:32


googleanalyticsimporter:import-reports [--property="..."] [--account="..."] [--view="..."] [--dates="..."] [--idsite="..."] [--cvar-count="..."] [--skip-archiving] [--mobile-app] [--timezone="..."] [--extra-custom-dimension="..."]


^[[A^[[B^C
root@localhost:/var/www/matomo/tmp/logs# tail -f gaimportlog.2.matomo.domainnn.tld.log
 Piwik\Console->Piwik\{closure}() at /var/www/matomo/core/Access.php:644
 Piwik\Access::doAsSuperUser() at /var/www/matomo/core/Console.php:141
 Piwik\Console->doRunImpl() at /var/www/matomo/core/Console.php:93
 Piwik\Console->doRun() at /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/matomo/console:32


googleanalyticsimporter:import-reports [--property="..."] [--account="..."] [--view="..."] [--dates="..."] [--idsite="..."] [--cvar-count="..."] [--skip-archiving] [--mobile-app] [--timezone="..."] [--extra-custom-dimension="..."]

This is just your gaimportlog, right?

I meant the path where PHP errors and exceptions are logged (e.g. /var/log/apache2/error.log or your nginx log)

Yes, I’m sorry, that was /var/www/matomo/tmp/logs/gaimportlog.2.matomo.domain.tld.com.log.

/var/log/nginx/error.log has this:

2020/03/19 13:30:57 [error] 6369#6369: *543 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /var/www/matomo/libs/Zend/Db/Statement/Pdo.php on line 228
PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /var/www/matomo/core/Updater/Migration/Db.php on line 1" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: matomo.domain.tld, request: "GET /index.php?forceView=1&viewDataTable=graphEvolution&module=VisitsSummary&action=getEvolutionGraph&idSite=2&period=range&date=2017-01-01,2020-03-19&segment=&showtitle=1&random=4706 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "matomo.domain.tld", referrer: "https://matomo.domain.tld/index.php?module=CoreHome&action=index&idSite=2&period=day&date=today&updated=1"
2020/03/19 13:30:57 [error] 6369#6369: *543 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in /var/www/matomo/plugins/GoogleAnalyticsImporter/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php on line 39" while reading upstream, client: xxx.xxx.xxx.xxx, server: matomo.domain.tld, request: "GET /index.php?forceView=1&viewDataTable=graphEvolution&module=VisitsSummary&action=getEvolutionGraph&idSite=2&period=range&date=2017-01-01,2020-03-19&segment=&showtitle=1&random=4706 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "matomo.domain.tld", referrer: "https://matomo.domain.tld/index.php?module=CoreHome&action=index&idSite=2&period=day&date=today&updated=1"

Seems like something is running out of memory. Would it be possible to (temporarily) increase the PHP memory limit?

I just tried that:

$ nano /etc/php/7.2/fpm/php.ini

And set memory_limit = 512M, but still got an error:

2020/03/19 13:37:55 [error] 6369#6369: *560 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /var/www/matomo/libs/Zend/Db/Statement/Pdo.php on line 228
PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 73728 bytes) in /var/www/matomo/vendor/composer/ClassLoader.php on line 444" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: matomo.domain.tld, request: "GET /index.php?forceView=1&viewDataTable=graphEvolution&module=VisitsSummary&action=getEvolutionGraph&idSite=2&period=range&date=2017-01-01,2020-03-19&segment=&showtitle=1&random=3563 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "matomo.domain.tld", referrer: "https://matomo.domain.tld/index.php?module=CoreHome&action=index&idSite=2&period=day&date=today&updated=1"

I also checked /etc/php/7.2/cli/php.ini for sanity and it’s set to -1 so…

Just to double-check: You did restart PHP-FPM afterwards?

Thank you so much - you were right, I had forgotten that fpm requires restarts to reinitialize php.ini vars, after doing /etc/init.d/php7.2-fpm restart with the memory increase to 512M the graph is rendering…

No more errors in the log now, so I suppose we’re just stuck waiting for the Google Analytics API limit issue. Is there a way to pull specific data for the past that has been imported thus far?

I’m guessing I’m not familiar enough with Matomo yet to drill into those old dates.

1 Like

In theory I think you can already see the data that has been imported by selecting the date range in the date picker.

But you can wait until everything is imported.

Some data is there obviously:

But I guess I don’t know what side-tab to use now in order to get the actual details for visits from that timeframe…

Are we simply not able to get detailed data from GA at all?:

Hi,

There is no way to get the raw visit data (as seen in the visits log) from Google, so all the plugin can do is fetching reports.

(without paying for GA 360)

Hmm, thank you… is there a way to find out what data I’m actually getting? A way to see the most detailed info possible that’s coming in without GA 360? I’d like to see if what we are getting is “enough” or if we need to go further.

And are you saying that 360 would unlock the ability of Matomo to pull in the details, and if so, how much details?

The best way is to probably look through all reports in Matomo.

No, I have just heard that it is possible to get the raw data, but then someone would need to write a plugin that imports this data (which might be easy or complicated). See here:

I thought I was allowing GA Importer to run over the last few days here, however when I check the log at /var/www/matomo/tmp/logs/gaimportlog.2.matomo.domain.tld.log it still shows the last time the importer ran was on 2020-03-19 with the last error about reaching the API limit.

How do I trigger this to keep on going or resume?

How do I trigger this to keep on going or resume?

It should automatically resume each day, if not that’s certainly unexpected. There should be a button in the status table in the admin page that lets you resume manually if you are using the latest version: