埋点专题 · 预测市场
预测市场
埋点规范
技术侧整理版本。涵盖 4 PV · 14 Click · 2 Callback,共 20 个有效埋点事件,新增 platform 字段区分 web / h5 差异行为。
导出埋点清单 CSV
为什么要精简
⚠
产品原始需求表中存在重复事件(同一 btn_name 跨页面多次列出)和低价值事件(高频按键触发、被动关闭等)。全量照单实现会产生大量噪音,淹没真实转化信号,增加 BI 清洗成本。
相同语义的事件用参数字段区分而非拆成多条。
例:体育二级大类与联赛筛选合并为 switch_sport_filter,通过 filter_type 区分层级。
以下类型事件不单独埋点:
· 被动关闭行为(可通过漏斗缺口反推)
· 纯 UI 偏好操作(如显示/隐藏资产)
· 高频输入事件(如金额每次按键)
关键业务数据随 Callback 事件一并上报,不单独设立。
例:交易金额、市场 ID 随 trackCallbackCollect 的扩展字段携带,无需单独触发输入事件。
公共参数
所有事件均携带以下字段,通过 setTrackerInfo() 在页面 onMounted 时注入。
| 字段 | 类型 | 必填 | 说明 |
project_type | string | 是 | 固定值 "predict"(Assets 导航页除外,为 "Assets") |
project_name | string | 是 | 页面标识,见 PageView 表 |
btn_type | string | 是(Click) | "button" | "banner" | "link" | "menu" | "tab" | "card" |
btn_name | string | 是(Click) | 按钮英文 ID,用于数据聚合,不随 UI 文案变动 |
btn_label | string | 是(Click) | 按钮展示文案(英文),多态用 | 分隔 |
referrer_url | string | 否(自动注入) | 用户进入当前页面前的来源 URL,来自 document.referrer,SDK 自动采集,无需业务代码手动传 |
PageView 事件 4 个
触发时机:页面 onMounted,先调用 setTrackerInfo({ project_type, project_name }) 再调用 trackPageViewCollect(),无额外参数。
ℹ
加密 / 体育 / 世界三个列表页共用同一页面组件,project_name 由 activeCategory.slug 动态决定:slug 含 crypto → predictCrypto,含 sports → predictSports,含 world → predictWorld。
| project_name | project_type | 业务页面 | 路由(参考) |
predictCrypto | predict | 加密预测市场列表页 | /predict (slug: crypto-*) |
predictSports | predict | 体育预测市场列表页 | /predict (slug: sports-*) |
predictWorld | predict | 世界预测市场列表页 | /predict (slug: world-*) |
PredictionAccount | predict | 持仓账户页 | /predict/position |
⚠
StrategyPredictWarmUp 的 project_type 为 "Strategy",与其余页面的 "predict" 不同,注意不要写错。
Click 事件 14 个
调用方式:$tracker.trackBtnClickCollect({ btn_name, btn_label, ...extra })。卡片跳转(market_detail / match_detail)用 trackClickBeconCollect 防丢点。
列表页通用
platform: web+h5 · project_name: 不固定(由 slug 决定)
| event_name | 业务描述 | btn_type | btn_label | 扩展参数 |
switch_market_category |
L1 分类 Tab 切换(Crypto / Sports / World) H5 含 slug === activeSlug 去重 guard |
tab | slug(动态) |
category: slug |
my_prediction_orders |
点击首页 KvBanner 跳转持仓页 |
banner | My Prediction Orders |
— |
加密列表页
project_name: predictCrypto
| event_name | 业务描述 | btn_type | btn_label | 扩展参数 |
filter_crypto_asset |
加密资产 chip 筛选 watch(selectedChildId) 触发 |
button | assetSymbol(动态) |
asset: assetSymbol |
加密 & 世界列表页
project_name: predictCrypto / predictWorld
| event_name | 业务描述 | btn_type | btn_label | 扩展参数 |
market_detail |
点击 EventCard 进入详情(跳转,用 Beacon) |
card | event.title(动态) |
market_id: string
market_title: string |
trade_market_option |
EventCard 内直接选边下单 |
button | Yes | No |
market_id: string
side: "yes" | "no" |
体育列表页
project_name: predictSports
| event_name | 业务描述 | btn_type | btn_label | 扩展参数 |
switch_sport_filter |
体育二级大类 / 联赛筛选 H5 L2 由 onL2Click 上报;L3 Sheet 用 skipTracking=true 互斥去重 |
menu | 节点名(动态) |
filter_type: "sport_category" | "sport_league"
filter_value: node.slug
|
switch_market_type |
体育 Games / Props Tab 切换 |
tab | Games | Props |
market_type: "games" | "props" |
match_detail |
点击 GamesCard 进入比赛详情(跳转,用 Beacon) |
card | event.title(动态) |
market_id: string
market_title: string |
trade_match_option |
GamesCard 胜平负按钮点击 |
button | Home Win | Draw | Away Win |
match_id: event.eventId
side: "home_win" | "draw" | "away_win"
|
预测市场详情页
project_name: predictDetail
| event_name | platform | 业务描述 | btn_type | btn_label | 扩展参数 |
switch_trade_side |
web+h5 |
下单面板切换方向(普通 + Games 市场均触发) |
button | Yes | No | Draw |
side: "yes" | "no" | "draw" |
buy_position |
web+h5 |
点击下单提交按钮 |
button | Buy Yes | Buy No |
market_id: string
side: "yes" | "no"
amount: string |
持仓账户页
project_name: PredictionAccount
| event_name | platform | 业务描述 | btn_type | btn_label | 扩展参数 |
switch_prediction_position_tab |
web+h5 |
切换持仓 / 已结算 Tab |
tab | Current Holdings | Settled Events |
tab: "current_holdings" | "settled_events" |
sell_prediction_position |
web+h5 |
点击持仓列表中的 Sell 按钮 |
button | Sell |
market_id: string
market_title: string |
cancel_sell_position |
web |
关闭卖出弹窗 关闭按钮 vs 蒙层由 _suppressNextHide 状态机区分 |
button | Close |
close_source: "button" | "mask" |
cancel_sell_position |
h5 |
关闭卖出 SellSheet(取消 / 蒙层统一路径) |
button | Close |
close_source: "mask"(固定值) |
Callback 事件 2 个
调用方式:$tracker.trackCallbackCollect({ ret_code, ...extra }),在 POST /trade/buy / POST /trade/sell 响应后触发。ret_code = 0 表示成功,其余为失败,同步写入 result_status: "success" | "fail" 方便 BI 直接筛选。
| event_name | 触发时机 / 来源文件 | project_name | ret_code | 扩展参数 |
buy_order_result |
POST /trade/buy 响应后 usePredictPlaceOrder.ts |
predictDetail |
接口返回码(0=成功) |
market_id: string
side: "yes" | "no"
amount: string
result_status: "success" | "fail"
|
sell_order_result |
POST /trade/sell 响应后 usePredictPosition.ts |
PredictionAccount |
接口返回码(0=成功) |
market_id: string
result_status: "success" | "fail"
|
枚举值速查
| 值 | 适用事件 |
button | filter_crypto_asset / trade_market_option / trade_match_option / switch_trade_side / buy_position / sell_prediction_position / cancel_sell_position |
banner | my_prediction_orders |
tab | switch_market_category / switch_market_type / switch_prediction_position_tab |
menu | switch_sport_filter |
card | market_detail / match_detail |
| 值 | project_type | 对应页面 |
predictCrypto | predict | 加密预测列表 |
predictSports | predict | 体育预测列表 |
predictWorld | predict | 世界预测列表 |
predictDetail | predict | 预测市场详情页(下单面板) |
PredictionAccount | predict | 持仓账户页 |
| 事件 | side 可选值 |
trade_market_option(加密/世界) | "yes" | "no" |
switch_trade_side | "yes" | "no" | "draw" |
buy_position | "yes" | "no" |
trade_match_option(体育) | "home_win" | "draw" | "away_win" |
| 值 | 含义 |
"success" | 接口返回 ret_code = 0,下单成功 |
"fail" | 接口返回非 0 或抛出异常 |
| event_name | 参数 | 可选值 | 适用页面 |
filter_crypto_asset |
asset |
assetSymbol(动态取子分类 slug,如 bitcoin / ethereum / solana / ripple / micro-strategy) |
predictCrypto |
switch_sport_filter |
filter_type: "sport_category"
filter_value: node.slug |
"world-cup" | "football"(L2 大类) |
predictSports |
filter_type: "sport_league"
filter_value: node.slug |
"premier-league" | "champions-league" | "la-liga" | "ligue1" | "serie-a" | "mls" | "bundesliga"(L3 联赛) |
switch_market_type |
market_type |
"games" | "props" |
predictSports |
Tag 分类树(来自接口)
以下为 GET /ce/pm/v1/api/categories 返回的完整 CategoryNode 数据。filter_value 取 slug,category_id 取 id(传给 /event/list?categoryId),两者都需要随 filter_market 事件上报。
加密资产 slug: crypto-assets · id: 100
| filter_value(slug) | category_id(埋点值) | 中文名 | translateKey | marketCount |
bitcoin | 101 | 比特币 | pmBitcoin | 90 |
ethereum | 102 | 以太坊 | pmEthereum | 15 |
solana | 103 | 索拉纳 | pmSolana | 37 |
ripple | 104 | 瑞波 | pmRipple | 18 |
micro-strategy | 105 | 微策略 | pmMicroStrategy | 133 |
体育 slug: sports · id: 300
| 层级 | filter_value(slug) | category_id(埋点值) | 中文名 | filter_type |
| L2 大类 |
world-cup | 301 | 世界杯 |
sport_category |
| L2 大类 |
football | 302 | 足球 |
sport_category |
| └ L3 | premier-league | 30201 | 英超 | sport_league |
| └ L3 | champions-league | 30202 | 欧冠 | sport_league |
| └ L3 | la-liga | 30203 | 西甲 | sport_league |
| └ L3 | ligue1 | 30204 | 法甲 | sport_league |
| └ L3 | serie-a | 30205 | 意甲 | sport_league |
| └ L3 | mls | 30206 | 美职联 | sport_league |
| └ L3 | bundesliga | 30207 | 德甲 | sport_league |
世界 slug: world · id: 500
| filter_value(slug) | category_id(埋点值) | 中文名 | translateKey | marketCount |
trump | 501 | 特朗普 | pmTrump | 20 |
fed-interest-rate | 502 | 美联储利率 | pmFedInterestRate | 28 |
macro-indicators | 503 | 宏观指标 | pmMacroIndicators | 22 |
inflation | 504 | 通货膨胀 | pmInflation | 15 |
ℹ
体育 L4(各联赛下的 match / event 子类型,如 premier-league-match)当前埋点方案不区分到 L4,filter_type = "sport_league" 取 L3 slug 即可。若后续需要上报更细粒度,可新增 filter_sub_type 字段。
埋点验证手册
可直接交付测试同学使用的验证文档,覆盖 Web 和 H5 双端,包含正向验证(有上报)与反例场景(确认不上报)。
ℹ
测试环境准备
1. 打开浏览器 / 设备的埋点调试工具,过滤 project_type = predict
2. 确保账号已登录(持仓页相关事件需要登录态)
一、页面浏览(PageView)
| # | 验证步骤 | 预期上报 | project_name |
| PV-1 |
进入加密预测市场列表页 |
trackPageViewCollect |
predictCrypto |
| PV-2 |
进入体育预测市场列表页 |
trackPageViewCollect |
predictSports |
| PV-3 |
进入世界预测市场列表页 |
trackPageViewCollect |
predictWorld |
| PV-4 |
进入持仓账户页(/predict/position) |
trackPageViewCollect |
PredictionAccount |
ℹ
PV-1 / 2 / 3 是同一个列表页,切换顶部 Tab 时 project_name 随 slug 变化,不会重复上报相同分类。
二、列表页交互
| # | 验证步骤 | event_name | 关键字段 |
| C-1 |
点击顶部一级分类 Tab(Crypto / Sports / World) |
switch_market_category |
category: slug |
| C-2 |
点击首页 KvBanner「My Prediction Orders」按钮 |
my_prediction_orders |
btn_type: banner |
| C-3 |
加密列表页:点击资产 chip(BTC / ETH 等) |
filter_crypto_asset |
asset: assetSymbol |
| C-4 |
体育列表页:点击左侧运动分类或联赛 |
switch_sport_filter |
filter_type: sport_category 或 sport_league,filter_value: slug |
| C-5 |
体育列表页:点击 Games / Props Tab |
switch_market_type |
market_type: games 或 props |
| C-6 |
加密 / 世界列表页:点击事件卡片进入详情 |
market_detail |
market_id,market_title |
| C-7 |
加密 / 世界列表页:点击卡片内 Yes / No 按钮 |
trade_market_option |
market_id,side: yes 或 no |
| C-8 |
体育列表页:点击比赛卡片进入详情 |
match_detail |
market_id,market_title |
| C-9 |
体育列表页:点击比赛卡片内 Home Win / Draw / Away Win |
trade_match_option |
match_id,side: home_win 或 draw 或 away_win |
ℹ
C-4 H5 特殊说明:点击 L2 分类节点只上报 1 次 switch_sport_filter,展开后点击 L3 Sheet 子项也只上报 1 次,两者不叠加。
三、下单面板交互
| # | 验证步骤 | event_name | 关键字段 |
| C-10 |
下单面板中切换 Yes / No(普通市场) |
switch_trade_side |
project_name: predictDetail,side: yes 或 no |
| C-11 |
下单面板中切换 Home Win / Draw / Away Win(Games 市场) |
switch_trade_side |
project_name: predictDetail,side: home_win 或 draw 或 away_win |
| C-12 |
点击 Buy 提交下单按钮 |
buy_position |
project_name: predictDetail,market_id,side,amount |
| CB-1 |
下单成功后(接口返回) |
trackCallbackCollect |
project_name: predictDetail,result_status: success,ret_code: 0 |
| CB-2 |
下单失败后(接口返回) |
trackCallbackCollect |
project_name: predictDetail,result_status: fail,ret_code: 非 0 |
四、持仓页交互
| # | 验证步骤 | event_name | 关键字段 |
| C-15 |
点击「Current Holdings」/「Settled Events」Tab |
switch_prediction_position_tab |
tab: current_holdings 或 settled_events |
| C-16 |
点击持仓列表中的「Sell」按钮 |
sell_prediction_position |
market_id,market_title |
| C-17 |
Web:点击卖出弹窗内「Close」按钮关闭 |
cancel_sell_position |
close_source: button |
| C-18 |
Web:点击卖出弹窗蒙层关闭 |
cancel_sell_position |
close_source: mask |
| C-19 |
H5:任意方式关闭卖出 Sheet(取消 / 下拉 / 蒙层) |
cancel_sell_position |
close_source: mask(固定值) |
| CB-3 |
确认卖出后(接口返回成功) |
trackCallbackCollect |
project_name: PredictionAccount,result_status: success,ret_code: 0 |
| CB-4 |
确认卖出后(接口返回失败) |
trackCallbackCollect |
project_name: PredictionAccount,result_status: fail,ret_code: 非 0 |
⚠
C-17 / C-18 重要验证点:点击「Confirm」确认卖出后,弹窗自动关闭时不应上报 cancel_sell_position,仅触发 CB-3 / CB-4。
五、反例场景(确认不上报)
| # | 操作 | 预期:不上报 |
| N-1 |
列表页切换分类时,slug 未变化(同一 Tab 重复点击) |
switch_market_category 不重复上报 |
| N-2 |
H5 体育筛选 L2 → L3 联动时 |
switch_sport_filter 只上报 1 次,不叠加 2 次 |
| N-4 |
点击卖出弹窗「Confirm」确认成功后弹窗自动关闭 |
cancel_sell_position 不上报 |
4
PageView 用例
13
Click 用例
4
Callback 用例
3
反例场景
20
埋点事件总计