https://support.google.com/analytics/answer/1257084?hl=en-GB#pageviews_vs_unique_views如何獲得的獨特頁面瀏覽的谷歌分析定義BigQuery中
我試圖計算出每天的這谷歌分析有其接口 獨特的頁面瀏覽量之和如何使用獲得相當於BigQuery的?
https://support.google.com/analytics/answer/1257084?hl=en-GB#pageviews_vs_unique_views如何獲得的獨特頁面瀏覽的谷歌分析定義BigQuery中
我試圖計算出每天的這谷歌分析有其接口 獨特的頁面瀏覽量之和如何使用獲得相當於BigQuery的?
有兩種方法如何使用此方法:
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。
對於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;
其他查詢不匹配我的谷歌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
)
EXACT_COUNT_DISTINCT(fullVisitorId)和COUNT(DISTINCT fullVisitorId)有什麼區別? – shecode
@shecode DISTINCT的返回值是一個統計近似值,不能保證是精確的,默認情況下只有1000個項目被使用,而另一個是精確的。 – Pentium10