Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google analytics Google Analytics API不返回与Analytics dashboard相同的数据_Google Analytics_Google Analytics Api - Fatal编程技术网

Google analytics Google Analytics API不返回与Analytics dashboard相同的数据

Google analytics Google Analytics API不返回与Analytics dashboard相同的数据,google-analytics,google-analytics-api,Google Analytics,Google Analytics Api,我正在尝试编写一个Google Analytics API查询,它只返回去年每个月的唯一访客数 我已经使用AnalyticsAPI浏览器编写了查询,我已经验证了ID和帐户的身份验证是否正确。我使用ga:month维度按月获取数据 这些数字与我在分析仪表板上看到的完全不同 我很困惑。我看不出我在Google Analytics dashboard中指定的内容与我在API查询中输入的内容有什么不同,也看不出为什么我会得到如此大的不同数字 编辑:我推断问题在于开始和结束日期跨越2013年到201

我正在尝试编写一个Google Analytics API查询,它只返回去年每个月的唯一访客数

我已经使用AnalyticsAPI浏览器编写了查询,我已经验证了ID和帐户的身份验证是否正确。我使用ga:month维度按月获取数据

这些数字与我在分析仪表板上看到的完全不同

我很困惑。我看不出我在Google Analytics dashboard中指定的内容与我在API查询中输入的内容有什么不同,也看不出为什么我会得到如此大的不同数字


编辑:我推断问题在于开始和结束日期跨越2013年到2014年。如果我的开始日期和结束日期都是2013年,那么数字是正确的。但如果它跨越2013年到2014年,这些数字是不正确的。我不知道怎么修

我怀疑您与


首先,您尝试将查询范围缩小到12月和1月的两个月。此外,单个查询中的记录数也有限制。我们进行分块以获得相同问题的记录,但没有采样效果:您应该在响应中查看
containssampledata
的值。如果
true
则samplingLevel将有所帮助,否则您将陷入困境…请注意,在v4中,
samplingLevel
值分别更改为
默认值
小值
大值
。这并没有解决我的问题,但以下是参考:
samplingLevel

samplingLevel=DEFAULT 
Optional.Use this parameter to set the sampling level (i.e. the number of visits 
used to calculate the result) for a reporting query. The allowed values are consistent
 with the web interface and include: 
•DEFAULT — Returns response with a sample size that balances speed and accuracy.
•FASTER — Returns a fast response with a smaller sample size.
•HIGHER_PRECISION — Returns a more accurate response using a large sample size, but 
 this may result in the response being slower.

If not supplied, the DEFAULT sampling level will be used.