我似乎无法获得与 BigQuery 中的 Google Analytics Premium 相同数量的 session 和用户。我使用 fullvisitorID 来计算 session 数(计数)和用户数(唯一计数),这是否与 Google Analytics 中的数字不符?

最佳答案

虽然 @Felipe Hoffa 是正确的, COUNT(DISTINCT x, 10000) 会让你得到一个更精确的数字,它可以通过将 10,000 数字变成多达 1,000,000(我认为是最大的)来进一步增强当前的“采样”率: BigQuery Documentation of Count Distinct )。由于在 BigQuery 中使用 Google Anaytics Premium 数据的人并不多,因此这些问题的社区非常小。作为每天在 BigQuery 中使用 GA 数据的人,我可以告诉您,我的研究和验证表明,以下指标定义与 Google Analytics UnSampled Report 将告诉您的内容非常接近。

session

count(distinct concat(fullvisitorid, string(visitid)), 1000000) as sessions

用户
count(distinct fullvisitorid, 1000000) as users

新用户
count(distinct (case when totals.newvisits <> 0 then concat(fullvisitorid, string(visitid)) end), 1000000) as new_users

网页浏览量
sum(case when hits.type = "PAGE" then 1 else 0 end) as pageviews

唯一网页浏览量
count(distinct (case when hits.type = "PAGE" then concat(fullvisitorid, string(visitid), hits.page.pagepath) end), 1000000) as unique_pageviews

反弹
count(distinct (case when totals.bounces <> 0 then concat(fullvisitorid, string(visitid)) end), 1000000) as bounces

关于google-analytics - BigQuery 数据与谷歌分析,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28411215/

10-12 01:26
查看更多