我正在尝试从 BigQuery 中导出命中级别的 Google Anlaytics 自定义维度和一些事件。到目前为止,自定义维度导出不起作用。
我正在使用 LegacySQL。因为这是更大查询的一部分,我现在不想切换到 StandardSQL。
SELECT
clientId,
totals.timeOnSite,
hits.page.pagePath,
MAX(IF(customDimensions.index=1, customDimensions.value, NULL)) WITHIN
customDimensions AS cd1,
trafficSource.source,
SUM(COUNT(CASE WHEN (hits.eventInfo.eventCategory = 'Download' AND hits.type
= 'EVENT' AND hits.eventInfo.eventAction = 'pdf') THEN
hits.eventInfo.eventAction END)) AS Downloads,
SUM(COUNT(CASE WHEN (hits.eventInfo.eventLabel = 'search-header' OR
hits.eventInfo.eventLabel = 'search-mainpage') AND hits.type = 'EVENT' THEN
hits.eventInfo.eventLabel END)) AS Search,
FROM TABLE_DATE_RANGE([xxxxxx.ga_sessions_],
TIMESTAMP('2018-11-25'), TIMESTAMP('2018-11-25')) WHERE hits.page.pagePath LIKE '%xyz%'
GROUP BY 1,2,3,4,5
LIMIT 100;
查询失败并显示“错误:范围和非范围聚合函数的混合无效”关于如何解决这个问题的任何想法?亲切的问候!