我尝试通过“操作系统”(device.operating_system)和“日期”(event_date)来获得“平均会话持续时间”组。
在firebase blog中,他们给我们这个查询以获取平均持续时间会话
SELECT SUM(engagement_time) AS total_user_engagement
FROM (
SELECT user_pseudo_id,
(SELECT value.int_value FROM UNNEST(event_params) WHERE key =
"engagement_time_msec") AS engagement_time
FROM `FIREBASE_PROJECT`
)
WHERE engagement_time > 0
GROUP BY user_pseudo_id
此查询通过用户ID(每行是不同的用户)为我提供了总的用户参与度:
row|total_user_engagement
---|------------------
1 |989646
2 |225655
3 |125489
4 | 58496
...|......
但是我不知道必须在何处添加“操作系统”和“ event_date”变量才能通过os和date获得此信息。我尝试了不同查询,但没有结果。例如,要通过操作系统获得此结果,我尝试了以下
SELECT SUM(engagement_time) AS total_user_engagement
FROM (
SELECT device.operating_system,
(SELECT value.int_value FROM UNNEST(event_params) WHERE key =
"engagement_time_msec") AS engagement_time
FROM `FIREBASE_PROJECT`
)
WHERE engagement_time > 0
GROUP BY device.operating_system
但是它给我一个错误消息(错误:无法识别的名称:设备在[9:10])。在其他查询中,device.operating_system被识别。
例如其中一个:
SELECT
event_date,
device.operating_system as os_type,
device.operating_system_version as os_version,
device.mobile_brand_name as device_brand,
device.mobile_model_name as device_model,
count(distinct user_pseudo_id) as all_users
FROM `FIREBASE Project`
GROUP BY 1,2,3,4,5
我想要的结果是这样的:
row|event_date|OS |total_user_engagement
---|----------------------------------------
1 |20191212 |ios |989646
2 |20191212 |android|225655
3 |20191212 |ios |125489
4 |20191212 |android| 58496
...
谢谢