我正在尝试在Google BQ中编写查询,在该查询中导出了我们的GA数据。查询在下面
SELECT visitStartTime,date,,hits.eCommerceAction.*,count(totals.visits)
FROM flatten([bigquery-xxxxxx:xxxxxxxx.ga_sessions_20180925],hits.eCommerceAction)
WHERE hits.eCommerceAction.action_type <> '0'
GROUP BY date,visitStartTime,hits.eCommerceAction.action_type,hits.eCommerceAction.option,hits.eCommerceAction.step
LIMIT 1000
此输出看起来像这样
date hits_type hits_step hits_option f0_
20180925 5 1 1 0
20180925 2 1 0 1
我的问题是,当发送电子商务匹配时,会话数如何为0? (f0
列)。由于totals.visits
可以返回1或NULL,并且由于count只计算非NULL值,因此我应该对visitID
这样的其他字段进行计数以避免NULL吗?所有在线教程均显示为使用totals.visits
,因此我是否在这里缺少任何内容感到困惑。
谢谢
答案 0 :(得分:0)
如果会话中只有非互动匹配,则totals.visits将为null。如果您想同时包含互动和非互动匹配,那么计算唯一的visitId + fullVisitorId组合是正确的。