如何在BigQuery中建立Raport热门转换路径

时间:2019-07-10 06:08:26

标签: sql google-analytics google-bigquery

我在Google Analytics(分析)中构建像“热门转化路径”这样的raport时遇到问题。有什么想法可以创建这个吗?

我找到了类似的东西,但是没用(https://lastclick.city/top-conversion-paths-in-ga-and-bigquery.html):

SELECT
    REGEXP_REPLACE(touchpointPath, 'Conversion >.*', 'Conversion') as touchpointPath, COUNT(touchpointPath) AS TOP
FROM (SELECT
    GROUP_CONCAT(touchpoint,' > ') AS touchpointPath
FROM (SELECT
    *
FROM (SELECT
    fullVisitorId,
    'Conversion' AS touchpoint,
    (visitStartTime+hits.time) AS timestamp
FROM
    TABLE_DATE_RANGE([pro-tracker-id.ga_sessions_], TIMESTAMP('2018-10-01'), TIMESTAMP('2018-10-05'))
WHERE
    hits.eventInfo.eventAction="Email Submission success")
    ,
    (SELECT
    fullVisitorId,
    CONCAT(trafficSource.source,'/',trafficSource.medium) AS touchpoint,
    (visitStartTime+hits.time) AS timestamp
FROM
    TABLE_DATE_RANGE([pro-tracker-id.ga_sessions_], TIMESTAMP('2018-10-01'), TIMESTAMP('2018-10-05'))
WHERE
    hits.hitNumber=1)
ORDER BY
    timestamp)
GROUP BY
    fullVisitorId
HAVING
    touchpointPath LIKE '%Conversion%')
GROUP BY
    touchpointPath
ORDER BY
    TOP DESC

2 个答案:

答案 0 :(得分:1)

它不起作用,因为您必须根据需要修改查询。

此行需要更改以匹配您的特定事件操作:

    hits.eventInfo.eventAction="YOUR EVENT ACTION HERE")

表格参考和日期也需要更改:

TABLE_DATE_RANGE([pro-tracker-id.ga_sessions_], TIMESTAMP('2018-10-01'), TIMESTAMP('2018-10-05'))

答案 1 :(得分:0)

共享的文章引用了link,有关获取有关BigQuery旧版SQL中的flatten函数的信息。

据我所知,新的BigQuery UI中的查询默认情况下以标准SQL运行;但是,您可以通过在Web UI,REST API调用中或在使用Cloud Client库时在查询中包含prefix来设置SQL变体。