埋点专题 · 预测市场

预测市场
埋点规范

技术侧整理版本。涵盖 4 PV · 14 Click · 2 Callback,共 20 个有效埋点事件,新增 platform 字段区分 web / h5 差异行为。

导出埋点清单 CSV
project_type = predict SDK @region-lib/[email protected] 更新于 2026-05-27
4
PageView 事件
14
Click 事件
2
Callback 事件
20
总计有效事件

为什么要精简

产品原始需求表中存在重复事件(同一 btn_name 跨页面多次列出)和低价值事件(高频按键触发、被动关闭等)。全量照单实现会产生大量噪音,淹没真实转化信号,增加 BI 清洗成本。
合并
相同语义的事件用参数字段区分而非拆成多条。
例:体育二级大类与联赛筛选合并为 switch_sport_filter,通过 filter_type 区分层级。
删除
以下类型事件不单独埋点
· 被动关闭行为(可通过漏斗缺口反推)
· 纯 UI 偏好操作(如显示/隐藏资产)
· 高频输入事件(如金额每次按键)
复用
关键业务数据随 Callback 事件一并上报,不单独设立。
例:交易金额、市场 ID 随 trackCallbackCollect 的扩展字段携带,无需单独触发输入事件。

公共参数

所有事件均携带以下字段,通过 setTrackerInfo() 在页面 onMounted 时注入。

字段类型必填说明
project_typestring固定值 "predict"(Assets 导航页除外,为 "Assets"
project_namestring页面标识,见 PageView 表
btn_typestring是(Click)"button" | "banner" | "link" | "menu" | "tab" | "card"
btn_namestring是(Click)按钮英文 ID,用于数据聚合,不随 UI 文案变动
btn_labelstring是(Click)按钮展示文案(英文),多态用 | 分隔
referrer_urlstring否(自动注入)用户进入当前页面前的来源 URL,来自 document.referrer,SDK 自动采集,无需业务代码手动传

PageView 事件 4 个

触发时机:页面 onMounted,先调用 setTrackerInfo({ project_type, project_name }) 再调用 trackPageViewCollect(),无额外参数。

加密 / 体育 / 世界三个列表页共用同一页面组件,project_nameactiveCategory.slug 动态决定:slug 含 cryptopredictCrypto,含 sportspredictSports,含 worldpredictWorld
project_nameproject_type业务页面路由(参考)
predictCryptopredict加密预测市场列表页/predict (slug: crypto-*)
predictSportspredict体育预测市场列表页/predict (slug: sports-*)
predictWorldpredict世界预测市场列表页/predict (slug: world-*)
PredictionAccountpredict持仓账户页/predict/position
StrategyPredictWarmUpproject_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_typebtn_label扩展参数
switch_market_category L1 分类 Tab 切换(Crypto / Sports / World)
H5 含 slug === activeSlug 去重 guard
tabslug(动态) category: slug
my_prediction_orders 点击首页 KvBanner 跳转持仓页 bannerMy Prediction Orders
加密列表页 project_name: predictCrypto
event_name业务描述btn_typebtn_label扩展参数
filter_crypto_asset 加密资产 chip 筛选
watch(selectedChildId) 触发
buttonassetSymbol(动态) asset: assetSymbol
加密 & 世界列表页 project_name: predictCrypto / predictWorld
event_name业务描述btn_typebtn_label扩展参数
market_detail 点击 EventCard 进入详情(跳转,用 Beacon) cardevent.title(动态) market_id: string
market_title: string
trade_market_option EventCard 内直接选边下单 buttonYes | No market_id: string
side: "yes" | "no"
体育列表页 project_name: predictSports
event_name业务描述btn_typebtn_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 切换 tabGames | Props market_type: "games" | "props"
match_detail 点击 GamesCard 进入比赛详情(跳转,用 Beacon) cardevent.title(动态) market_id: string
market_title: string
trade_match_option GamesCard 胜平负按钮点击 buttonHome Win | Draw | Away Win match_id: event.eventId
side: "home_win" | "draw" | "away_win"
预测市场详情页 project_name: predictDetail
event_nameplatform业务描述btn_typebtn_label扩展参数
switch_trade_side web+h5 下单面板切换方向(普通 + Games 市场均触发) buttonYes | No | Draw side: "yes" | "no" | "draw"
buy_position web+h5 点击下单提交按钮 buttonBuy Yes | Buy No market_id: string
side: "yes" | "no"
amount: string
持仓账户页 project_name: PredictionAccount
event_nameplatform业务描述btn_typebtn_label扩展参数
switch_prediction_position_tab web+h5 切换持仓 / 已结算 Tab tabCurrent Holdings | Settled Events tab: "current_holdings" | "settled_events"
sell_prediction_position web+h5 点击持仓列表中的 Sell 按钮 buttonSell market_id: string
market_title: string
cancel_sell_position web 关闭卖出弹窗
关闭按钮 vs 蒙层由 _suppressNextHide 状态机区分
buttonClose close_source: "button" | "mask"
cancel_sell_position h5 关闭卖出 SellSheet(取消 / 蒙层统一路径) buttonClose 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_nameret_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"

枚举值速查

btn_type 枚举
适用事件
buttonfilter_crypto_asset / trade_market_option / trade_match_option / switch_trade_side / buy_position / sell_prediction_position / cancel_sell_position
bannermy_prediction_orders
tabswitch_market_category / switch_market_type / switch_prediction_position_tab
menuswitch_sport_filter
cardmarket_detail / match_detail
project_name 枚举
project_type对应页面
predictCryptopredict加密预测列表
predictSportspredict体育预测列表
predictWorldpredict世界预测列表
predictDetailpredict预测市场详情页(下单面板)
PredictionAccountpredict持仓账户页
side 枚举(各事件的方向字段)
事件side 可选值
trade_market_option(加密/世界)"yes" | "no"
switch_trade_side"yes" | "no" | "draw"
buy_position"yes" | "no"
trade_match_option(体育)"home_win" | "draw" | "away_win"
result_status 枚举(Callback 用)
含义
"success"接口返回 ret_code = 0,下单成功
"fail"接口返回非 0 或抛出异常
筛选事件枚举(filter_crypto_asset / switch_sport_filter / switch_market_type)
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(埋点值)中文名translateKeymarketCount
bitcoin101比特币pmBitcoin90
ethereum102以太坊pmEthereum15
solana103索拉纳pmSolana37
ripple104瑞波pmRipple18
micro-strategy105微策略pmMicroStrategy133

体育 slug: sports · id: 300

层级filter_value(slug)category_id(埋点值)中文名filter_type
L2 大类 world-cup301世界杯 sport_category
L2 大类 football302足球 sport_category
└ L3premier-league30201英超sport_league
└ L3champions-league30202欧冠sport_league
└ L3la-liga30203西甲sport_league
└ L3ligue130204法甲sport_league
└ L3serie-a30205意甲sport_league
└ L3mls30206美职联sport_league
└ L3bundesliga30207德甲sport_league

世界 slug: world · id: 500

filter_value(slug)category_id(埋点值)中文名translateKeymarketCount
trump501特朗普pmTrump20
fed-interest-rate502美联储利率pmFedInterestRate28
macro-indicators503宏观指标pmMacroIndicators22
inflation504通货膨胀pmInflation15
体育 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_leaguefilter_value: slug
C-5 体育列表页:点击 Games / Props Tab switch_market_type market_type: games 或 props
C-6 加密 / 世界列表页:点击事件卡片进入详情 market_detail market_idmarket_title
C-7 加密 / 世界列表页:点击卡片内 Yes / No 按钮 trade_market_option market_idside: yes 或 no
C-8 体育列表页:点击比赛卡片进入详情 match_detail market_idmarket_title
C-9 体育列表页:点击比赛卡片内 Home Win / Draw / Away Win trade_match_option match_idside: 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: predictDetailside: yes 或 no
C-11 下单面板中切换 Home Win / Draw / Away Win(Games 市场) switch_trade_side project_name: predictDetailside: home_win 或 draw 或 away_win
C-12 点击 Buy 提交下单按钮 buy_position project_name: predictDetailmarket_idsideamount
CB-1 下单成功后(接口返回) trackCallbackCollect project_name: predictDetailresult_status: successret_code: 0
CB-2 下单失败后(接口返回) trackCallbackCollect project_name: predictDetailresult_status: failret_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_idmarket_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: PredictionAccountresult_status: successret_code: 0
CB-4 确认卖出后(接口返回失败) trackCallbackCollect project_name: PredictionAccountresult_status: failret_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 埋点事件总计