目前遇到bigquery查询的问题我正在使用,但特别是使用汇总属性。以下查询显示在特定日期两次访问计算(访问次数和访问次数2)之间的访问量的两倍。在其他日期,数字匹配,然后在其他日期,他们大约加倍。但主要是访问是双重访问2。有什么想法吗?
SELECT
date,
geoNetwork.country AS Country,
SUM(totals.visits) AS visits,
COUNT(DISTINCT CONCAT(CAST (visitId AS string),fullvisitorId)) AS visits2,
COUNT(DISTINCT(fullVisitorId)) AS Users,
SUM(totals.newVisits) AS new_,
SUM(totals.pageviews) AS PAGEVIEWS,
SUM(totals.bounces) AS BOUNCES,
SUM(CASE
WHEN device.isMobile = TRUE THEN (totals.visits)
ELSE 0 END) mobilevisits,
SUM(CASE
WHEN trafficSource.medium = 'organic' THEN (totals.visits)
ELSE 0 END) organicvisits,
SUM(CASE
WHEN EXISTS( SELECT 1 FROM UNNEST(hits) hits WHERE REGEXP_CONTAINS(hits.eventInfo.eventAction,'register$|registersuccess|new registration|account signup|registro')) THEN 1
ELSE 0 END) AS NewRegistrations,
SUM(CASE
WHEN EXISTS( SELECT 1 FROM UNNEST(hits) hits WHERE REGEXP_CONTAINS(hits.eventInfo.eventAction, 'add to cart|add to bag|click to buy|ass to basket|comprar|addtobasket::')) THEN 1
ELSE 0 END) AS ClickToBuy,
SUM(totals.transactions) AS Transactions,
SUM(totals.transactionRevenue) /1000000 AS Revenue
FROM
`project-1&&&&.dataset.ga_sessions*`
WHERE
1 = 1
AND PARSE_TIMESTAMP('%Y%m%d', REGEXP_EXTRACT(_table_suffix, r'.*_(.*)')) BETWEEN TIMESTAMP('2016-01-01')
AND TIMESTAMP('2017-05-08')
GROUP BY
date,
Country
ORDER BY
visits DESC;
看起来问题也出现在反弹,综合浏览量,移动访问和有机访问中。
如果我必须使用更多的手册版本的visit2,我也需要同样的其他指标,任何人都可以指出我的方向,更准确的计算是这样的,例如如何计算跳出而不使用totals.bounces?
由于
答案 0 :(得分:0)
Elliot的评论是正确的,看起来我必须添加一个下划线(我进一步添加“_2017”以确保查询不查询日内表。有趣的是,这似乎只是卷起的问题链接到BigQuery的属性,因为普通属性不需要这些属性,原始版本中使用的通配符格式适用于通常的Google Analytics(分析)属性。