【问题标题】:Google Analytics API not returning same data as Analytics dashboardGoogle Analytics API 未返回与 Analytics 仪表板相同的数据
【发布时间】:2014-03-25 15:42:21
【问题描述】:

我正在尝试编写一个 Google Analytics API 查询,该查询仅返回去年每个月的每月唯一身份访问者。

This is the data I see in the Google Analytics dashboard.

我已使用 Analytics API 资源管理器编写查询,我已验证 ID 并且帐户已正确验证。我正在使用 ga:month 维度逐月获取数据。

This is the query, and the resultant data

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

This is a graph of that data.

我很困惑。我看不出我在 Google Analytics(分析)仪表板中指定的内容与我在 API 查询中输入的内容之间有什么不同,或者为什么我应该得到如此不同的数字。

编辑:我推断问题出在开始日期和结束日期跨越 2013 年到 2014 年。如果我的开始日期和结束日期都在 2013 年,则数字是正确的。但如果跨越 2013 年至 2014 年,则数字不正确。不知道如何修复它。

【问题讨论】:

  • 首先,您是否尝试将范围缩小到 12 月和 1 月这两个月。单个查询中的记录数也有限制。我们进行分块以获取记录

标签: google-analytics google-analytics-api


【解决方案1】:

我怀疑您对Sampling level 有疑问

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.

【讨论】:

  • 遇到了同样的问题,但没有采样效果:您应该查看响应中containsSampledData 的值。如果true 那么 samplingLevel 会有所帮助,否则你会卡住......
  • 请注意,在 v4 中,samplingLevel 值已分别更改为 DEFAULTSMALLLARGE。这并没有解决我的问题,但这是参考:developers.google.com/analytics/devguides/reporting/core/v4/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-21
  • 2017-02-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-15
相关资源
最近更新 更多