0
我试图解决过去两天的这个问题。
当我使用Google AnalyticsAPI V4时,我得到的结果比我使用的API V3要少。 我在两个版本中使用完全相同的参数。谷歌分析API v4从API v3返回不同结果
API v4的实施
乌里:https://analyticsreporting.googleapis.com/v4/reports:batchGet?access_token=_ACCESS_TOKEN_
方法:POST
身体:
{
reportRequests: {
viewId: "3829366",
dateRanges: {
startDate: "2017-05-19",
endDate: "2017-05-19"
},
dimensions: [
{
name: "ga:dimension1"
},
{
name: "ga:source"
},
{
name: "ga:medium"
},
{
name: "ga:campaign"
},
{
name: "ga:channelGrouping"
},
{
name: "ga:fullReferrer"
},
{
name: "ga:adMatchedQuery"
},
{
name: "ga:country"
},
{
name: "ga:city"
}
],
metrics: [
{
expression: "ga:sessions"
}
],
filtersExpression: "ga:dimension1=~(598a56704f19aa39c5)|(674456acd5f2a5f1c2)|(9545632042f1223ced)|(24a1e3c96ba81890dc)|(7dd83f2d0321aae0d6)|(a68f93efad7d7574c8)",
samplingLevel: "LARGE"
}
}
从这个电话我只得到1的结果。
API V3实现
乌里:https://www.googleapis.com/analytics/v3/data/ga
方法:GET
查询参数:
?ids=ga:3829366
&start-date=2017-05-19
&end-date=2017-05-19
&metrics=ga:sessions
&dimensions=ga:dimension1,ga:source,ga:medium,ga:campaign,ga:channelGrouping,ga:fullReferrer,ga:adMatchedQuery
&filters=ga:dimension1=~(598a56704f19aa39c5)|(674456acd5f2a5f1c2)|(9545632042f1223ced)|(24a1e3c96ba81890dc)|(7dd83f2d0321aae0d6)|(a68f93efad7d7574c8)
&samplingLevel=higher_precision
&access_token=_ACCESS_TOKEN_
从这个电话,我得到6个结果,正确的结果。
我会很感激任何帮助!
谢谢!
嗨,谢谢你的回答! 我在查询浏览器https://ga-dev-tools.appspot.com/query-explorer/中试了这个,结果来自API v3(https://monosnap.com/file/kX9TVzLPGe9kNIr1dqgRSiCK8CIYPc)。 到目前为止,数据上没有采样(这是来自Query Explorer - http://take.ms/xVJgg)。 –