Google 分析:添加指标 returns 不同的结果

Google Analytics: Adding a metric returns different result

我正在处理 Google Analytics 数据提取,我发现在添加指标时结果有所不同。

当我这样查询 API 时 https://www.googleapis.com/analytics/v3/data/ga?ids=ga:xxxxx&start-date=2018-12-01&end-date=2018-12-31&metrics=ga:totalEvents&dimensions=ga:eventLabel,ga:eventCategory,ga:eventAction&max-results=100&start-index=1&filters=ga:eventLabel=~théories et pratiques de l'enseignement programmé: guide à l'usage des enseignants 我收到这个:

"totalsForAllResults": {
    "ga:totalEvents": "23"
  }

当我将 ga:dateHourMinute 添加到指标时,相同的是 属性 returns 14 而不是 23。有没有办法让我获得正确的总事件数,在本例中为 23,并在同一查询中获得日期和时间?

根据您的评论,我们了解到您已达到 抽样阈值 。默认报告不受抽样影响。但是,通过应用次级维度(在本例中 ga:dateHourMinute),您需要一个临时查询,以便您的数据受采样阈值的约束,请参见此处:

https://support.google.com/analytics/answer/2637192?hl=en

你可以做的是查询两个较短的周期,然后将事件的值加在一起。