1
我試圖與使用Python代碼下面隊列維度來訪問數據定義的段訪問隊列數據:不能與通過API V4
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'metrics': [
{"expression": "ga:cohortActiveUsers"},
{"expression": "ga:cohortTotalUsers"}
],
"dimensions":
[
{
"name": "ga:segment"
},
{
"name": "ga:cohort"
},
{
"name": "ga:cohortNthDay"
}
],
"segments": [
{
"dynamicSegment":
{
"name": "Sessions from Poznan",
"userSegment":
{
"segmentFilters": [
{
"simpleSegment":
{
"orFiltersForSegment":
{
"segmentFilterClauses": [
{
"dimensionFilter":
{
"dimensionName": "ga:city",
"operator": "EXACT",
"expressions": ["Poznan"]
}
}]
}
}
}]
}
}
}],
"cohortGroup": {
"cohorts": [{
"name": "cohort 1",
"type": "FIRST_VISIT_DATE",
"dateRange": {"startDate": "2016-05-10", "endDate": "2016-05-10"}
}, {
"name": "cohort 2",
"type": "FIRST_VISIT_DATE",
"dateRange": {"startDate": "2016-05-10", "endDate": "2016-05-10"}
}]
}
}]
}
).execute()
當我執行此代碼我收到錯誤Selected dimensions and metrics cannot be queried together
。但是,當segments
節被刪除一切正常。
這種錯誤的原因是什麼?我應該如何正確請求這些數據?