1

我正在寻找通过在线营销渠道制作的客户旅程用户。我的数据集架构与 Google Merchandise Store 相同,可在此处找到: https ://support.google.com/analytics/answer/3437719?hl=en

这就是我的输入数据的样子(示例):

+---------------+-------+------------+---------+--------------+-------------+
| fullVisitorId | visit | visitTime  | revenue | transactions |   channel   |
+---------------+-------+------------+---------+--------------+-------------+
|          1234 |     1 | 1516468217 | null    | null         | Direct      |
|          1234 |     2 | 1517937012 | null    | null         | EMail       |
|          1234 |     3 | 1523031014 | null    | null         | Organic     |
|          1234 |     4 | 1530461419 | null    | null         | Organic     |
|          1234 |     5 | 1531152611 | null    | null         | Paid Search |
|          1234 |     6 | 1531411812 | 1393000 | 1            | Organic     |
+---------------+-------+------------+---------+--------------+-------------+

我已经做了这个 SQL 查询:

WITH
_step1 AS (SELECT
DISTINCT
a.fullVisitorId, 
a.visitNumber,
a.visitStartTime,
a.Date,
a.totals.totalTransactionRevenue AS totalTransactionRevenue,
a.totals.transactions AS transactions,
a.channelGrouping AS channelGrouping

FROM
`data` a,
unnest(a.hits) as h
)
SELECT
a.fullVisitorId as visitor,
STRING_AGG(channelGrouping, '>') AS CustomerJourney, 
SUM(totalTransactionRevenue) AS Umsatz, 
SUM(transactions) AS transaktionen
FROM
_step1 as s

GROUP BY fullVisitorId

结果应如下所示:

+--------+----------------------------+---------+---------------+
| visitor| CustomerJourney            | Umsatz  | transaktionen |
+--------+----------------------------+---------+---------------+
|1234    | Direct>EMail               | null    | null          |
|1234    | Organic                    | null    | null          |
|1234    | Organic>Paid Search>Organic| 1393000 | 1             |
+--------+----------------------------+---------+---------------+

我实际得到的:

+--------+-------------------------------------------------+---------+---------------+
| visitor| CustomerJourney                                 | Umsatz  | transaktionen |
+--------+-------------------------------------------------+---------+---------------+
|1234    | Direct>EMail>Organic>Organic>Paid Search>Organic|1393000  |1              |
+--------+-------------------------------------------------+---------+---------------+

困难的部分:

有一个转化跟踪期(30 天),这意味着如果自第一次访问以来已过去 30 天或用户完成交易(新行),则将开始新的客户旅程。每次访问都有时间戳。

我必须从哪个查询开始考虑转化跟踪期?

4

0 回答 0