连接到Google AnalyticsAPI

时间:2022-11-16 15:15:26

I am trying to connect to the Google Analytics api. My ultimate goal is to add a goal automatically, but I cannot even HelloAnalytics to work. I have followed the explicit tutorial here.

我正在尝试连接到Google Analytics API。我的最终目标是自动添加目标,但我甚至无法使HelloAnalytics工作。我在这里遵循了明确的教程。

My require once did not work at first because the tutorial links to paths that cannot be found. So I had to make a guess at which files to link to. I tried the following:

我的需求一开始没有工作,因为教程链接到无法找到的路径。所以我不得不猜测要链接到哪些文件。我尝试了以下方法:

require_once '/classes/google-api-php/src/Google/Client.php';
require_once '/classes/google-api-php/src/Google/Service/Analytics.php';

I then get the following error:

然后我得到以下错误:

Fatal error: Class 'Google_Service' not found in C:\xampp\htdocs\google-api-test\classes\google-api-php\src\Google\Service\Analytics.php on line 32

致命错误:第32行的C:\ xampp \ htdocs \ google-api-test \ classes \ google-api-php \ src \ Google \ Service \ Analytics.php中找不到“Google_Service”类

I have a feeling the tutorial needs to be updated to match the library. At the moment I am stuck confused.

我觉得教程需要更新以匹配库。此刻我被困惑了。

1 个解决方案

#1


SOLVED: The author of the post: daimto.com/google-oauth2-php , has replied to a comment. She has updated the post. It now works. I receive data back.

已解决:帖子的作者:daimto.com/google-oauth2-php,已回复评论。她已更新帖子。它现在有效。我收到了数据。

#1


SOLVED: The author of the post: daimto.com/google-oauth2-php , has replied to a comment. She has updated the post. It now works. I receive data back.

已解决:帖子的作者:daimto.com/google-oauth2-php,已回复评论。她已更新帖子。它现在有效。我收到了数据。