我正在尝试为以下视图创建API调用
到目前为止,我已经创建了以下API调用,但仅返回访问。
根据文档,我无法为ga:acquisitionTrafficChannel
指定指标,我想在此视图中获取所有指标。
我的API调用是
{
"reportRequests": [
{
"viewId": "xxxx",
"dimensions": [
{
"name": "ga:cohort"
},
{
"name": "ga:acquisitionTrafficChannel"
}
],
"cohortGroup": {
"cohorts": [
{
"dateRange": {
"startDate": "2019-01-01",
"endDate": "2019-05-30"
}
}
]
},
"dimensionFilterClauses": [
{
"filters": [
{
"dimensionName": "ga:acquisitionTrafficChannel",
"expressions": [
"organic|direct"
]
}
]
}
]
}
]
}
输出是这样的
{
"reports": [
{
"columnHeader": {
"dimensions": [
"ga:cohort",
"ga:acquisitionTrafficChannel"
],
"metricHeader": {
"metricHeaderEntries": [
{
"name": "ga:visits",
"type": "INTEGER"
}
]
}
},
"data": {
"rows": [
{
"dimensions": [
"cohort_1",
"Direct"
],
"metrics": [
{
"values": [
"100"
]
}
]
},
{
"dimensions": [
"cohort_1",
"Organic Search"
],
"metrics": [
{
"values": [
"100"
]
}
]
}
],
"totals": [
{
"values": [
"200"
]
}
],
"rowCount": 2,
"minimums": [
{
"values": [
"1"
]
}
],
"maximums": [
{
"values": [
"100"
]
}
],
"isDataGolden": true
}
}
]
}
如何获取所有指标,而不仅仅是访问? 我将每天运行一个脚本来获取这些数据。