google-analytics - BigQuery,如何复制“转化次数 | (增强)电子商务 | 结账行为漏斗报告
问题描述
我构建了一个查询,允许我在 bigquery 中复制谷歌分析购物行为漏斗报告:
#standardSQL
select
case when totals.newvisits = 1 then 'New visitor' else 'Returning visitor' end as user_type,
count(distinct concat(fullvisitorid, cast(visitstarttime as string))) as all_sessions,
count(distinct case when hits.ecommerceaction.action_type = '2' then concat(fullvisitorid, cast(visitstarttime as string)) else null end) as sessions_with_product_views,
count(distinct case when hits.ecommerceaction.action_type = '3' then concat(fullvisitorid, cast(visitstarttime as string)) else null end) as sessions_with_add_to_card,
count(distinct case when hits.ecommerceaction.action_type = '5' then concat(fullvisitorid, cast(visitstarttime as string)) else null end) as sessions_with_check_out,
count(distinct case when hits.ecommerceaction.action_type = '6' then concat(fullvisitorid, cast(visitstarttime as string)) else null end) as sessions_with_transactions
from
`dataset.ga.ga_sessions_20210410`,
unnest(hits) as hits,
unnest(product) as product
where
totals.visits = 1
group by
user_type
order by
all_sessions desc
结果如下:
这是针对会话的,我也有类似的针对放弃的。我找不到任何提供结帐阶段的字段,因此我也可以复制结帐报告渠道。这些阶段是“当前订单”、“运输计费方式”、“订单确认”和相对下降。给出购物阶段的字段是“hits.ecommerceaction.action_type”,是否有用于结帐的字段?
解决方案
您可以使用 hits.eCommerceAction.step 来获取结帐流程的步骤。
当使用命中指定结帐步骤时,将填充此字段。
推荐阅读
- php - 如何在 Laravel 中按单列分组
- elasticsearch - Elasticsearch - 查询字符串中的特殊字符
- node.js - 尝试 find.count 时如何避免“[object Object]1”
- oracle - 如何在两个日期之间的表上获取日期范围分区名称(给定日期范围)
- javascript - 如何在java中的mapReduce中调用mongodb服务器端函数
- docker - Linkerd 边车注入
- php - 更好的性能,JOIN 还是多个查询?
- git - Git:提交日期的批量更改
- javascript - 使用 Numeral JS 将任何数字转换为相同的比例
- git - 作为 git 中 master 合并的一部分提交的文件列表