[英]AdSense data through Google Analytics API
I have successfully implemented Google Analytics API in my Laravel app following the (rather complex) documentation. 遵循(相当复杂)的文档,我已经在Laravel应用中成功实现了Google Analytics(分析)API。 When creating this metrics object, I get the response from server, no problem there:
创建此指标对象时,我从服务器获得响应,那里没有问题:
$sessions = new Google_Service_AnalyticsReporting_Metric();
$sessions->setExpression("ga:sessions");
However, this is the data I need: 但是,这是我需要的数据:
So then I figured I need some other metrics inside to get the data I need and I searched on the official link for anything related to source
, but which ever I used from the list I would get the following response: 因此,我发现我还需要其他一些指标来获取所需的数据,并且我在官方链接上搜索了与
source
相关的任何内容,但是从列表中使用的任何内容,我都会得到以下响应:
"""
{\n
"error": {\n
"code": 400,\n
"message": "Unknown metric(s): ga:source\nFor details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",\n
"errors": [\n
{\n
"message": "Unknown metric(s): ga:source\nFor details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",\n
"domain": "global",\n
"reason": "badRequest"\n
}\n
],\n
"status": "INVALID_ARGUMENT"\n
}\n
}\n
"""
Is there a way for me to fetch the data I need? 有没有办法让我获取所需的数据?
In case anyone wants an answer, I have solved it by using: 如果有人想要答案,我已经通过使用以下方法解决了:
//Create the Dimensions object.
$dimensions = new Google_Service_AnalyticsReporting_Dimension();
$dimensions->setName("ga:source");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.