事件规范

8 类实体,185 个事件。

每个事件先问:它碰到哪几类实体?碰到谁,就必须带谁的连接键。字段名一律以 Lexicon 为准。

打个比方

连接键像快递单号。下单、付款、到账,凭同一个单号串起来。

人distinct_id / account_id设备device_id订单order_id支付服务payment_attempt_id模型服务attempt_id / job_id网络服务request_id模块互动session_id / page_view_id用户输入conversation_id / message_idorder_idmessage_id→attempt_idrequest_id
■ 蓝 = 主线 / 已定■ 黄 = 连接键 / 待定■ 灰 = 说明

每类实体:Lexicon 已有 / 提议新增

实体Lexicon 已有字段提议新增字段相关事件已带连接键缺口
人41718514639
设备1021851850
订单751742402
支付服务17023185
模型服务322753530
网络服务19542411
模块互动76221221220
用户输入和互动502049472
其他(meta)6462

缺口事件在下方卡片里用黄色"缺"标出。

三方对账

来源事件数说明
Mixpanel Lexicon(4072898)146基准。本规范 146 个全部覆盖,Lexicon 列出的字段一个不少
代码目录 v1.7155vpn/js 事件注册表(109 客户端 + 46 服务端)
D7 文档146其中 123 个也在代码里,23 个只在文档
本方案合计185Lexicon 146 + 提议 39

8 类实体字段

每个字段写清谁写、怎么写、怎么保护。

人 · 连接键 distinct_id / account_id

Lexicon 已有 41 个字段,提议新增 7 个。146/185 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
distinct_idLexiconstringacc_9f2必填客户端事件(identify 后 = account_id)普通146 个
account_id / user_id / canonical_user_idLexiconstringacc_9f2登录后必填服务端事件 + profile set_once普通146 个
$email / emailLexiconstringa***@gmail.com可选服务端profile set敏感:只存打码值(待确认)146 个
$nameLexiconstringMia可选服务端profile set只存昵称0 个
phone_masked提议string+1 ***-***-0123可选服务端profile set敏感:只存后 4 位0 个
auth_methodLexiconstringgoogle必填服务端profile set_once(即 signup_method)普通7 个
registered_atLexicondatetime2026-10-29T08:00Z必填服务端profile set_once(即 signup_at)普通2 个
first_acquisition_channelLexiconstringtiktok可选服务端profile set_once(首次 UTM)普通0 个
referrer_domainLexiconstringgoogle.com可选客户端事件;首值 set_once普通1 个
country / region提议stringUS必填服务端profile setIP 推导0 个
last_locale / localeLexiconstringen必填客户端profile set普通146 个
gender_preference提议stringfemale可选服务端profile set普通1 个
age_gate_at提议datetime2026-10-29T08:01Z必填服务端profile set_once普通0 个
current_planLexiconstringpremium必填服务端profile set(即 plan)普通0 个
current_entitlement_end_atLexicondatetime2026-11-28条件服务端profile set(即 plan_expires_at)普通0 个
coin_balance提议integer950必填服务端profile set普通1 个
lifetime_paid_usd提议number19.99必填服务端profile increment(只加实付,排除 is_test)普通0 个
first_payment_atLexicondatetime2026-10-29条件服务端profile set_once普通0 个
last_paid_at提议datetime2026-10-29条件服务端profile set普通0 个
paid_order_count提议integer1必填服务端profile increment普通0 个
has_successful_paymentLexiconbooleantrue必填服务端profile set普通0 个
is_testLexiconbooleantrue必填服务端profile set + 事件(旧名 is_sandbox 已弃用)普通150 个
invitation_idLexiconstringinv_1可选服务端profile set_once(即 invite_code)普通5 个
inviter_user_idLexiconstringacc_11可选服务端profile set_once普通3 个
ai_cluster_* / label_version提议stringai_cluster_topic=romance / v1可选(以后)后端回写profile set以后可选;只写标签,不写原文0 个

白话:profile 是贴在人身上的标签。set 会覆盖,set_once 只写第一次,increment 累加。

设备 · 连接键 device_id

Lexicon 已有 10 个字段,提议新增 2 个。185/185 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
device_id / $device_idLexiconstringd_8a1自动客户端事件普通146 个
cookie_idLexiconstringc_2自动客户端事件 + profile普通146 个
uaLexiconstringMozilla/5.0 …必填客户端/服务端事件 + profile set普通;即 user_agent157 个
$browser / $browser_version / $osLexiconstringChrome / 130 / iOS自动SDK事件普通0 个
os_version提议string18.1可选由 ua 解析事件普通0 个
device_type提议stringmobile必填客户端事件普通0 个
$screen_width / $screen_heightLexiconinteger390 / 844自动SDK事件普通0 个
platformLexiconstringpwa必填客户端事件 + super property(web / pwa / app)普通146 个
app_version / app_build_id / sdk_versionLexiconstring2026.10.29-a1必填客户端super property普通147 个
ip_addressLexiconstring203.0.113.4自动服务端事件 + profile敏感;Mixpanel 用它推导地区146 个
$city / mp_country_code提议stringUS自动MixpanelIP 推导代理需转发真实 IP(待确认)0 个

订单 · 连接键 order_id

Lexicon 已有 75 个字段,提议新增 17 个。40/42 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
order_idLexiconstringord_7f3必填服务端事件普通37 个
checkout_id / quote_idLexiconstringchk_12条件客户端/服务端事件普通30 个
order_statusLexiconstringpaid必填服务端事件普通17 个
order_items / order_item_idLexiconlist / string[…]条件服务端事件普通3 个
product_idLexiconstringpremium_month必填服务端事件(即 sku)普通13 个
plan_id / coin_pack_idLexiconstringpremium / coins_1000条件服务端事件普通20 个
order_amount_minor / amount_minorLexiconinteger1999必填服务端事件(即 amount;分为单位)普通10 个
currency / currency_exponentLexiconstring / integerUSD / 2必填服务端事件普通16 个
coin_quantityLexiconinteger1000条件服务端事件(即 coins)普通19 个
quota_type / quota_remainingLexiconstring / integermessages / 0条件服务端quota_blocked普通1 个
checkout_startedcheckout_idorder_createdorder_idpayment_succeeded / failedpayment_attempt_idorder_paidtransaction_idcredits_granted / 权益order_id全程同一个 order_id

支付服务 · 连接键 payment_attempt_id

Lexicon 已有 17 个字段,提议新增 0 个。18/23 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
payment_attempt_idLexiconstringpa_3必填服务端事件(即 payment_id)普通23 个
payment_providerLexiconstringxsdk必填服务端事件(即 payment_channel)普通24 个
transaction_id / provider_charge_idLexiconstringtxn_99条件服务端(回调)事件(即 provider_txn_id)普通10 个
provider_event_idLexiconstringevt_1条件服务端(回调)事件普通3 个
payment_statusLexiconstringsucceeded必填服务端事件普通2 个
payment_method_idLexiconstringpm_1可选服务端事件普通3 个
error_codeLexiconstringcard_declined条件服务端事件普通35 个
is_testLexiconbooleantrue必填服务端事件(旧名 is_sandbox 已弃用;收入排除 true)普通150 个

模型服务 · 连接键 attempt_id

Lexicon 已有 32 个字段,提议新增 27 个。53/53 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
attempt_idLexiconstringatt_1必填服务端事件(即 task_id,取餐号)普通53 个
operation_type / operation_idLexiconstringchat / msg_5必填服务端事件普通3 个
providerLexiconstringbyteplus必填服务端事件(byteplus / aws_bedrock)普通5 个
model_id / model_config_versionLexiconstringseed-1.6必填服务端事件普通7 个
billing_account提议stringbyteplus-dev-01必填服务端事件普通1 个
input_tokens / output_tokens / cache_tokensLexiconinteger820 / 140 / 0必填服务端事件普通3 个
media_seconds提议number5条件服务端事件(视频)普通1 个
started_at / ended_at / first_output_atLexicondatetime…必填服务端事件普通4 个
attempt_status / finish_reason / error_codeLexiconstringok / stop必填服务端事件普通36 个
cost_kind / charge_amount_minor / cost_currencyLexiconstring / integertoken / 3条件服务端model_charge_posted(扣费记录,优先)普通1 个

模型返回(子表)

原文不进 Mixpanel。原文在你们后端,用 message_id / attempt_id / response_id 回查。

字段Lexicon类型例子必填来源带它的事件说明
response_id提议stringresp_1必填服务端三个都带
message_idLexiconstringmsg_6条件服务端chat_reply_completed, model_attempt_finished和 AWS 原文按 message_id / attempt_id 关联
finish_reasonLexiconstringstop必填服务端三个都带stop / length / filter / error
output_chars提议integer420必填服务端三个都带
output_tokensLexiconinteger140必填服务端三个都带
time_to_first_token_ms提议integer900必填服务端三个都带由 started_at、first_output_at 算出
total_latency_ms提议integer2300必填服务端三个都带
stream_chunks提议integer35可选服务端chat_reply_completed, model_attempt_finished
language_detected提议stringen可选服务端chat_reply_completed, model_attempt_finished
safety_filtered提议booleanfalse必填服务端三个都带
safety_category提议stringnone条件服务端三个都带被过滤时必填
refusal提议booleanfalse必填服务端三个都带
truncated提议booleanfalse必填服务端三个都带
retry_count提议integer0必填服务端三个都带
fallback_model_used提议string条件服务端三个都带代码有 fallback_tier,待确认是否同义
output_countLexiconinteger4条件服务端generation_completed, model_attempt_finished图片/视频
resolution提议string1024x1024条件服务端generation_completed, model_attempt_finished
duration_s提议number5条件服务端generation_completed, model_attempt_finished视频
format提议stringmp4条件服务端generation_completed, model_attempt_finished
nsfw_score_bucket提议string0-0.2条件服务端generation_completed, model_attempt_finished只记分档
response_contains_media提议booleanfalse可选服务端chat_reply_completed
response_contains_cta提议booleanfalse可选服务端chat_reply_completed回复里有没有引导付费或生图
persona_consistency提议stringconsistent可选(以后)后端离线表以后可选;由你们后端分桶得出

质量信号:

信号怎么拿
user_regeneratedmessage_regenerated 事件(带 regeneration_reason、parent_message_id)
user_liked / user_disliked代码有 liked / unliked,待确认挂在哪个事件
copied代码有 copied,待确认事件名
continued_chat_within_60sBI 计算:回复后 60 秒内有 chat_submitted

网络服务 · 连接键 request_id

Lexicon 已有 19 个字段,提议新增 5 个。41/42 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
request_id / parent_request_idLexiconstringreq_4c必填客户端/服务端事件普通27 个
trace_id / span_idLexiconstringtr_1可选服务端事件普通146 个
endpoint提议string/api/v1/chat必填服务端事件(只记路由模板)普通0 个
http_status提议integer502条件服务端事件普通0 个
latency_ms提议integer2300必填客户端/服务端事件普通4 个
retry_count提议integer1可选客户端事件普通3 个
connection_type提议string4g可选客户端事件普通0 个
via_proxy提议booleantrue可选客户端super property(是否经 t.peersoft.ai)普通0 个
error_stage / error_codeLexiconstringupstream / timeout条件客户端/服务端事件普通35 个
client_clock_offset_ms / ingested_atLexiconinteger / datetime-120自动服务端事件普通146 个

模块互动 · 连接键 page_view_id / impression_id

Lexicon 已有 76 个字段,提议新增 22 个。122/122 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
session_idLexiconstringsess_1必填客户端事件普通146 个
page_view_id / page_pathLexiconstringpv_21必填客户端事件普通146 个
app_surface / discovery_surface / media_surfaceLexiconstringhome_grid条件客户端事件普通33 个
impression_id / positionLexiconstring / integerimp_3 / 3条件客户端事件普通16 个
interaction_id / event_sequenceLexiconstring / integerint_9 / 14必填客户端事件普通148 个
visible_duration_ms / visible_ratioLexiconinteger / number4200 / 0.8条件客户端事件(曝光、停留)普通1 个
entry_pointLexiconstringhome条件客户端事件普通7 个

用户输入和互动 · 连接键 conversation_id / message_id

Lexicon 已有 50 个字段,提议新增 20 个。47/49 个相关事件已带连接键。

字段Lexicon类型例子必填来源写法隐私带它的事件
conversation_idLexiconstringconv_8必填客户端/服务端事件普通35 个
message_id / parent_message_idLexiconstringmsg_5条件客户端/服务端事件普通32 个
turn_idLexiconstringturn_12必填客户端/服务端事件普通18 个
turn_index提议integer4必填服务端事件普通32 个
query提议stringromance条件客户端事件敏感:先打码邮箱/电话/卡号/证件号,≤200 字1 个
query_length / input_lengthLexiconinteger12必填客户端事件普通3 个
prompt_length提议integer80条件客户端事件prompt 原文不进 Mixpanel1 个
chat_input_mode / input_sourceLexiconstringtext必填客户端事件(即 input_method)普通13 个
query_revisionLexiconinteger2可选客户端事件(编辑次数)普通11 个
regeneration_reasonLexiconstringuser_retry条件客户端事件普通3 个
对话conversation_id1 对多轮次message_id · turn_indexassistant 轮模型返回response_id · attempt_id

对话 conversation

字段Lexicon类型例子必填说明
conversation_idLexiconstringconv_8必填
character_idLexiconstringchar_3必填
conversation_type提议stringmulti必填single / multi / group
conversation_started_at提议datetime2026-10-29T08:02Z必填即 started_at
entry_pointLexiconstringhome_grid必填即 entry_source

轮次 turn

字段Lexicon类型例子必填说明
turn_idLexiconstringturn_12必填
turn_index提议integer4必填1..n
turn_role提议stringuser必填user / assistant
parent_message_idLexiconstringmsg_11条件即 parent_turn_id
is_first_turn提议booleanfalse必填
previous_turn_gap_s提议number18条件和上一轮的间隔

对话汇总

字段Lexicon类型例子必填说明
turns_so_far提议integer8必填
user_turns / assistant_turns提议integer4 / 4必填
conversation_duration_s提议number310必填
is_deep提议booleanfalse必填turn_index ≥ N(推荐默认 10)
ended_reason提议stringleft必填left / limit / paywall / error / switch_character
last_turn_index提议integer8必填

白话:每个聊天事件都带 conversation_id、message_id、turn_index。所以单轮还是多轮、第 N 轮掉多少人、北极星,都能直接算。

全部事件

搜事件名、中文名或字段。

列表按需加载 spec.json,首屏不卡。

加载中…(直接双击打开文件时,浏览器可能拦住加载,请用 http 服务打开)

事件 CSV(含 8 个实体列) · 字段 CSV(含 lexicon_status) · Markdown · 需求 CSV

名词表

名词白话和例子
事件用户做的一件事被记下来。像收银小票上的一行。
属性这件事的细节。像小票上的价格和时间。
实体被记录的一类东西。像学校里的"学生""班级""课程"。
用户属性(profile)贴在人身上的标签,会被更新。像会员卡上的等级。
set / set_once / increment改写 / 只写第一次 / 累加。像改地址 / 记生日 / 积分加一。
连接键把两张表连起来的编号。像快递单号连起下单、发货、签收。
LexiconMixpanel 里的字段字典。像词典,名字和类型以它为准。

事件规范 签字

确认人:研发 · 产品

意见:______________________

打印后勾选。本页不收集数据。