在导出到 BigQuery 的 FirebaseAnalytics 数据中,有些事件的值为 null ga_session_id

In FirebaseAnalytics data exported to BigQuery, there are some events that have null ga_session_id

我正在使用导出到 BigQuery 的 FirebaseAnalytics 数据来分析我们的应用程序。
要检查用户转换,我会像下面这样写 sql。

with users_with_screen_view_and_session_id as (
  SELECT
    user_id,
    user_pseudo_id,
    event_date,
    event_timestamp,
    event_name,
    platform,
    case
      when event.key = 'firebase_screen'
        and event.value.string_value is not null then event.value.string_value
      when event.key = 'firebase_screen'
        and event.value.int_value is not null then cast(event.value.int_value as string)
      else null
    end as firebase_screen,
    case
      when event.key = 'ga_session_id'
        and event.value.string_value is not null then event.value.string_value
      when event.key = 'ga_session_id'
        and event.value.int_value is not null then cast(event.value.int_value as string)
      else null
    end as session_id
  FROM
    `{my_project}.analytics_{my_id}.events_*`  as main
    ,unnest(event_params) as event
    WHERE _TABLE_SUFFIX BETWEEN '20191001' AND '20191001'
    and event_name = 'screen_view'
),
users_with_screen_view_agg_firebase_screen as (
  select
    user_id,
    user_pseudo_id,
    event_date,
    event_name,
    platform,
    event_timestamp,
    max(firebase_screen) as firebase_screen,
    max(session_id) as session_id
  from
    users_with_screen_view_and_session_id
  group by
    user_id,
    user_pseudo_id,
    event_date,
    event_name,
    platform,
    event_timestamp
)
select
  *
from
  users_with_screen_view_agg_firebase_screen
;

我以为每个事件都有ga_session_id,但在这个查询结果中有一些行ga_session_id是空的。

什么情况下ga_session_id值会变成null?

查询结果图片在这里。 enter image description here

会话丢失的主要原因是SDK的版本。 2018 年底,firebase SDK 上有一个 change 旨在删除缺失的 ga_sessions_id,因此请检查您的 SDK 版本是否至少为 16.5.0 或更高版本。

如果这似乎不是您的问题,我建议您直接与 firebase 支持部门联系 here,以便他们了解这种情况。