§13 行为分析实战:转化、留存、路径全看一遍
以下展示的实战案例包括:用户行为方面,转化方面,渠道跟踪,广告跟踪,留存 等等


数据API:
https://posthog.com/docs/api/experiments#get-api-projects-project_id-experiments


参考: https://posthog.com/docs/hogql
本地安装posthog:
是基于docker, 命令, 直接执行:
Sudo /bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"
按提示 填写域名等, 等15分钟则可以安装完成。

安装后:
To stop the stack run 'docker-compose stop'
To start the stack again run 'docker-compose start'
概览Dashboard:
概览,就是把自定义分析的结果,钉在面板上,方便查看。


录屏:


转化分析:

社媒分析:

基于用户属性的维度分析:

搜索分析:


用户的活跃分析:

留存分析:

分布分析的使用:

问题异常页面分析:

用户访问来源分析:(Ref分析)

地图分析:

汇总指标分析:

勾选对比选项:

转化率分析:

改变转化率的展示形式:

复购率分析:

用户路径分析:

数据格式显示调整:


正则的使用:
https://posthog.com/tutorials/regex-basics

组合新事件:
例如, 加购动作= buy_it_now + add_to_cart


流失分析:

数据仓库功能:
参考:https://posthog.com/docs/data-warehouse/setup

用户分群:
例子: 30天访问2次+ 的用户


定义活跃用户:

AB test:
后台设置ab test:

前端使用ab test:

用户的平均行为: (公式功能的利用)

新用户的跳出:

跳出率,使用了谷歌的定义, 10秒内离开就是跳出。
参考:https://posthog.com/tutorials/bounce-rate

新老用户的定义:
新用户:

老用户: (not new user)

活跃用户的定义:

日活/月活/周活:

平均使用时长:

多维度的group by:

在breakdown栏 填写类似:

转化归因:


可视化埋点:


SQL的利用: (sql自定义查询)

例子,计算停留时间:
参考: https://posthog.com/tutorials/time-on-page
SELECT
avg (time_on_page) AS avg_time_on_page, sum(time_on_page) AS sum_time_on_page, max(time_on_page) AS max_time_on_page,
current_url
FROM (
SELECT
dateDiff('second', first_timestamp, next_timestamp) AS time_on_page,
current_url
FROM (
SELECT
distinct_id,
event AS first_event,
timestamp AS first_timestamp,
first_value(event) OVER w AS next_event,
first_value(timestamp) OVER w AS next_timestamp,
properties.$current_url as current_url
FROM events
WHERE
timestamp > toDateTime('2023-11-01 00:00:00') AND timestamp \< toDateTime('2023-11-02 00:00:00')
AND (event = '$pageview' OR event = '$pageleave')
AND properties.$current_url LIKE '%keswigs.com/products/%' /* new */
WINDOW w AS (PARTITION BY distinct_id ORDER BY timestamp ASC ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING)
ORDER BY distinct_id, timestamp
) AS subquery
WHERE first_event = '$pageview'
AND (next_event = '$pageleave' OR next_event = '$pageview')
AND time_on_page \<= 180
)
GROUP BY current_url
ORDER BY sum_time_on_page DESC limit 1500