我正在尝试了解在当前的Firebase“活动”用户指标报告(按下面的图表)中逐月报告,还是自行计算并报告平均值 >在特定时期内这些指标的每个值。
乍一看,仪表板向您显示了2018年12月的1天,7天和28天活动用户,但实际上仅显示所选日期范围值的最后一天(在右边)。知道这一点很高兴,但是在我的月度分析中仅比较最后日期的值有些误导。另一种方法是在选定期间内自行计算平均值:
应用于Firebase演示数据集,我得到以下数字:
Firebase仪表板:
我的计算平均值:
这里的差异很小,但是我发现我们的应用程序存在一些显着差异,该应用程序每月有数百万的活跃用户。
问题:
答案 0 :(得分:1)
要回答我自己的问题,我想先回顾一下定义,然后再进行计算。
基于支持的Firebase documents,我总结了以下每个指标的定义。重要的是要声明,在每个指标(给定的日期范围内)中,仅应将唯一身份用户计数。
user_engagement
事件。user_engagement
事件。user_engagement
事件。在下面的单元格中,您可以查看如何计算12月的指标:
计算每个指标/受众群体的方法:
Average 1-day active user metric
计算特定月份的DAU。Average 7-day active user metric
计算特定月份的WAU。我是通过平均12月7日,14日,21日,28日的快照来计算得出的。Non-averaged 28-day active user metric
计算特定月份的MAU。不平均该指标值的主要原因是,因为我只希望获得整个月的一个快照。如果我在这里使用平均值,我还将考虑上个月活跃的用户。 AVG 1天唯一活动用户指标(Android,2018年12月)
# StandardSQL
SELECT
ROUND(AVG(users),0) AS users
FROM
(
SELECT
event_date,
COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX BETWEEN '20181201' AND '20181231'
AND platform = "ANDROID"
GROUP BY 1
) table
# or you could also use code below, but you will have to add in the remaining days' code to query against the entire month.
-- Set your variables here
WITH timeframe AS (SELECT DATE("2018-12-01") AS start_date, DATE("2018-12-31") AS end_date)
-- Query your variables here
SELECT ROUND(AVG(users),0) AS users
FROM
(
SELECT event_date, COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 1 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL 0 DAY))
AND platform = "ANDROID"
GROUP BY 1
UNION ALL
SELECT event_date, COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 2 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 1 DAY))
AND platform = "ANDROID"
GROUP BY 1
...
...
...
...
) avg_1_day_active_users
AVG 7天唯一活动用户指标(Android,2018年12月)
-- Set your variables here
WITH timeframe AS (SELECT DATE("2018-12-01") AS start_date, DATE("2018-12-31") AS end_date)
-- Query your variables here
SELECT ROUND(AVG(users),0) AS users
FROM
(
SELECT COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 7 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL 0 DAY))
AND platform = "ANDROID"
UNION ALL
SELECT COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 14 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 7 DAY))
AND platform = "ANDROID"
UNION ALL
SELECT COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 21 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 14 DAY))
AND platform = "ANDROID"
UNION ALL
SELECT COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 28 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 21 DAY))
AND platform = "ANDROID"
) avg_7_day_active_users
非平均28天唯一活动用户指标(Android,2018年12月)
# StandardSQL
-- Set your variables here
WITH timeframe AS (SELECT DATE("2018-12-01") AS start_date, DATE("2018-12-31") AS end_date)
-- Query your variables here
SELECT COUNT(DISTINCT user_pseudo_id) AS users
FROM `<id>.events_*`AS z, timeframe AS t
WHERE
event_name = 'user_engagement'
AND _TABLE_SUFFIX > FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL - 28 DAY))
AND _TABLE_SUFFIX <= FORMAT_DATE('%Y%m%d', DATE_ADD(t.end_date, INTERVAL 0 DAY))
AND platform = "ANDROID"
旁注:
SELECT COUNT(DISTINCT user_id) FROM /* PLEASE REPLACE WITH YOUR TABLE NAME */ `YOUR_TABLE.events_*` WHERE event_name = 'user_engagement' /* Pick events in the last N = 20 days */ AND event_timestamp > UNIX_MICROS(TIMESTAMP_SUB(CURRENT_TIMESTAMP, INTERVAL 20 DAY)) /* PLEASE REPLACE WITH YOUR DESIRED DATE RANGE */ AND _TABLE_SUFFIX BETWEEN '20180521' AND '20240131';