Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics Importer depreciated code #351

Closed
zigojacko opened this issue Feb 13, 2023 · 14 comments · Fixed by #350
Closed

Google Analytics Importer depreciated code #351

zigojacko opened this issue Feb 13, 2023 · 14 comments · Fixed by #350
Labels
Bug Something isn't working

Comments

@zigojacko
Copy link

zigojacko commented Feb 13, 2023

Running PHP 8. Matomo version 4.13.3.

WARNING GoogleAnalyticsImporter[2023-02-13 14:19:56 UTC] [04666] /../core/Date.php(138): Deprecated - urldecode(): Passing null to parameter matomo-org/matomo#1 ($string) of type string is deprecated - Matomo 4.13.3 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),#1/core/Date.php(138),#2/plugins/GoogleAnalyticsImporter/GoogleAnalyticsImporter.php(462),#3/plugins/GoogleAnalyticsImporter/Controller.php(614),[internal function]: Piwik\Plugins\GoogleAnalyticsImporter\Controller->pendingImports(),#5/core/FrontController.php(637),#6/core/FrontController.php(169),#7/core/dispatch.php(32),#8/index.php(25)

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/warnings-google-analytics-import-plug/48522/3

@sgiehl
Copy link
Member

sgiehl commented Feb 13, 2023

@AltamashShaikh Could you have a quick look at this one? Not sure if it's a problem of the plugin or if core needs to handle something differently here...

@AltamashShaikh
Copy link
Contributor

@zigojacko What was the URL where you were getting this error ?

@AltamashShaikh
Copy link
Contributor

@zigojacko Thanks for reporting the issue
@sgiehl This code could be the cause, import_range_start and import_range_end is null initially.
I will prepare a fix for it, but was wondering should we handle it in core?

Like adding this line here

$dateString = $dateString ?? '';

@sgiehl
Copy link
Member

sgiehl commented Feb 14, 2023

@AltamashShaikh I'll also prepare a change for core. But the plugin needs to be adjusted as well, as after the changes in core it will still throw an exception if null is provided

@zigojacko
Copy link
Author

@zigojacko What was the URL where you were getting this error ?

Sorry, I am unsure @AltamashShaikh as I just saw the error in the log however, every hour when the cron job runs, we are getting another error printed to the log:

WARNING [2023-02-14 12:05:10] 27086  /../plugins/GoogleAnalyticsImporter/Commands/GenerateGaTestData.php(443): Deprecated - Using ${var} in strings is deprecated, use {$var} instead - Matomo 4.13.3 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
The import will be restarted automatically at 2023-02-15 12:00 am
The import will be restarted automatically at 2023-02-15 12:00 am
Error: error or warning logs detected, exit 1

We just seem to be getting loads of problems running this on PHP8.

@sgiehl
Copy link
Member

sgiehl commented Feb 14, 2023

@AltamashShaikh I'll move this issue to the plugin, as it's more an issue with the plugin than with core.

@sgiehl sgiehl transferred this issue from matomo-org/matomo Feb 14, 2023
@nicksherman
Copy link

I mentioned it already in the forum, but if it's helpful to know, I'm also experiencing this issue with the following setup:

  • Matomo 4.13.3
  • GoogleAnalyticsImporter v4.4.8 (as installed via the Plugin Marketplace)
  • MySQL version 8.0.28-0ubuntu0.20.04.3
  • PHP 8.1 FastCGI

I'm glad to see there a solution seems to be coming soon. In the mean time, though, should I put off the process of trying to import my analytics? It seems the Importer still manages to capture some data (though often stops with other error messages), and I'm not sure if the data it's creating will be incomplete or otherwise defective.

Thanks!

@AltamashShaikh
Copy link
Contributor

@nicksherman a new version with fix should be released next week.
Btw import should continue with a warning, what error are you seeing?

@nicksherman
Copy link

@AltamashShaikh Good to know, thanks!

I'm not sure if the other errors I'm getting are related to this or not, but there are a few that keep popping up in the "Status" reports of my Import Jobs …

The first one is an error reaching GA, which may actually be an issue on Google's end(?):

Error message: Error on day 2022-05-20, Failed to reach GA after 2 attempt(s). The import will automatically restart later and you don't need to do anything. Last GA error message: The service is currently unavailable.

The second one about error reports may be triggered by that:

Error message: Error on day 2022-06-16, Failed to reach GA after 2 attempt(s). The import will automatically restart later and you don't need to do anything. Last GA error message: Quota Error: The number of recent reporting API requests failing by server error is too high. You are temporarily blocked from the reporting API for at least an hour. Please send fewer server errors in the future to avoid being blocked. See developer documentation for details at https://developers.google.com/analytics/devguides/reporting/core/v4/limits-quotas#reporting_apis_request_errors

I've also seen another error about authentication even though it's been nowhere near the expected 7-day re-authentication limit:

"error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential

If I re-authenticate anyway and resume the process it seems to get the import running again, but only for a limited time before it hits another error.

Happy to share further info in a separate thread if it's helpful. I'd definitely appreciate any insight!

@AltamashShaikh
Copy link
Contributor

@nicksherman You can now publish your app and don’t need to reauthorize every 7 days
Follow this guide and reauthorize you should be good to go.

also error looks like you are being rate limited

@nicksherman
Copy link

@AltamashShaikh This was actually the guide I followed to set things up in the first place, which is why I'm a bit confused about the authentication error messages. It is strange because there definitely is some data being imported, but something along the line is tripping it up.

@nicksherman
Copy link

@AltamashShaikh It seems this is an ongoing issue, as other people are reporting the same situation in the forum:
https://forum.matomo.org/t/analytics-import-error/41568/19

@nicksherman
Copy link

Just confirming that the latest update to version 4.5 of the plugin has fixed this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
5 participants