如何解决BigQuery - 产品视图和列表视图
我正在尝试查找每位访问者对产品的浏览量。我已将表格名称从公司表格更改为公共表格,但是使用公司表格,我发现一位访客购买了 7 件商品,但我只能显示他们点击了 3 次商品这是不准确的。 BigQuery 架构中的示例在技术和逻辑上都不适用于 BigQuery。
有谁知道如何按会话计算列表浏览量和产品浏览量?
select
concat(fullVisitorId,visitId) as session_id,case when p.productVariant is null then p.productSKU
when left(p.productSKU,2) = 'IA' then left(p.productSKU,10)
else left(p.productSKU,19) end as p_sku,p.productVariant as variant,p.v2ProductCategory as category,p.productBrand as vendor,p.productListName,totals.pageviews as total_page_views,sum(case when p.isImpression = true then 1 else null end) as list_views,sum(case when p.isClick = true then 1 else null end) as page_views,max(case when h.ecommerceaction.action_type = '3' then 1 else 0 end) as add_to_bag,max(case when h.ecommerceaction.action_type = '5' then 1 else 0 end) as checkout,sum(case when h.ecommerceaction.action_type = '6' then p.productQuantity else 0 end) as units,(sum(p.productQuantity) * p.productPrice)/1000000 as sales
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`,UNNEST(hits) as h,unnest(h.product) as p
--where visitId = 1611499236
--and p.productSKU like 'IA00512586%'
group by concat(fullVisitorId,visitId),19) end,p.productVariant,p.v2ProductCategory,p.productBrand,totals.pageviews,p.productPrice
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。