https://support.google.com/analytics/answer/1257084?hl=en-GB#pageviews_vs_unique_views
我正在尝试计算Google Analytics在其界面上每天唯一网页浏览量的总和 如何使用bigquery获得等效项?
答案 0 :(得分:3)
使用它的方法有两种:
1)正如原始链接文档所说的那样,要结合完整的访问者用户ID和他们不同的会话ID:visitId,并计算这些。
SELECT
EXACT_COUNT_DISTINCT(combinedVisitorId)
FROM (
SELECT
CONCAT(fullVisitorId,string(VisitId)) AS combinedVisitorId
FROM
[google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
WHERE
hits.type='PAGE' )
2)另一个只计算不同的fullVisitorIds
SELECT
EXACT_COUNT_DISTINCT(fullVisitorId)
FROM
[google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
WHERE
hits.type='PAGE'
如果有人想在样本公共数据集上尝试此操作,则会有tutorial how to add the sample dataset。
答案 1 :(得分:1)
其他查询与我的Google Analytics帐户中的“唯一身份浏览量”指标不匹配,但以下情况确实如下:
SELECT COUNT(1) as unique_pageviews
FROM (
SELECT
hits.page.pagePath,
hits.page.pageTitle,
fullVisitorId,
visitNumber,
COUNT(1) as hits
FROM [my_table]
WHERE hits.type='PAGE'
GROUP BY
hits.page.pagePath,
hits.page.pageTitle,
fullVisitorId,
visitNumber
)
答案 2 :(得分:0)
对于uniquePageViews,你最好使用这样的东西:
SELECT
date,
SUM(uniquePageviews) AS uniquePageviews
FROM (
SELECT
date,
CONCAT(fullVisitorId,string(VisitId)) AS combinedVisitorId,
EXACT_COUNT_DISTINCT(hits.page.pagePath) AS uniquePageviews
FROM
[google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
WHERE
hits.type='PAGE'
GROUP BY 1,2)
GROUP EACH BY 1;