我正在使用大查询,并试图导入自定义尺寸以及非自定义尺寸。分析是从应用程序发送的,基本上我需要一个包含列的表:用户ID(自定义维度),平台ID(自定义维度),屏幕名称(基本上是“网页名称”的应用程序版本)和日期。度量标准是将所有这些维度分组的“屏幕浏览次数”。这是它看起来象下面这样:谷歌自定义尺寸BigQuery
的GA报告的照片:
所以,在BigQuery中,我能拿到签出(与上述GA报表时),直到我的数字添加到自定义维度中。一旦我添加了自定义尺寸,这些数字就没有任何意义了。
我知道自定义维度嵌套在大查询中。所以我首先确保使用FLATTEN。然后,我尝试没有变平,并得到相同的结果。这些数字没有意义(比GA界面大几百倍)。
我的查询在下面(一个没有FLATTEN,另一个没有FLATTEN)。
PS我非常想用的
count(hits)
代替
count(hits.appInfo.screenName)
但我一直得到一个错误,当我在子查询中选择命中。
我的查询没有拼合在下面。如果你能帮助我弄清楚,为什么是它,一旦我添加自定义维度的所有数据被搞砸
SELECT
date,
hits.appInfo.version,
hits.appInfo.screenName,
UserIdd,
platform,
count(hits.appInfo.screenName)
FROM (
SELECT
date,
hits.appInfo.version,
hits.appInfo.screenName,
max(case when hits.customdimensions.index = 5 then hits.customdimensions.value end) within record as UserIdd,
max(case when hits.customdimensions.index = 20 then hits.customdimensions.value end) within record as platform
FROM
TABLE_DATE_RANGE([fiery-cabinet-97820:87025718.ga_sessions_], TIMESTAMP('2017-04-04'), TIMESTAMP('2017-04-04'))
)
where UserIdd is not null
and platform = 'Android'
GROUP BY
1,
2,
3,
4,
5
ORDER BY
6 DESC
,这里是我的查询与FLATTEN(同样的问题 - 数字不有道理)
SELECT
date,
hits.appInfo.version,
customDimensions.index,
customDimensions.value,
hits.appInfo.screenName,
UserIdd,
count(hits.appInfo.screenName)
FROM (FLATTEN((FLATTEN((
SELECT
date,
hits.appInfo.version,
customDimensions.value,
customDimensions.index,
hits.appInfo.screenName,
max(case when hits.customdimensions.index = 5 then hits.customdimensions.value end) within record as UserIdd,
hits.type
FROM
TABLE_DATE_RANGE([fiery-cabinet-97820:87025718.ga_sessions_], TIMESTAMP('2017-04-04'), TIMESTAMP('2017-04-04'))), customDimensions.value)),hits.type))
WHERE
customDimensions.value = 'Android'
and customDimensions.index = 20
and UserIdd is not null
GROUP BY
1,
2,
3,
4,
5,
6
ORDER BY
7 DESC
为什么在这个问题上有'mysql'标签? –