使用BigQuery复现GA4/Firebase安卓应用获客报告数据不符问题
GA4 BigQuery查询购买用户数不符的问题排查
以下是导致数据不匹配的核心问题及修正方案:
购买用户数未做去重处理
你的SQL中purchasers字段使用count(case when event_name= "purchase" then user_pseudo_id end ),会统计所有purchase事件的发生次数(同一个用户多次购买会被重复计数),但GA4探索报告中的购买用户数是去重后的独立用户数。修正方式是添加distinct:count(distinct case when event_name= "purchase" then user_pseudo_id end ) as purchasers缺少特定日期范围筛选
你明确要查询"特定日期"的数据,但当前SQL未添加日期过滤条件,会读取events_*表中的全部历史数据,和GA4探索报告的时间范围不匹配。需在where子句中补充日期筛选:where platform='ANDROID' and _table_suffix between '20240501' and '20240531' -- 替换为你的目标日期区间流量归因逻辑与GA4默认规则不匹配
GA4获客报告默认采用首次互动归因:用户的渠道归属以其第一次触发事件的流量来源为准;而你的SQL直接使用每个purchase事件对应的traffic_source.medium,会将用户归属到购买行为发生时的渠道,而非首次获客渠道。
要匹配GA4的归因逻辑,需先获取每个用户的首次互动来源,再关联购买事件:with user_first_source as ( -- 获取每个用户的首次互动渠道 select user_pseudo_id, traffic_source.medium as first_medium, min(event_timestamp) as first_event_time from `mytable.events_*` where platform='ANDROID' and _table_suffix between '20240501' and '20240531' group by user_pseudo_id, traffic_source.medium ), purchase_users as ( -- 获取指定日期内的购买用户列表 select distinct user_pseudo_id from `mytable.events_*` where platform='ANDROID' and event_name='purchase' and _table_suffix between '20240501' and '20240531' ) select u.first_medium as medium, count(distinct u.user_pseudo_id) as users, count(distinct case when exists ( select 1 from `mytable.events_*` e where e.user_pseudo_id = u.user_pseudo_id and e.event_name='first_open' and e._table_suffix between '20240501' and '20240531' ) then u.user_pseudo_id end) as new_users, count(distinct p.user_pseudo_id) as purchasers from user_first_source u left join purchase_users p on u.user_pseudo_id = p.user_pseudo_id group by u.first_medium order by u.first_medium未处理重复上报事件
Firebase事件可能因网络重试等原因出现重复上报,可通过event_id去重,确保每个事件只被统计一次:select ... from ( select distinct event_id, user_pseudo_id, event_name, traffic_source.medium, _table_suffix from `mytable.events_*` ) filtered_events where ...
内容的提问来源于stack exchange,提问作者Nadia K
相关产品推荐
相关产品推荐

