dpdkqls6399
2017-09-28 21:52
浏览 113
已采纳

通过Google AnalyticsAPI提供AdSense数据

I have successfully implemented Google Analytics API in my Laravel app following the (rather complex) documentation. 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:

enter image description here

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:

"""
{

  "error": {

    "code": 400,

    "message": "Unknown metric(s): ga:source
For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",

    "errors": [

      {

        "message": "Unknown metric(s): ga:source
For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",

        "domain": "global",

        "reason": "badRequest"

      }

    ],

    "status": "INVALID_ARGUMENT"

  }

}

"""

Is there a way for me to fetch the data I need?

图片转代码服务由CSDN问答提供 功能建议

我已经在(相当复杂的)文档中成功地在我的Laravel应用程序中实现了Google AnalyticsAPI。 创建此度量标准对象时,我从服务器获得响应,没有问题:

  $ sessions = new Google_Service_AnalyticsReporting_Metric(); 
 $ sessions-> setExpression(“ga  :sessions“); 
   
 
 

但是,这是我需要的数据:

然后我想我需要一些其他指标来获取我需要的数据,并在官方 source 相关的任何内容的exchange,doubleclick_for_publishers,doubleclick_for_publishers_backfill,lifetime_value_and_cohorts,channel_grouping,related_products,doubleclick_bid_manager,doubleclick_search“rel =”nofollow noreferrer“> link ,但我从列表中使用了哪些内容 将得到以下响应:

 “”“
 {
 
”“错误”:{
 
“代码”:400,
 
“ 消息“:”未知指标:ga:来源
有关详情,请参阅https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",
nn“错误”:[
  
 {
 
“消息”:“未知指标:ga:来源
有关详细信息,请参阅https://developers.google.com/analytics/devguides/reporting/core/dimsmets。”,
 \  n“domain”:“global”,
 
“reason”:“badRequest”
 
} 
 
],
 
“status”:“INVALID_ARGUMENT”
 
} 
 
 \  n} 
 
“”“
   
 
 

我有办法获取我需要的数据吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题