从 Google 分析获取维度数据,即使该维度的数据不可用

Getting dimension data from Google analytics even when the data for that dimension is not available

我正在 PHP 中使用 Google 分析报告工具。

我在维度数据不可用时查询数据时遇到问题。

例如: 这些是维度 ga:date,ga:countryIsoCode,ga:eventCategory,ga:eventAction,ga:eventLabel 我有。

这些是指标 ga:totalEvents 我有。

但问题是,对于某些数据,ga:eventLabel 存在,而对于某些数据,ga:eventLabel 不存在。

当我使用维度和指标查询时,结果集中的数据不包括没有ga:eventLabel的数据。

即使缺少 ga:eventLabel,我如何获取数据?

GA 报告就是这样工作的。 空维度几乎总是会过滤掉其他维度。 (GA 使用(未设置)的少数例外) 您要么需要在跟踪时始终向 ga:eventLabel 上游添加一个值,要么进行艰苦的查询工作。 1. ga:eventCategory 2. ga:eventCategory,ga:eventAction 3. ga:eventCategory,ga:eventAction,ga:eventLabel 然后你 - 智能地 - 将数据集拼接在一起。 您需要确保您不使用在 2 等中向下钻取的 1 的结果。