Google Analytics API возвращает объект вместо отчета - PullRequest
0 голосов
/ 07 мая 2020

Я следую этому руководству Google: https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-php

аутентификация работает хорошо, но функция printResults выдает ошибку:

Предупреждение: count () : Параметр должен быть массивом или объектом в строке et c ...

Итак, я сделал var_dump для $ response, и API вернул такой объект:

объект (Google_Service_AnalyticsReporting_GetReportsResponse) # 114 (10) {["collection_key": protected] => строка (7) "reports" ["queryCost"] => NULL ["reportsType": protected] => string (40) "Google_Service_AnalyticsReporting_Report" ["reportsDataType": protected] => строка (5) "array" ["resourceQuotasRemainingType": protected] => строка (57) "Google_Service_AnalyticsReporting_ResourceQuotasRemaining" ["resourceQuotasRemainingDataType": protected] => string ": protected] => array (0) {} [" modelData ": protected] => array (0) {} [" Processing ": protected] => array (0) {} [" reports "] => массив (1) {[0] => объект (Google_Service_AnalyticsReporting_Repo rt) # 115 (10) {["columnHeaderType": protected] => string (46) "Google_Service_AnalyticsReporting_ColumnHeader" ["columnHeaderDataType": protected] => string (0) "et c ......

вместо результатов, что я делаю не так? Спасибо.

...