在过去的2-3天里,我试图以某种方式下载“页面和屏幕:页面路径和屏幕类”报告,这样我就可以将数据包含在我的管理系统中。
我尝试在PHP中使用Google Analytics API,下面是一个示例
$analytics = new Google_Service_Analytics($client);
$profileId = ''; // But i cant get the profile id because the Analytics account doesnt have them
$yesterday = $startDate = $endDate = date("Y-m-d", time() - 60 * 60 * 24);
$metrics = 'sessions';
$results = $analytics->data_ga->get('ga:' . $profileId, $startDate, $endDate, 'ga:' . $metrics);
print_r($results);但正如代码中提到的,我的Google Analytics帐户没有视图


在这里再次总结一下我需要一种方法来自动下载图片中看到的报告,它可以是任何语言(例如PHP,Python,Java等)
发布于 2021-04-27 13:11:50
您正在使用仅适用于Universal Analytics属性的报告API。在您的案例中,您试图从新的Google Analytics 4属性中获取信息,而不是Universal Analytics。因此,您必须使用Google Analytics Data API:https://developers.google.com/analytics/devguides/reporting/data/v1
https://stackoverflow.com/questions/67277205
复制相似问题