我从Google Analytics API收集的数据与用户界面中的自定义报告之间的收入指标存在差异。
每个值的差异保持相同的速率,其中通过API收集的数据大于自定义报告中的数据。
这是我正在使用的请求的正文:
{
"reportRequests":[
{
"viewId":"xxxxxxxxxx",
"dateRanges": [{"startDate":"2017-07-01","endDate":"2018-12-31"}],
"metrics": [
{"expression": "ga:transactionRevenue","alias": "transactionRevenue","formattingType": "CURRENCY"},
{"expression": "ga:itemRevenue","alias": "itemRevenue","formattingType": "CURRENCY"},
{"expression": "ga:productRevenuePerPurchase","alias": "productRevenuePerPurchase","formattingType": "CURRENCY"}
],
"dimensions": [
{"name": "ga:channelGrouping"},
{"name": "ga:sourceMedium"},
{"name": "ga:dateHour"},
{"name": "ga:transactionId"},
{"name": "ga:keyWord"}
],
"pageSize": "10000"
}]}这是响应的摘录:
{{
"reports": [
{
"columnHeader": {
"dimensions": [
"ga:channelGrouping",
"ga:sourceMedium",
"ga:dateHour",
"ga:transactionId",
"ga:keyWord"
],
"metricHeader": {
"metricHeaderEntries": [
{
"name": "transactionRevenue",
"type": "CURRENCY"
},
{
"name": "itemRevenue",
"type": "CURRENCY"
},
{
"name": "productRevenuePerPurchase",
"type": "CURRENCY"
}
]
}
},
"data": {
"rows": [
{
"dimensions": [
"(Other)",
"bing / (not set)",
"2018052216",
"834042319461-01",
"(not set)"
],
"metrics": [
{
"values": [
"367.675436",
"316.55053699999996",
"316.55053699999996"
]
}
]
},
...因此,如果我在Google Analytics用户界面中创建一个自定义报告,并查找事务ID 834042319461-01,则会得到以下结果:
google Analytics custom report filtered by transaction id 834042319461-01
最后,我在API响应中的收入值为367.675436,但在自定义报告中的值为333.12,这比API的值高出10.37%。我得到了所有值的10.37%的增长。
*为什么我会有这些差异?
为了解决这些问题,您建议做些什么?
谢谢。
发布于 2018-08-16 05:08:29
我敢打赌,您正在体验采样(您在UI中的时间范围是否比API中的时间范围小?):https://support.google.com/analytics/answer/2637192?hl=en
采样适用于以下情况:
结果是:
那样准确
您可以做些什么来减少采样:
UI中,可通过报告顶部的选项来完成此操作;在API中,可使用samplingLevel samplingLevel time range发布于 2018-08-16 05:11:20
因为您正在查看特定的事务ID,所以这可能不是一个抽样问题。
如果这个比例是一致的,从你的问题来看,它似乎是10.37%。我相信这就是您正在使用的货币的情况。
尝试在进行基于货币的呼叫时使用local currency metric API calls。
例如:
用ga:localTransactionRevenue代替ga:transactionRevenue
https://stackoverflow.com/questions/51862821
复制相似问题