【发布时间】:2017-04-23 23:34:48
【问题描述】:
我正在使用大查询,并尝试将自定义维度与非自定义维度一起导入。分析是从应用程序发送的,基本上我想要一个包含列的表:UserID(自定义维度)、platformID(自定义维度)、ScreenName(基本上是“页面名称”的应用程序版本)和日期。该指标是分组到所有这些维度上的“屏幕浏览次数”。如下所示:
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标签?
标签: google-analytics google-bigquery