GA4 import doesn't work before specific date

Hi everyone,

I’m importing data from GA4 to Matomo for Wordpress.
I’m using the last Matomo and Analytics import plugins.

I imported lots of data from the command line for the same website without issues.

I can import all the data after the 2021-10-04 but not before.
I checked on GA4 if there are data before the 2021-10-04 and there are data from 2021-02-10.

Here the console if I import data of a month after 2021-11-01,2021-11-04 (few days of november):

php ./console googleanalyticsimporter:import-ga4-reports --property=“properties/xxxxxx” --dates=2021-11-01,2021-11-04
Created new site with ID = 1.
Importing the following date ranges in order: 2021-11-01,2021-11-04
Importing reports for date range 2021-11-01 - 2021-11-04 from GA property properties/xxxxxx.
Running archiving for newly imported data…
nohup: ignoring input and redirecting stderr to stdout
Done in Time elapsed: 79.126s. [116 API requests made to GA]

and here the console if I try to import data before the 2021-10-04:

php ./console googleanalyticsimporter:import-ga4-reports --property=“properties/xxxxxx” --dates=2021-10-01,2021-10-04
Created new site with ID = 1.
Importing the following date ranges in order: 2021-10-01,2021-10-04
Importing reports for date range 2021-10-01 - 2021-10-04 from GA property properties/xxxxxx.
Running archiving for newly imported data…
nohup: ignoring input and redirecting stderr to stdout
Done in Time elapsed: 8.432s. [4 API requests made to GA]

If I look in backend in Matomo > administration > system > Google Analytics Import - I can see the import stated as “finished”. If I look at the reports I cannot see data.

I tried lots of other dates combination like 2021-05-01,2021-05-31 or 2021-06-01,2021-06-04 but nothing prior the 2021-10-04 works.
It seems that Matomo Import use an API request for every day requested but doesn’t download any data.

Could you help me to debug this issue?

Thank you.

Is there anyone with an idea?
How can I debug this issue?
Thank you

Hi @madeincima
I don’t know if this can be the source of the problem, but how did you configure the Privacy > Anonymize data > Regularly delete old raw data?

Hi @heurteph-ei,
thank you for the answer.
I’ve checked right now and this option is disabled (so Matomo doesn’t delete old raw data).
I think that this option isn’t the source of the problem :frowning:
Thank you anyway.

Anyone with an idea? I still have the issue and I really don’t know what to try.

Hi @madeincima
Do you know if there is some error in the Google API response?
Eg. Too much data then no data at all for example…

Hi @heurteph-ei ,
I don’t have visible errors.
How can I check what you’ve asked?
Thank you!

Is there no import log file somewhere?
As there is CRON LDAP users synchro log file, Matomo tracking log file, CRON data archiving log file, etc…?

Hi @heurteph-ei,

sorry for the late answer.

In the meanwhile I’ve updated both Matomo and Analytics importer plugins but I still have the same issue.

Here my answer:

  • I don’t have php error;
  • I use the command line so I think that cron doesn’t interfere in this task;
  • I’ve installed LogViewer (https://plugins.matomo.org/LogViewer) but it is empty;
  • debug.log (Wordpress) is empty

Here I post some screenshots maybe someone could spot something useful.

Command line screenshot - it seems all ok:

Backend screehshot - it seems all ok too:

Hi @madeincima
Maybe @innocraft can give some clues about this?

Hi @heurteph-ei ,
it seems no one has other suggestion :slight_smile:

Hi @madeincima,
This is most likely as a result of a bug in the GA4 API that for certain periods returns no data for certain metrics/dimensions through the API even though the data seems to exist when checking the GA4 reports.

This previously resulted in the GA Importer plugin to completely skip these periods as it detected there was no data based on the 0 sessions returned by the GA4 API.

There was an issue I created for this here: https://github.com/matomo-org/plugin-GoogleAnalyticsImporter/issues/367

To somewhat work around this issue, the importer now performs additional checks for data and tries to import whatever other data might exist for those periods. However, since the GA4 API doesn’t return all the data for that period the reports will not be complete.

To be clear: This is not as a result of the GA Importer plugin but is as a result of the GA4 API not returning data where data should exist.

I trust this clarifies things for you.

Hi @rstark ,
I really appreciate your answer.
Thank you for the explanation, now it’s all clear.
I will waiting for the GA4 API to be fixed (if they will do that…:frowning: ) and I won’t struggle any more on this.
Have a nice day.