Bigquery 中新安装的购买者群组的 Firebase 事件
Posted
技术标签:
【中文标题】Bigquery 中新安装的购买者群组的 Firebase 事件【英文标题】:Firebase Events for Newly Installed Purchaser Cohort in Bigquery 【发布时间】:2018-08-01 13:22:08 【问题描述】:鉴于 android 用户的安装日期,我想获取用户在第 0 天到第 X 天的所有 200 多个 Firebase 事件的用户计数,这些用户在安装后的规定时间内至少进行了一次购买。这个问题的前半部分以前在这个question 中解决过。我认为分享一个添加的“购买者”队列查询以供其他人重复使用会很有帮助。
我的第一次尝试(失败):
-- STANDARD SQL
-- NEW BIGQUERY EXPORT SCHEMA
SELECT
a.event_name AS event_name,
a._TABLE_SUFFIX as day,
COUNT(1) as users
FROM `xxxx.analytics_xxxx.events_*` as c
RIGHT JOIN (SELECT user_pseudo_id, event_date, event_timestamp, event_name
FROM `xxxx.analytics_xxxx.events_*`
WHERE user_first_touch_timestamp BETWEEN 1530453600000000 AND 1530468000000000
AND _TABLE_SUFFIX BETWEEN '20180630' AND '20180707'
AND platform = "ANDROID"
AND (event_name = 'in_app_purchase' OR event_name = 'ecommerce_purchase')
) as a
ON a.user_pseudo_id = c.user_pseudo_id
WHERE _TABLE_SUFFIX BETWEEN '20180630' AND '20180707'
GROUP BY event_name, day;
【问题讨论】:
【参考方案1】:答案:
-- STANDARD SQL
-- NEW BIGQUERY EXPORT SCHEMA
SELECT
event_name AS event_name,
_TABLE_SUFFIX as day,
COUNT(1) as users
FROM `xxxx.analytics_xxxx.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20180630' AND '20180707'
AND user_pseudo_id IN (SELECT user_pseudo_id
FROM `xxxx.analytics_xxxx.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20180630' AND '20180707'
AND user_first_touch_timestamp BETWEEN 1530453600000000 AND 1530468000000000
AND (event_name = 'in_app_purchase' OR event_name = 'ecommerce_purchase')
AND platform = "ANDROID")
GROUP BY event_name, day;
PS:欢迎提出优化此脚本的建议 :)
【讨论】:
以上是关于Bigquery 中新安装的购买者群组的 Firebase 事件的主要内容,如果未能解决你的问题,请参考以下文章
BigQuery 数据集使用 Google Group 访问服务帐户
如何防止用户向群组发送消息,但继续接收来自该群组的消息(只读)?