我想从Google Analytics(分析)API中提取一些“流量来源”,“地理位置网络”和“受众群体”维度的指标。因此,我创建了以下请求。 GA维度和指标浏览器显示这些指标和维度是兼容的。但是由于某种原因,此请求返回零值:
{
"reportRequests": [
{
"viewId": "xxxxxxxx",
"dateRanges": [
{
"startDate": "2020-03-01",
"endDate": "2020-03-11"
}
],
"metrics": [
{
"expression": "ga:sessions"
},
{
"expression": "ga:newUsers"
},
{
"expression": "ga:transactions"
},
{
"expression": "ga:transactionRevenue"
}
],
"dimensions": [
{
"name": "ga:date"
},
{
"name": "ga:campaign"
},
{
"name": "ga:sourceMedium"
},
{
"name": "ga:country"
},
{
"name": "ga:region"
},
{
"name": "ga:city"
},
{
"name": "ga:userAgeBracket"
},
{
"name": "ga:userGender"
},
{
"name": "ga:interestInMarketCategory"
}
]
}
]
}
尽管受限制的维度集显示数据存在:
"dimensions": [
{
"name": "ga:date"
},
{
"name": "ga:campaign"
},
{
"name": "ga:sourceMedium"
},
{
"name": "ga:country"
},
{
"name": "ga:region"
},
{
"name": "ga:city"
}
为什么第一个示例中显示的扩展尺寸集不返回数据?
谢谢!尤金
[GA可能没有有关用户年龄,性别和有购买意向的细分市场的任何信息(ga:interestInMarketCategory)。因此,当您将这些尺寸与其他尺寸添加在一起时,API会返回指定尺寸组合的数据。
因此,假设有20个会话来自city = x和region = y的组合。但是,当您向其中添加性别时,无法进行任何组合(例如city = x和region = y以及gender =?),因此API将返回零响应。