我正在尝试使用此网址创建报告的报告API: 的 https://analyticsreporting.googleapis.com/v4/reports:batchGet
我的http请求正文如下:
{
"reportRequests":
[
{
"includeEmptyRows":true,
"viewId": "XXXXXXX",
"dateRanges": [{"startDate": "2016-10-01", "endDate": "2016-10-31"}],
"dimensions":[
{"name":"ga:date"},
{"name":"ga:year"},
{"name":"ga:month"},
{"name":"ga:week"},
{"name":"ga:day"},
{"name":"ga:hour"},
{"name":"ga:campaign"}
],
"pageSize":"10000",
"metrics": [
{"expression": "ga:adsenseRevenue"},
{"expression": "ga:adsenseAdUnitsViewed"},
{"expression": "ga:adsenseAdsViewed"},
{"expression": "ga:adsenseAdsClicks"},
{"expression": "ga:adsensePageImpressions"},
{"expression": "ga:adsenseCTR"},
{"expression": "ga:adsenseECPM"},
{"expression": "ga:adsenseExits"},
{"expression": "ga:adsenseViewableImpressionPercent"},
{"expression": "ga:adsenseCoverage"}
]
}
]
}
Metrics列与官方文档中的示例完全相同: https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=adsense
我实际上尝试了不同的维度组合(包括空白维度),并且总是得到400个错误的请求响应,响应是这样的:
{
"error": {
"code": 400,
"message": "Restricted metric(s): ga:adsenseECPM, ga:adsenseAdsClicks, ga:adsenseExits, ga:adsensePageImpressions, ga:adsenseAdsViewed, ga:adsenseCTR, ga:adsenseCoverage, ga:adsenseRevenue, ga:adsenseAdUnitsViewed, ga:adsenseViewableImpressionPercent can only be queried under certain conditions.\nFor details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",
"status": "INVALID_ARGUMENT"
}
}
任何人都知道我做错了什么?或Adsense组合可用吗?
提前致谢。