ae-generate-tracking-plan
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseae-generate-tracking-plan
ae-generate-tracking-plan
Conversation language: This skill document is in English, but all output to the user MUST be in the user's input language. English input → English reply; Chinese input → Chinese reply; Japanese input → Japanese reply. If uncertain, default to English. This applies to all output: section titles, phase names, template prompts, example text, option lists, etc. ⚠️ CRITICAL: Template localization is CLI-owned. Do NOT manually translate imported template content with the model. Use themodule as the source of truth by settingsrc/tracking/i18n, writingAE_LANG=<user_lang>, and regenerating throughdraft.meta.lang/ae-cli tracking code import-template. Before changing any template-owned localized label, first look up the corresponding translation inae-cli tracking plan draft(for examplesrc/tracking/i18n,resources/xlsx/sheets.ts,resources/xlsx/headers.ts, andresources/xlsx/types.ts). If no matching translation exists there, preserve the imported text and ask before rewriting business semantics. Do NOT copy Chinese text verbatim from this document into English/Japanese replies unless it is an identifier, template name needed for CLI import, or original source material quoted for traceability.resources/cli/*.json
对话语言:本技能文档为英文,但所有输出给用户的内容必须使用用户输入的语言。英文输入→英文回复;中文输入→中文回复;日文输入→日文回复。若不确定,默认使用英文。此规则适用于所有输出:章节标题、阶段名称、模板提示、示例文本、选项列表等。 ⚠️ 重要提示:模板本地化由CLI负责。请勿使用模型手动翻译导入的模板内容。通过设置、编写AE_LANG=<user_lang>并通过draft.meta.lang/ae-cli tracking code import-template重新生成,以ae-cli tracking plan draft模块为唯一可信来源。 在更改任何模板所属的本地化标签之前,请先在src/tracking/i18n中查找对应的翻译(例如src/tracking/i18n、resources/xlsx/sheets.ts、resources/xlsx/headers.ts和resources/xlsx/types.ts)。如果没有找到匹配的翻译,请保留导入的文本,并在重写业务语义前询问用户。 除非是CLI导入所需的标识符、模板名称或为可追溯性引用的原始素材,否则请勿将本文档中的中文文本直接复制到英文/日文回复中。resources/cli/*.json
Terminology Glossary
术语对照表
| 中文 | English | Notes |
|---|---|---|
| 埋点方案 | Tracking Plan | AE project-level event & property definitions |
| 埋点模板 | Tracking Plan Template | Pre-built industry/genre xlsx templates |
| 方案名称 | Plan Name | User-facing plan identifier |
| 应用场景 | Application Scenario | One-sentence description of what the app does |
| 素材来源 | Source Material Type | prd / chat / codebase / template |
| 业务维度 | Business Dimension | Revenue model, core loop, functional entries, currency system |
| 收入模型 | Revenue Model | IAA / IAP / mixed / subscription / commission |
| 核心循环 | Core Loop | Core gameplay loop (e.g. "grind stages → earn coins → gacha for heroes") |
| 功能入口 | Functional Entry | Stage, shop, guild, leaderboard, task, achievement, etc. |
| 货币体系 | Currency System | Hard currency (diamonds), soft currency (gold), etc. |
| 事件 | Event | Named user action or system occurrence ( |
| 事件属性 | Event Property | Data attached to an event ( |
| 公共事件属性 | Common/Super Property | Property attached to every event automatically. ⚠️ The correct Chinese AE term is "公共事件属性" or "公共属性". Never translate "Super Property" as "超级属性" — that is NOT a valid AE term. |
| 用户属性 | User Property | Property on the user profile (persistent state) |
| 预置属性 | Preset Property | System property prefixed with |
| 自动采集事件 | Auto-track Event | SDK auto-collected events ( |
| 系统事件 | System Event | event_tag value reserved for SDK auto-track events ( |
| 基础事件 | Basic | event_tag value for account-level lifecycle/progression events (register, login, level_up, create_role, etc.). Not tied to any functional module. |
| 功能模块 | Functional Module | event_tag value for feature-specific business events; identifies which module the event belongs to (e.g. Battle, Shop, Ads, Payment, Basic) |
| SDK 集成模式 | SDK Integration Mode | |
| 客户端平台 | Client Platform | Android, iOS, Web, Unity, Mini-program, etc. |
| 服务端语言 | Server Language | Java, Python, Go, Node.js, PHP, etc. |
| 用户体系 | User Identity System | distinct_id strategy + account_id source |
| 访客 ID | Visitor ID / Distinct ID | Anonymous identity before login |
| 账号 ID | Account ID | Identified user after login |
| 插入 | Insert | Direct code injection into project |
| 片段 | Snippet | Code delivered as standalone files |
| 对象组 | Object Array ( | |
| 对象 | Object ( | |
| 校验 | Validation | Draft rule checking before xlsx generation |
| 上传 | Upload | Pushing the xlsx tracking plan to AE |
| 追加 | Append | Adding new events/properties to an existing plan |
| 替换 | Replace | Deleting existing plan and uploading a new one |
| 冲突检测 | Conflict Detection | Detecting type mismatches and duplicate events before upload |
| 归档 | Archive | Copying final draft.xlsx to |
| xlsx 格式契约 | xlsx Format Contract | Column rules for AE-compatible Excel generation |
| draft.json | draft.json | Internal intermediate representation (JSON) of the tracking plan |
| display_name | Display Name | Human-readable name in the user's language |
| event_tag | Event Tag | Functional module the event belongs to (e.g. Battle, Shop, Ads, Payment). Auto-track events use "System Event". |
| snake_case | snake_case | Canonical naming format: |
| 中文 | English | 说明 |
|---|---|---|
| 埋点方案 | Tracking Plan | AE项目级事件与属性定义 |
| 埋点模板 | Tracking Plan Template | 预构建的行业/品类Excel模板 |
| 方案名称 | Plan Name | 用户可见的方案标识符 |
| 应用场景 | Application Scenario | 应用业务场景的一句话描述 |
| 素材来源 | Source Material Type | prd / chat / codebase / template |
| 业务维度 | Business Dimension | 收入模型、核心循环、功能入口、货币体系 |
| 收入模型 | Revenue Model | IAA / IAP / mixed / subscription / commission |
| 核心循环 | Core Loop | 核心业务流程(例如:"刷关卡→赚金币→抽卡获取英雄") |
| 功能入口 | Functional Entry | 关卡、商店、公会、排行榜、任务、成就等 |
| 货币体系 | Currency System | 硬通货(钻石)、软通货(金币)等 |
| 事件 | Event | 命名的用户操作或系统行为( |
| 事件属性 | Event Property | 附加到事件的数据( |
| 公共事件属性 | Common/Super Property | 自动附加到所有事件的属性。⚠️ AE官方中文术语为「公共事件属性」或「公共属性」,请勿将"Super Property"翻译为「超级属性」——这不是有效的AE术语。 |
| 用户属性 | User Property | 用户档案上的属性(持久化状态) |
| 预置属性 | Preset Property | 以 |
| 自动采集事件 | Auto-track Event | SDK自动采集的事件( |
| 系统事件 | System Event | 为SDK自动采集事件保留的 |
| 基础事件 | Basic | 账号全生命周期/成长事件(注册、登录、升级、创建角色等)的 |
| 功能模块 | Functional Module | 特定功能业务事件的 |
| SDK 集成模式 | SDK Integration Mode | |
| 客户端平台 | Client Platform | Android、iOS、Web、Unity、小程序等 |
| 服务端语言 | Server Language | Java、Python、Go、Node.js、PHP等 |
| 用户体系 | User Identity System | distinct_id策略 + account_id来源 |
| 访客 ID | Visitor ID / Distinct ID | 登录前的匿名身份 |
| 账号 ID | Account ID | 登录后的已识别用户身份 |
| 插入 | Insert | 直接将代码注入项目 |
| 片段 | Snippet | 以独立文件形式交付的代码 |
| 对象组 | Object Array ( | |
| 对象 | Object ( | |
| 校验 | Validation | 生成Excel前的草稿规则检查 |
| 上传 | Upload | 将Excel埋点方案推送到AE平台 |
| 追加 | Append | 向现有方案添加新的事件/属性 |
| 替换 | Replace | 删除现有方案并上传新方案 |
| 冲突检测 | Conflict Detection | 上传前检测类型不匹配和重复事件 |
| 归档 | Archive | 将最终draft.xlsx复制到 |
| xlsx 格式契约 | xlsx Format Contract | 兼容AE的Excel生成列规则 |
| draft.json | draft.json | 埋点方案的内部中间表示(JSON格式) |
| display_name | Display Name | 用户语言下的可读名称 |
| event_tag | Event Tag | 事件所属的功能模块(例如:Battle、Shop、Ads、Payment)。自动采集事件使用"System Event"。 |
| snake_case | snake_case | 标准命名格式: |
When to Trigger
触发时机
Trigger when user mentions: "tracking plan / tracking template / AE plan / help me create tracking" etc.
App types covered: H5 / Web / iOS / Android / Mini-program / Unity. Follow strictly
Phase 0 → 1 → 2 → 3 → 4, do not skip steps.
Phase 1 / 3 / 4 are executed viaCLI (ae-cli tracking/ae-cli tracking plan draft/ae-cli auth login/ae-cli tracking plan upload). All CLI commands must be prefixed withae-cli tracking plan delete(e.g.AE_LANG=<user_lang>), ensuring CLI output messages and generated xlsx headers match the user's language. Upload commands MUST also passAE_LANG=en ae-cli tracking plan draft ...so the server parses the uploaded xlsx with the same sheet/header language.--lang <user_lang>Language rules: For newly generated content, user-facing fields in draft.json (,display_name,event_desc, propertyevent_tag, propertydisplay_name, etc.) should be generated in the user's input language. Every event, event property, common event property, and user property must have a non-emptydesc. A canonical snake_case identifier is not a substitute for a user-facing display name. For imported templates, do NOT translate those fields manually. Template sheet names, headers, property type display values, CLI messages, and auto-track/i18n-owned labels must come fromdisplay_nameviasrc/tracking/i18nandAE_LANG=<user_lang>. When a localized label is needed, inspectdraft.meta.langand use the existing resource key/value; do not invent translations from the model. If template business text needs localization and the CLI/i18n resources do not provide it, preserve the imported text and ask the user before rewriting business semantics. Only identifier fields likesrc/tracking/i18n,event_nameremain in English snake_case (canonical format). This skill only cares about command behavior, not internal implementation.prop_name
当用户提及以下内容时触发:"tracking plan / tracking template / AE plan / help me create tracking"等。
支持的应用类型:H5 / Web / iOS / Android / 小程序 / Unity。严格遵循阶段0→1→2→3→4的流程,不得跳过步骤。
阶段1/3/4通过CLI执行(ae-cli tracking/ae-cli tracking plan draft/ae-cli auth login/ae-cli tracking plan upload)。 所有CLI命令必须添加ae-cli tracking plan delete前缀(例如:AE_LANG=<user_lang>), 确保CLI输出信息和生成的Excel表头与用户语言一致。 上传命令还必须传递AE_LANG=en ae-cli tracking plan draft ...,以便服务器使用相同的工作表/表头语言解析上传的Excel。--lang <user_lang>语言规则:对于新生成的内容,draft.json中面向用户的字段(、display_name、event_desc、 属性event_tag、属性display_name等)应使用用户输入的语言生成。 每个事件、事件属性、公共事件属性和用户属性必须包含非空的desc。 标准snake_case标识符不能替代面向用户的显示名称。 对于导入的模板,请勿手动翻译这些字段。模板工作表名称、表头、属性类型显示值、 CLI消息以及自动采集/i18n所属标签必须通过display_name和AE_LANG=<user_lang>从draft.meta.lang获取。 当需要本地化标签时,检查src/tracking/i18n并使用现有资源键/值;不得通过模型自行生成翻译。 如果模板业务文本需要本地化但CLI/i18n资源未提供,请保留导入的文本并在重写业务语义前询问用户。 只有src/tracking/i18n、event_name等标识符字段保留英文snake_case格式(标准格式)。 本技能仅关注命令行为,不涉及内部实现。prop_name
Phase 0 — Anchor (one question per message)
阶段0 — 锚点(每次消息一个问题)
Step 1: Language initializationDeterminefrom user's input language: Chinese→<user_lang>, English→zh, Japanese→en, Korean→ja. Other languages default toko. All subsequent CLI commands must be prefixed withento ensure CLI output and generated xlsx headers match the user's language. When uploading the xlsx, passAE_LANG=<user_lang>as well; it must match--lang <user_lang>/ the generated xlsx language.draft.meta.lang
Collect the following 5 items sequentially, do NOT ask all at once:
步骤1:语言初始化根据用户输入语言确定:中文→<user_lang>,英文→zh,日文→en,韩文→ja,其他语言默认ko。 后续所有CLI命令必须添加en前缀,确保CLI输出和生成的Excel表头与用户语言一致。 上传Excel时,还需传递AE_LANG=<user_lang>;该值必须与--lang <user_lang>/生成的Excel语言匹配。draft.meta.lang
按顺序收集以下5项信息,不得一次性全部询问:
Item 1 — Application Scenario
项1 — 应用场景
Ask: "What is your application's business scenario? One sentence summary, e.g.: An e-commerce website where users browse products and place orders"
After user responds, record to and generate .
meta.scenariometa.plan_name询问:"你的应用业务场景是什么?请用一句话概括,例如:用户可浏览商品并下单的电商网站"
用户回复后,记录到并生成。
meta.scenariometa.plan_nameItem 2 — Source Material + Business Dimension (combined)
项2 — 素材来源 + 业务维度(合并询问)
Before asking, decide whether the current runtime is an agent sandbox. The agent may judge this from runtime context such as sandbox-provisioned , restricted filesystem access, or absence of the user's local files. Do not ask the user just to decide sandbox visibility.
cli-token.jsonProduct document is available in sandbox environments only for files that are readable inside the sandbox workspace, including files the user attaches/uploads into the conversation workspace. It cannot read arbitrary local paths outside the sandbox unless those files are mounted or attached. Codebase is a local-material option and must be hidden in sandbox environments unless the codebase is already present in the readable workspace. When options are hidden, renumber the visible list contiguously from 1; never show skipped numbers.
If not in a sandbox environment, ask exactly:
text
Choose your source material (up to 2):
1 - Product document (local path, image file, or folder) — Extract events and properties from product docs; supports md/pdf/docx/URL/images (png/jpg/jpeg/webp)
2 - Detailed description (conversational) — Describe app business flow, core features, user behaviors, monetization model, etc.
3 - Codebase (local project path; hidden in sandbox) — Analyze source code to extract events and properties
4 - Pre-built template (built-in industry and game genre templates) — Select a built-in template
5 - Modify existing tracking plan (local AE format xlsx file) — Import an existing tracking plan xlsx as baseline for modification; can be combined with Product doc / Description / Codebase, but NOT with Pre-built template
Reply with number(s), e.g. 1,5 or 4. Select up to 2.If in a sandbox environment, ask exactly:
text
Choose your source material (up to 2):
1 - Product document (sandbox workspace path, uploaded attachment, URL, image file, or folder) — Extract events and properties from product docs; supports md/pdf/docx/URL/images (png/jpg/jpeg/webp). You can attach/upload relevant files here.
2 - Detailed description (conversational) — Describe app business flow, core features, user behaviors, monetization model, etc.
3 - Pre-built template (built-in industry and game genre templates) — Select a built-in template
4 - Modify existing tracking plan (sandbox workspace path) — Import an existing tracking plan xlsx as baseline for modification; can be combined with Product doc / Description, but NOT with Pre-built template
Reply with number(s), e.g. 1,4 or 3. Select up to 2.Do not rewrite this source material list as unnumbered bullets, cards, or prose. The user must be able to reply with the visible numbers.
When translating this prompt, preserve the numeric prefixes and line breaks exactly. Every visible option MUST be on its own line and MUST begin with , , , etc. Never place two numbered options in the same paragraph or visual line. If a Markdown renderer may collapse soft line breaks, use Markdown hard line breaks (two trailing spaces before newline) rather than blank lines. Translation may change only the option text, not the numbering prefix or one-option-per-line structure.
1 -2 -3 -User can multi-select (max 2). Interpret numbers by the visible list shown to the user, not by the non-sandbox canonical list.
Canonical source material options (non-sandbox numbering):
- Product document ****(****local path, sandbox workspace path, uploaded attachment, URL, image file, or folder) — Extract events and properties from product docs; supports md/pdf/docx/URL/images (png/jpg/jpeg/webp)
- Detailed description (conversational) — Describe app business flow, core features, user behaviors, monetization model, etc.
- Codebase (local project path; hidden in sandbox) — Analyze source code to extract events and properties
- Pre-built template (built-in industry and game genre templates) — Select a built-in template (run to see available templates)
AE_LANG=<user_lang> ae-cli tracking plan list-templates --json
Based on user selection, determine source material type and record to :
meta.source_type| Selection | source_type | Handling |
|---|---|---|
| Product doc only | | Read product docs (text/images), extract events and properties |
| Description only | | Construct events in Draft phase based on description |
| Codebase only | | Scan source code, extract events/properties from business logic |
| Template only | | Provide built-in template selection |
| Existing plan only | | Import xlsx as baseline (see "Modify Existing Tracking Plan Flow" below) |
| Any two-item combo | Join two types with | First as baseline, second as supplement (priority: existing_plan → template → codebase → prd → chat) |
| Existing plan + Pre-built template | NOT allowed | Both provide event baselines; semantic conflict |
Follow-up questions (ask in follow-up order defined in Multi-Source Combination Rules below):
- Product doc → if not in a sandbox environment, ask exactly:
text
What is the product document path? You can provide one or more items, separated by commas or newlines: 1. Local file path 2. URL 3. Image file path 4. Folder path - Product doc → if in a sandbox environment, ask exactly:
text
What is the product document path? You can provide one or more items, separated by commas or newlines: 1. Sandbox workspace path 2. Uploaded attachment path 3. URL 4. Image file path 5. Folder path You can also attach/upload relevant files here, and I will read them from the sandbox workspace if available. - Detailed description → If too vague, follow up on core features, user behaviors, business flows, monetization
- Codebase → ask "What is the project directory path?", then scan source to extract business logic
- Pre-built template → display matching templates for user confirmation
- Modify existing tracking plan → ask "Please provide the xlsx file path of your existing tracking plan", then follow the flow below
Modify Existing Tracking Plan Flow (when user selects this option):
-
Import: Ask user for the file path, then immediately import:bash
AE_LANG=<user_lang> ae-cli tracking code import-template --template <path> --out .ae-cli/draft.json -
Check result:
- If CLI errors (file not found / parse failure) → report error, ask user to fix the file and retry
- If has
draft.jsonarray empty → 🛑 Severe: No AE-format sheets found (missingeventsprefix sheets like#). Tell user the file does not appear to be an AE tracking plan xlsx. User must fix the original file and re-import.#事件数据
-
Content validation (when events are non-empty):bash
AE_LANG=<user_lang> ae-cli tracking plan validate --in .ae-cli/draft.json --fix -
Handle validation results by severity:
- If validate passes with no issues at all → skip to Step 5.
Severity Examples Handling User Action 🔧 Minor (auto-fixable) duplicate,display_namesub-property inconsistency, event name duplicatearray_rowauto-fixes, writes to--fix. Inform user of what was fixed.draft.jsonNone (informed) ⚠️ Medium (needs confirmation) snake_case violation, property name duplicate, invalid property type, nested property parent is not a composite type List each issue with current value → suggested fix. User confirms item by item before writing to .draft.jsonConfirm each fix 🛑 Severe File cannot be parsed, or events array is empty after import Reject. Tell user the specific issue. User fixes original file and re-imports. Fix original file Medium issue confirmation format:⚠️ The following content needs to be fixed: | # | Issue | Location | Current | Suggested | |---|-------|----------|---------|------------| | 1 | snake_case | event_name | UserLogin | user_login | | 2 | snake_case | prop_name | vipLevel | vip_level | | 3 | invalid type | property "level" | integer | number | Apply all suggested fixes? ok / specify per item / skip- → apply all suggested fixes to
okdraft.json - → confirm each item one by one
specify per item - → keep current values, handle in Refine phase later
skip
⚠️ Never modify the user's original xlsx file. All changes go into.draft.json -
Re-validate after fixes → loop until clean, then continue to the next follow-up question (if combined with another source material), or Item 3 (if existing_plan is the only source).
Codebase analysis flow (when source_type includes ):
codebase- User provides project directory path
- Scan directory structure, identify tech stack (engine/framework/language)
- Read core business modules (game logic, scene management, UI interaction, state/data models, networking/payment, etc.)
- Extract from code:
- Events: Player interaction actions (click/swipe/trigger), scene transitions, game state changes (start/pause/end), business flow nodes (purchase/upgrade/unlock)
- Event Properties: Action parameters (bullet type/enemy level/item ID), state values (score/HP/coins), context (level ID/difficulty/mode)
- User Properties: Persistent state (level/experience/VIP/cumulative spend)
- Map extracted results to AE naming conventions (event names +
snake_casein user's language)display_name - Confirm extracted results with user, supplement missing items
Business Dimension Confirmation:
After source material is confirmed, must process business dimension info based on source_type. User must explicitly confirm before proceeding.
| source_type | Handling |
|---|---|
| Directly display template's inherited business dimensions; skip detailed inference |
| Infer business dimensions from existing plan content (analyze event modules, payment events, currency properties); follow up on missing items; event injection preview |
| Infer business dimensions → follow up on missing items → event injection preview |
Combo (e.g. | See detailed rules below — baseline source's method is primary, supplementary source contributes additional context |
If source_type is template or starts with template_ (covers , , , ):
templatetemplate_prdtemplate_codebasetemplate_chatDisplay template's preset business dimensions:
Business Dimension (inherited from template: <template name>)
Revenue Model: <revenue_model>
Core Loop: <core_loop>
Functional Entries: <functional_entries>
Currency System: <currency_system>
Confirm using these business dimensions? ok / modify- User → proceed to next step
ok - User says "modify" → switch to prd/chat flow for user to supplement
- For combos (e.g. ): after confirming template dimensions, also note any supplementary insights from
template_prd/prdas context for Phase 1.2.chat
If source_type includes existing_plan:
Infer business dimensions from the imported plan content:
- Analyze existing events: Examine values to identify functional modules (e.g. events tagged "Battle" → 战斗 module). Examine event names for payment/ad-related patterns to infer revenue model.
event_tag - Inference display: Format inference results as a summary:
Business Dimension (inferred from existing plan: <filename>) Revenue Model: <inferred from payment/ad events> Core Loop: <inferred from event flow> Functional Entries: <inferred from event_tag values> Currency System: <inferred from currency-related properties> Confirm these business dimensions? ok / modify - Follow up missing: Only ask about items that could not be inferred
- Event injection preview: Show suggested injected event modules (only add events not already in the plan); user to proceed
ok
- For combos (e.g. ): after confirming dimensions from the plan, also note any supplementary insights from
existing_plan_prd/prdas context for Phase 1.2.chat
If source_type is prd / codebase / chat:
- Inference display: Format inference results as a summary, using as the mapping baseline
business-dimension-mapping.md - Follow up missing: Only ask about missing items or items inferred as "simple"
- Event injection preview: Show suggested injected event modules; user to proceed
ok
Platform validation: Use Chapter 5 decision rules to check if injected events' platform assignments are reasonable.
business-dimension-mapping.mdTemplate matching (prd / codebase / chat scenarios, optional; NOT applicable to existing_plan or template scenarios):
After business dimension confirmation, auto-detect matching templates based on app type:
bash
AE_LANG=<user_lang> ae-cli tracking plan list-templates --jsonShow matching templates to user for confirmation. Confirmed templates serve as baseline and participate in Phase 1 event merging.
询问前,判断当前运行环境是否为Agent沙箱。Agent可通过运行时上下文判断,例如沙箱提供的、受限的文件系统访问权限或用户本地文件不存在等。不得仅为判断沙箱可见性而询问用户。
cli-token.json产品文档仅在沙箱环境中对沙箱工作区内可读的文件可用,包括用户附加/上传到对话工作区的文件。除非文件已挂载或附加,否则无法读取沙箱外的任意本地路径。代码库是本地素材选项,除非代码库已存在于可读工作区,否则在沙箱环境中必须隐藏。当选项被隐藏时,将可见列表重新从1开始连续编号;不得显示跳过的编号。
如果不在沙箱环境中,严格按以下内容询问:
text
选择你的素材来源(最多选2项):
1 - 产品文档(本地路径、图片文件或文件夹)—— 从产品文档中提取事件和属性;支持md/pdf/docx/URL/图片(png/jpg/jpeg/webp)
2 - 详细描述(对话式)—— 描述应用业务流程、核心功能、用户行为、变现模型等
3 - 代码库(本地项目路径;沙箱环境中隐藏)—— 分析源代码提取事件和属性
4 - 预构建模板(内置行业和游戏品类模板)—— 选择内置模板
5 - 修改现有埋点方案(本地AE格式Excel文件)—— 导入现有埋点方案Excel作为修改基准;可与产品文档/描述/代码库组合,但**不可**与预构建模板组合
请回复编号,例如:1,5 或 4。最多选2项。如果在沙箱环境中,严格按以下内容询问:
text
选择你的素材来源(最多选2项):
1 - 产品文档(沙箱工作区路径、上传的附件、URL、图片文件或文件夹)—— 从产品文档中提取事件和属性;支持md/pdf/docx/URL/图片(png/jpg/jpeg/webp)。你可在此附加/上传相关文件。
2 - 详细描述(对话式)—— 描述应用业务流程、核心功能、用户行为、变现模型等
3 - 预构建模板(内置行业和游戏品类模板)—— 选择内置模板
4 - 修改现有埋点方案(沙箱工作区路径)—— 导入现有埋点方案Excel作为修改基准;可与产品文档/描述组合,但**不可**与预构建模板组合
请回复编号,例如:1,4 或 3。最多选2项。不得将此素材来源列表改写为无序列表、卡片或散文形式。用户必须能够通过回复可见编号进行选择。
翻译此提示时,严格保留数字前缀和换行符。每个可见选项必须单独占一行,且必须以、、等开头。不得将两个编号选项放在同一段落或同一视觉行中。如果Markdown渲染器可能折叠软换行,请使用Markdown硬换行(换行前添加两个空格)而非空行。仅可修改选项文本,不得修改编号前缀或每行一个选项的结构。
1 -2 -3 -用户可多选(最多2项)。根据显示给用户的可见列表而非非沙箱环境的标准列表来解读编号。
标准素材选项(非沙箱环境编号):
- 产品文档(本地路径、沙箱工作区路径、上传的附件、URL、图片文件或文件夹)—— 从产品文档中提取事件和属性;支持md/pdf/docx/URL/图片(png/jpg/jpeg/webp)
- 详细描述(对话式)—— 描述应用业务流程、核心功能、用户行为、变现模型等
- 代码库(本地项目路径;沙箱环境中隐藏)—— 分析源代码提取事件和属性
- 预构建模板(内置行业和游戏品类模板)—— 选择内置模板(运行查看可用模板)
AE_LANG=<user_lang> ae-cli tracking plan list-templates --json
根据用户选择,确定素材类型并记录到:
meta.source_type| 选择 | source_type | 处理方式 |
|---|---|---|
| 仅产品文档 | | 读取产品文档(文本/图片),提取事件和属性 |
| 仅详细描述 | | 在草稿阶段根据描述构建事件 |
| 仅代码库 | | 扫描源代码,从业务逻辑中提取事件/属性 |
| 仅模板 | | 提供内置模板选择 |
| 仅现有方案 | | 导入Excel作为基准(见下文「修改现有埋点方案流程」) |
| 任意两项组合 | 用 | 前者为基准,后者为补充(优先级:existing_plan → template → codebase → prd → chat) |
| 现有方案 + 预构建模板 | 不允许 | 两者均提供事件基准,存在语义冲突 |
跟进问题(按「多源组合规则」中定义的跟进顺序询问):
- 产品文档 → 若不在沙箱环境中,严格按以下内容询问:
text
产品文档路径是什么? 你可提供一个或多个条目,用逗号或换行分隔: 1. 本地文件路径 2. URL 3. 图片文件路径 4. 文件夹路径 - 产品文档 → 若在沙箱环境中,严格按以下内容询问:
text
产品文档路径是什么? 你可提供一个或多个条目,用逗号或换行分隔: 1. 沙箱工作区路径 2. 上传的附件路径 3. URL 4. 图片文件路径 5. 文件夹路径 你也可在此附加/上传相关文件,我将从沙箱工作区读取(如果可用)。 - 详细描述 → 若描述过于模糊,跟进询问核心功能、用户行为、业务流程、变现方式
- 代码库 → 询问**「项目目录路径是什么?」**,然后扫描源代码提取业务逻辑
- 预构建模板 → 展示匹配的模板供用户确认
- 修改现有埋点方案 → 询问**「请提供现有埋点方案的Excel文件路径」**,然后遵循以下流程
修改现有埋点方案流程(当用户选择此选项时):
-
导入:询问用户文件路径,然后立即导入:bash
AE_LANG=<user_lang> ae-cli tracking code import-template --template <path> --out .ae-cli/draft.json -
检查结果:
- 若CLI报错(文件未找到/解析失败)→ 报告错误,要求用户修复文件并重试
- 若的
draft.json数组为空 → 🛑 严重问题:未找到AE格式工作表(缺少events前缀的工作表,如#)。告知用户该文件似乎不是AE埋点方案Excel。用户必须修复原始文件后重新导入。#事件数据
-
内容校验(当事件非空时):bash
AE_LANG=<user_lang> ae-cli tracking plan validate --in .ae-cli/draft.json --fix -
按严重程度处理校验结果:
- 若校验完全通过 → 跳过步骤5。
严重程度 示例 处理方式 用户操作 🔧 轻微(可自动修复) 重复、display_name子属性不一致、事件名称重复array_row自动修复,写入--fix。告知用户修复内容。draft.json无需操作(仅告知) ⚠️ 中等(需确认) snake_case规则违反、属性名称重复、无效属性类型、嵌套属性父级非复合类型 列出每个问题的当前值→建议修复方案。用户逐项确认后写入 。draft.json确认每项修复 🛑 严重 文件无法解析,或导入后events数组为空 拒绝导入。告知用户具体问题。用户修复原始文件后重新导入。 修复原始文件 中等问题确认格式:⚠️ 以下内容需要修复: | # | 问题 | 位置 | 当前值 | 建议值 | |---|-------|----------|---------|------------| | 1 | snake_case规则违反 | event_name | UserLogin | user_login | | 2 | snake_case规则违反 | prop_name | vipLevel | vip_level | | 3 | 无效类型 | 属性"level" | integer | number | 是否应用所有建议修复?ok / 逐项确认 / 跳过- → 将所有建议修复应用到
okdraft.json - → 逐项确认每个问题
逐项确认 - → 保留当前值,后续在优化阶段处理
跳过
⚠️ 不得修改用户的原始Excel文件。所有更改均写入。draft.json -
修复后重新校验 → 循环直至无问题,然后继续跟进下一个问题(若与其他素材来源组合),或进入项3(若仅选择现有方案)。
代码库分析流程(当source_type包含时):
codebase- 用户提供项目目录路径
- 扫描目录结构,识别技术栈(引擎/框架/语言)
- 读取核心业务模块(游戏逻辑、场景管理、UI交互、状态/数据模型、网络/支付等)
- 从代码中提取:
- 事件:玩家交互操作(点击/滑动/触发)、场景切换、游戏状态变化(开始/暂停/结束)、业务流程节点(购买/升级/解锁)
- 事件属性:操作参数(子弹类型/敌人等级/物品ID)、状态值(得分/生命值/金币)、上下文(关卡ID/难度/模式)
- 用户属性:持久化状态(等级/经验/VIP/累计消费)
- 将提取结果映射到AE命名规范(事件名称 + 用户语言的
snake_case)display_name - 与用户确认提取结果,补充缺失项
业务维度确认:
确认素材来源后,必须根据source_type处理业务维度信息。用户必须明确确认后才能继续。
| source_type | 处理方式 |
|---|---|
| 直接展示模板继承的业务维度;跳过详细推导 |
| 从现有方案内容推导业务维度(分析事件模块、支付事件、货币属性);跟进缺失项;事件注入预览 |
| 推导业务维度→跟进缺失项→事件注入预览 |
组合(例如 | 见下文详细规则——基准素材的方法为主,补充素材提供额外上下文 |
若source_type为template或以template_开头(涵盖、、、):
templatetemplate_prdtemplate_codebasetemplate_chat展示模板预设的业务维度:
业务维度(继承自模板:<模板名称>)
收入模型:<revenue_model>
核心循环:<core_loop>
功能入口:<functional_entries>
货币体系:<currency_system>
是否确认使用这些业务维度?ok / 修改- 用户回复→ 进入下一步
ok - 用户回复"修改" → 切换到prd/chat流程,让用户补充信息
- 对于组合类型(例如):确认模板维度后,还需记录
template_prd/prd提供的补充洞察,作为阶段1.2的上下文。chat
若source_type包含existing_plan:
从导入的方案内容推导业务维度:
- 分析现有事件:检查值识别功能模块(例如:标记为"Battle"的事件→战斗模块)。检查事件名称中的支付/广告相关模式推导收入模型。
event_tag - 推导结果展示:将推导结果格式化为摘要:
业务维度(从现有方案推导:<文件名>) 收入模型:<从支付/广告事件推导>
核心循环:<从事件流推导>
功能入口:<从event_tag值推导>
货币体系:<从货币相关属性推导>
是否确认这些业务维度?ok / 修改
3. **跟进缺失项**:仅询问无法推导的项
4. **事件注入预览**:展示建议注入的事件模块(仅添加方案中未有的事件);用户回复`ok`后继续
- 对于组合类型(例如`existing_plan_prd`):确认方案维度后,还需记录`prd`/`chat`提供的补充洞察,作为阶段1.2的上下文。
**若source_type为prd / codebase / chat**:
1. **推导结果展示**:以`business-dimension-mapping.md`为映射基准,将推导结果格式化为摘要
2. **跟进缺失项**:仅询问缺失项或推导为"简单"的项
3. **事件注入预览**:展示建议注入的事件模块;用户回复`ok`后继续
平台校验:使用`business-dimension-mapping.md`第5章的决策规则检查注入事件的平台分配是否合理。
**模板匹配**(prd / codebase / chat场景,可选;**不适用于existing_plan或template场景**):
确认业务维度后,根据应用类型自动检测匹配的模板:
```bash
AE_LANG=<user_lang> ae-cli tracking plan list-templates --json向用户展示匹配的模板供确认。确认后的模板作为基准参与阶段1的事件合并。
Multi-Source Combination Rules (when user selects 2 source materials)
多源组合规则(当用户选择2项素材来源时)
Follow-up Order (Phase 0 questioning sequence):
Do not follow user's selection order. Instead, use this order:
existing_plan(blocking validation, always first)→ codebase/prd(user's selection order)→ chat → templateRationale:
- must go first — import + validate may require the user to fix their file; processing it early avoids wasted context
existing_plan - /
codebase— directly reflect actual business requirements, prioritized over generic descriptions and templatesprd - — conversational description, supplements business context
chat - — generic industry template, least specific to the user's business
template
Source material processing happens primarily in Phase 1.2 (Merge Source Materials). The one exception is : it is imported and validated in Phase 0 because user-provided files may need fixing before proceeding. All other sources are processed in Phase 1.2 per their standard flow.
existing_planMerge priority (Phase 1.2):
Earlier sources take precedence — same-name events keep the earlier version, later sources only add new events or merge without overwriting.
existing_plan → template → codebase → prd → chat → autotrackprop_namesBusiness Dimension Inference (combined scenarios):
Use the baseline source's inference method as primary. Supplementary sources (especially prd/chat) may contribute additional information — present a merged view for user confirmation.
Valid Combinations:
The "Baseline" column identifies which source has higher merge priority (see Phase 1.2 merge order), which may differ from the user's selection order. Follow-up questioning uses the fixed order in "Multi-Source Combination Rules" above, not the user's selection order.
| Baseline | Supplementary | Phase 0 for supplementary |
|---|---|---|
| existing_plan | codebase | Collect path + quick tech stack detection |
| existing_plan | prd | Collect path |
| existing_plan | chat | Collect description; participates in dimension inference |
| template | codebase | Collect path + quick tech stack detection; template matching/import deferred to Phase 1.2 |
| template | prd | Collect path; template matching/import deferred to Phase 1.2 |
| template | chat | Collect description |
| codebase | prd | Collect path |
| codebase | chat | Collect description |
| prd | chat | Collect description |
| codebase | template | Same as template+codebase row above (template is baseline per merge priority) |
| prd | template | Same as template+prd row above (template is baseline per merge priority) |
Forbidden: (both provide event baselines; semantic conflict).
existing_plan + templateRecord business dimension info to :
meta.business_dimensionjson
"business_dimension": {
"revenue_model": "<model>",
"core_loop": "<description>",
"functional_entries": ["<entry list>"],
"currency_system": { ... },
"ad_scenes": [],
"iap_items": []
}跟进顺序(阶段0询问顺序):
不要遵循用户的选择顺序,而是使用以下顺序:
existing_plan(阻塞式校验,始终优先)→ codebase/prd(用户选择顺序)→ chat → template理由:
- 必须优先处理——导入+校验可能需要用户修复文件;提前处理可避免浪费上下文
existing_plan - /
codebase——直接反映实际业务需求,优先级高于通用描述和模板prd - ——对话式描述,补充业务上下文
chat - ——通用行业模板,对用户业务的针对性最弱
template
素材处理主要在阶段1.2(合并素材来源)进行。唯一例外是:它在阶段0导入并校验,因为用户提供的文件可能需要修复后才能继续。所有其他素材均按标准流程在阶段1.2处理。
existing_plan合并优先级(阶段1.2):
优先级高的素材优先——同名事件保留优先级高的版本,优先级低的素材仅添加新事件或合并而不覆盖。
existing_plan → template → codebase → prd → chat → autotrackprop_names业务维度推导(组合场景):
以基准素材的推导方法为主。补充素材(尤其是prd/chat)可提供额外信息——展示合并后的视图供用户确认。
有效组合:
「基准」列标识哪个素材具有更高的合并优先级(见阶段1.2合并顺序),可能与用户选择顺序不同。跟进询问使用「多源组合规则」中的固定顺序,而非用户选择顺序。
| 基准 | 补充 | 补充素材的阶段0处理 |
|---|---|---|
| existing_plan | codebase | 收集路径+快速技术栈检测 |
| existing_plan | prd | 收集路径 |
| existing_plan | chat | 收集描述;参与维度推导 |
| template | codebase | 收集路径+快速技术栈检测;模板匹配/导入延迟到阶段1.2 |
| template | prd | 收集路径;模板匹配/导入延迟到阶段1.2 |
| template | chat | 收集描述 |
| codebase | prd | 收集路径 |
| codebase | chat | 收集描述 |
| prd | chat | 收集描述 |
| codebase | template | 与上方template+codebase行相同(按合并优先级,template为基准) |
| prd | template | 与上方template+prd行相同(按合并优先级,template为基准) |
禁止组合:(两者均提供事件基准,存在语义冲突)。
existing_plan + template将业务维度信息记录到:
meta.business_dimensionjson
"business_dimension": {
"revenue_model": "<model>",
"core_loop": "<description>",
"functional_entries": ["<entry list>"],
"currency_system": { ... },
"ad_scenes": [],
"iap_items": []
}Item 3 — SDK Integration Config (client + server combined)
项3 — SDK集成配置(客户端+服务端合并)
Ask: "What is your client platform? (multi-select OK, e.g. Android + iOS) Will you integrate a server-side SDK?"
After asking this Item 3 question, stop and wait for the user's answer. Do not display Item 4 in the same response.
Language filter: The following SDKs have Chinese-only documentation and are visible to Chinese users only:,Mini-program,Mini-game,OpenHarmony,LayaAir,Egret. Do not show these to non-Chinese users.Cocos2d-Lua
Client integration (multi-select OK):
| Option | Client SDK Type |
|---|---|
| H5/Web App | JavaScript SDK |
| Mobile Game - Android Native | Android SDK |
| Mobile Game - iOS Native | iOS SDK |
| Mobile Game - Unity | Unity SDK |
| Mobile Game - CocosCreator | CocosCreator SDK |
| Mobile Game - Cocos2d-x | Cocos2d-x SDK |
| Mobile Game - Cocos2d-Lua | Cocos2d-Lua SDK |
| Mobile Game - LayaAir | LayaAir SDK |
| Mobile Game - Egret | Egret SDK |
| Mobile Game - Unreal | Unreal SDK |
| Mobile App - Android Native | Android SDK |
| Mobile App - iOS Native | iOS SDK |
| Mobile App - React Native | React Native SDK |
| Mobile App - Flutter | Flutter SDK |
| Mobile App - uni-app | uni-app SDK |
| Mobile App - OpenHarmony | OpenHarmony SDK |
| Mini-game | Mini-game SDK (unified, supports WeChat/QQ/TikTok/Baidu, etc.) |
| Mini-program | Mini-program SDK (unified, supports WeChat/TikTok/Alipay/Baidu, etc.) |
| PC Game - Unreal | Unreal SDK |
| PC Game - Unity | Unity SDK |
| PC App - C++ | C++ SDK |
| PC App - C# | C# SDK |
| PC App - macOS Native | macOS SDK |
| PC App - OpenHarmony | OpenHarmony SDK |
| No client SDK | None ( |
Programming language (Android / iOS SDK only):
| SDK Type | Supported Languages |
|---|---|
| Android SDK | Java / Kotlin (can multi-select) |
| iOS SDK | Objective-C / Swift (can multi-select) |
| Other SDKs | Fixed language, no selection needed |
Follow-up: chose Android SDK → ask "Which programming language? Java / Kotlin / both"
Follow-up: chose iOS SDK → ask "Which programming language? Objective-C / Swift / both"
Record to :
client_platform_languagesjson
"client_platform_languages": {
"android": ["java", "kotlin"],
"openharmony": ["typescript"]
}⚠️ Multi-platform meta field rules: When ≥2 client platforms are selected, Draft meta must use(array) +client_platforms(dictionary). Do NOT use onlyclient_platform_languages(single value) +client_sdk_type(single value), which would only record one platform. Single-platform scenarios useclient_language+client_sdk_type.client_language
Server integration:
| Option | Server SDK Type | sdk_integration_mode |
|---|---|---|
| Java | Java SDK | |
| Python | Python SDK | |
| Go | Go SDK | |
| Node.js | Node SDK | |
| PHP | PHP SDK | |
| C# / .NET | C# SDK | |
| C++ | C++ SDK | |
| Erlang | Erlang SDK | |
| Lua | Lua SDK | |
| Ruby | Ruby SDK | |
| Other | Follow up on specific language; check wiki for SDK availability | |
| No server SDK | None | |
SDK integration mode auto-detection:
| Client Integration | Server Integration | sdk_integration_mode |
|---|---|---|
| Yes | Yes | |
| Yes | No | |
| No | Yes | |
| No | No | |
noneItem 3 confirmation gate:
After the user answers Item 3, normalize the SDK configuration and ask only the missing follow-up questions (for Android/iOS programming language or server language).
OtherThen summarize the normalized SDK config and ask: "Confirm this SDK integration config? Reply ok to continue to Item 4, or describe changes."
Do not display Item 4 or ask identity questions until the user explicitly confirms this SDK integration config.
询问:「你的客户端平台是什么?(可多选,例如:Android + iOS)是否要集成服务端SDK?」
询问此项后,停止并等待用户回复。不得在同一回复中展示项4。
语言过滤:以下SDK仅提供中文文档,仅对中文用户可见:、Mini-program、Mini-game、OpenHarmony、LayaAir、Egret。不得向非中文用户展示这些选项。Cocos2d-Lua
客户端集成(可多选):
| 选项 | 客户端SDK类型 |
|---|---|
| H5/Web App | JavaScript SDK |
| 移动游戏 - Android原生 | Android SDK |
| 移动游戏 - iOS原生 | iOS SDK |
| 移动游戏 - Unity | Unity SDK |
| 移动游戏 - CocosCreator | CocosCreator SDK |
| 移动游戏 - Cocos2d-x | Cocos2d-x SDK |
| 移动游戏 - Cocos2d-Lua | Cocos2d-Lua SDK |
| 移动游戏 - LayaAir | LayaAir SDK |
| 移动游戏 - Egret | Egret SDK |
| 移动游戏 - Unreal | Unreal SDK |
| 移动应用 - Android原生 | Android SDK |
| 移动应用 - iOS原生 | iOS SDK |
| 移动应用 - React Native | React Native SDK |
| 移动应用 - Flutter | Flutter SDK |
| 移动应用 - uni-app | uni-app SDK |
| 移动应用 - OpenHarmony | OpenHarmony SDK |
| 小游戏 | 小游戏SDK(统一版,支持微信/QQ/抖音/百度等) |
| 小程序 | 小程序SDK(统一版,支持微信/抖音/支付宝/百度等) |
| PC游戏 - Unreal | Unreal SDK |
| PC游戏 - Unity | Unity SDK |
| PC应用 - C++ | C++ SDK |
| PC应用 - C# | C# SDK |
| PC应用 - macOS原生 | macOS SDK |
| PC应用 - OpenHarmony | OpenHarmony SDK |
| 无客户端SDK | None( |
编程语言(仅Android / iOS SDK):
| SDK类型 | 支持语言 |
|---|---|
| Android SDK | Java / Kotlin(可多选) |
| iOS SDK | Objective-C / Swift(可多选) |
| 其他SDK | 固定语言,无需选择 |
跟进:若选择Android SDK → 询问**「使用哪种编程语言?Java / Kotlin / 两者都用」**
跟进:若选择iOS SDK → 询问**「使用哪种编程语言?Objective-C / Swift / 两者都用」**
记录到:
client_platform_languagesjson
"client_platform_languages": {
"android": ["java", "kotlin"],
"openharmony": ["typescript"]
}⚠️ 多平台元字段规则:当选择≥2个客户端平台时,草稿元数据必须使用(数组)+client_platforms(字典)。不得仅使用client_platform_languages(单个值)+client_sdk_type(单个值),否则仅能记录一个平台。单平台场景使用client_language+client_sdk_type。client_language
服务端集成:
| 选项 | 服务端SDK类型 | sdk_integration_mode |
|---|---|---|
| Java | Java SDK | |
| Python | Python SDK | |
| Go | Go SDK | |
| Node.js | Node SDK | |
| PHP | PHP SDK | |
| C# / .NET | C# SDK | |
| C++ | C++ SDK | |
| Erlang | Erlang SDK | |
| Lua | Lua SDK | |
| Ruby | Ruby SDK | |
| 其他 | 跟进询问具体语言;查看wiki确认SDK可用性 | |
| 无服务端SDK | None | |
SDK集成模式自动检测:
| 客户端集成 | 服务端集成 | sdk_integration_mode |
|---|---|---|
| 是 | 是 | |
| 是 | 否 | |
| 否 | 是 | |
| 否 | 否 | |
none项3确认环节:
用户回复项3后,标准化SDK配置并仅询问缺失的跟进问题(Android/iOS编程语言或服务端语言)。
Other然后总结标准化后的SDK配置并询问:「确认此SDK集成配置?回复ok继续到项4,或描述修改内容。」
在用户明确确认此SDK集成配置前,不得展示项4或询问身份相关问题。
Item 4 — User Identity System (visitor ID + account ID combined)
项4 — 用户身份体系(访客ID + 账号ID合并)
Ask: "What is the visitor ID generation strategy?"
Options:
- — SDK auto-generates (default, suitable for most scenarios)
auto - — Use device ID (iOS IDFV / Android AndroidID)
device_id - — Custom visitor ID (must call
customimmediately after SDK init)identify()
Follow-up: chose → ask "What value should the visitor ID use? e.g.: device ID / UUID / guest temp ID"
customAsk: "What is the account ID source?"
Options:
- — User account ID (unique identifier after login)
user_account - — Role ID (game-specific; one account may have multiple roles)
role_id - — No account system (pure guest mode)
none
Follow-up:
- chose → ask "What specific value for account ID? e.g.: user_id (user ID), phone (phone number), email (email address)"
user_account - chose → explain "Role ID is suitable for games — one account can create multiple roles, enabling finer-grained per-role behavior analysis"
role_id
Record to :
meta.user_identity询问:「访客ID生成策略是什么?」
选项:
- — SDK自动生成(默认,适用于大多数场景)
auto - — 使用设备ID(iOS IDFV / Android AndroidID)
device_id - — 自定义访客ID(必须在SDK初始化后立即调用
custom)identify()
跟进:若选择 → 询问**「访客ID应使用什么值?例如:设备ID / UUID / 临时游客ID」**
custom询问:「账号ID来源是什么?」
选项:
- — 用户账号ID(登录后的唯一标识符)
user_account - — 角色ID(游戏专用;一个账号可拥有多个角色)
role_id - — 无账号体系(纯游客模式)
none
跟进:
- 若选择→ 询问**「账号ID的具体值是什么?例如:user_id(用户ID)、phone(手机号)、email(邮箱)」**
user_account - 若选择→ 说明**「角色ID适用于游戏场景——一个账号可创建多个角色,支持更细粒度的单角色行为分析」**
role_id
记录到:
meta.user_identityPhase 1 — Draft
阶段1 — 草稿
1.1 Construct Canonical Draft
1.1 构建标准草稿
Draft conceptual structure (internal JSON; users do not view directly):
Draft
├── meta:
│ ├── app_type: App type
│ ├── sdk_integration_mode: SDK integration mode: client_only / server_only / both
│ ├── client_platforms?: Client SDK type list (required when multi-platform, e.g. ["android","ios"])
│ ├── client_sdk_type?: Primary client SDK type (single platform, backward compatible)
│ ├── client_platform_languages?: Per-platform languages (required when multi-platform, e.g. {"android":["kotlin"],"ios":["swift"]})
│ ├── client_language?: Client dev language (single platform, backward compatible)
│ ├── server_language?: Server dev language (only when server_only or both)
│ ├── project_id?: AE project ID (filled in Phase 3)
│ ├── host?: AE web address (filled in Phase 3)
│ ├── plan_name: Plan name
│ ├── lang: xlsx output language (zh/en/ja/ko), based on user's current language; controls generated xlsx headers/sheet names
│ ├── scenario: Business scenario description
│ ├── source_type: Source material type
│ ├── user_identity: User identity config
│ │ ├── account_id_source: Account ID source: user_account / role_id / none
│ │ ├── account_id_field?: Account ID field name (only when user_account, e.g. user_id / phone / email)
│ │ ├── distinct_id_strategy: Visitor ID strategy: auto / device_id / custom
│ │ └── distinct_id_custom_value?: Custom visitor ID value
│ └── business_dimension: Business dimension config (injected in Phase 1.3)
│ ├── revenue_model: Revenue model: IAA / IAP / mixed / subscription / commission
│ ├── core_loop: Core gameplay loop description
│ ├── functional_entries: Functional entry list
│ ├── currency_system: Currency system
│ ├── ad_scenes: Ad scenes (IAA / mixed only)
│ └── iap_items: IAP items (IAP / mixed only)
├── events: Event array, each with platform field
├── event_properties: Global event property pool (deduplicated)
├── common_event_properties: Common/super properties (attached to every event)
└── user_properties: User propertiesSDK integration mode fields:
json
// Multi-platform example (Android + iOS)
{
"sdk_integration_mode": "both", // client_only / server_only / both
"client_platforms": ["android", "ios"], // Required for multi-platform
"client_platform_languages": { // Required for multi-platform; per-platform languages
"android": ["kotlin"],
"ios": ["swift"]
},
"server_language": "java" // Only when server_only or both
}
// Single platform example (backward compatible)
{
"sdk_integration_mode": "client_only",
"client_sdk_type": "android", // Single platform
"client_language": "kotlin" // Single platform
}Event platform tag ():
events[].platformjson
{
"event_name": "order_create",
"display_name": "Order Create",
"platform": "server", // client / server / both
"prop_names": ["order_id", "order_amount", "payment_method"],
"source": "prd"
}- — Client-side upload (user behavior events)
platform: "client" - — Server-side upload (business data events)
platform: "server" - — Both sides upload (timestamps must be synced)
platform: "both"
Property object format ( / pool entries):
event_propertiescommon_event_propertiesjson
{
"name": "order_amount",
"display_name": "Order Amount",
"type": "number",
"desc": "Order total in cents",
"source": "prd"
}⚠️ Field names: use(NOTname),prop_name,display_name,type,desc. Events reference properties bysource— this is an array of propertyprop_names: ["order_amount", ...]references (string array), NOT property objects.name
User property format ( pool entries):
user_propertiesjson
{
"name": "vip_level",
"display_name": "VIP Level",
"type": "number",
"desc": "Current VIP level of the user",
"source": "chat",
"update_type": "user_set"
}is one of:update_type(overwrite),user_set(first-set-only),user_setOnce(numeric accumulate).user_add
User identity fields ():
meta.user_identityjson
{
"account_id_source": "user_account", // Account ID source: user_account / role_id / none
"account_id_field": "user_id", // Account ID field name (only when user_account)
"distinct_id_strategy": "auto", // Visitor ID strategy: auto / device_id / custom
"distinct_id_custom_value": null // Custom visitor ID value description (only when strategy=custom)
}Property types (enum): / / / /
(single object, with sub-properties) / (object array, supports nesting) / (string array)
stringnumberbooldatetimeobjectarray_rowparent.childarray_stringNaming rules: Event names / property names must be ; use field for human-readable names.
snake_casedisplay_name草稿概念结构(内部JSON;用户不可直接查看):
Draft
├── meta:
│ ├── app_type: 应用类型
│ ├── sdk_integration_mode: SDK集成模式:client_only / server_only / both
│ ├── client_platforms?: 客户端SDK类型列表(多平台时必填,例如["android","ios"])
│ ├── client_sdk_type?: 主客户端SDK类型(单平台,向后兼容)
│ ├── client_platform_languages?: 各平台语言(多平台时必填,例如{"android":["kotlin"],"ios":["swift"]})
│ ├── client_language?: 客户端开发语言(单平台,向后兼容)
│ ├── server_language?: 服务端开发语言(仅server_only或both模式)
│ ├── project_id?: AE项目ID(阶段3填充)
│ ├── host?: AE网页地址(阶段3填充)
│ ├── plan_name: 方案名称
│ ├── lang: Excel输出语言(zh/en/ja/ko),基于用户当前语言;控制生成的Excel表头/工作表名称
│ ├── scenario: 业务场景描述
│ ├── source_type: 素材类型
│ ├── user_identity: 用户身份配置
│ │ ├── account_id_source: 账号ID来源:user_account / role_id / none
│ │ ├── account_id_field?: 账号ID字段名(仅user_account模式,例如user_id / phone / email)
│ │ ├── distinct_id_strategy: 访客ID策略:auto / device_id / custom
│ │ └── distinct_id_custom_value?: 自定义访客ID值
│ └── business_dimension: 业务维度配置(阶段1.3注入)
│ ├── revenue_model: 收入模型:IAA / IAP / mixed / subscription / commission
│ ├── core_loop: 核心业务流程描述
│ ├── functional_entries: 功能入口列表
│ ├── currency_system: 货币体系
│ ├── ad_scenes: 广告场景(仅IAA / mixed模式)
│ └── iap_items: 内购商品(仅IAP / mixed模式)
├── events: 事件数组,每个事件包含platform字段
├── event_properties: 全局事件属性池(去重)
├── common_event_properties: 公共事件属性(附加到所有事件)
└── user_properties: 用户属性SDK集成模式字段:
json
// 多平台示例(Android + iOS)
{
"sdk_integration_mode": "both", // client_only / server_only / both
"client_platforms": ["android", "ios"], // 多平台必填
"client_platform_languages": { // 多平台必填;各平台语言
"android": ["kotlin"],
"ios": ["swift"]
},
"server_language": "java" // 仅server_only或both模式
}
// 单平台示例(向后兼容)
{
"sdk_integration_mode": "client_only",
"client_sdk_type": "android", // 单平台
"client_language": "kotlin" // 单平台
}事件平台标签():
events[].platformjson
{
"event_name": "order_create",
"display_name": "订单创建",
"platform": "server", // client / server / both
"prop_names": ["order_id", "order_amount", "payment_method"],
"source": "prd"
}- — 客户端上传(用户行为事件)
platform: "client" - — 服务端上传(业务数据事件)
platform: "server" - — 两端上传(时间戳必须同步)
platform: "both"
属性对象格式( / 池条目):
event_propertiescommon_event_propertiesjson
{
"name": "order_amount",
"display_name": "订单金额",
"type": "number",
"desc": "订单总金额(单位:分)",
"source": "prd"
}⚠️ 字段名:使用(而非name)、prop_name、display_name、type、desc。事件通过source引用属性——这是属性prop_names: ["order_amount", ...]的引用数组(字符串数组),而非属性对象。name
用户属性格式(池条目):
user_propertiesjson
{
"name": "vip_level",
"display_name": "VIP等级",
"type": "number",
"desc": "用户当前的VIP等级",
"source": "chat",
"update_type": "user_set"
}可选值:update_type(覆盖)、user_set(仅首次设置)、user_setOnce(数值累加)。user_add
用户身份字段():
meta.user_identityjson
{
"account_id_source": "user_account", // 账号ID来源:user_account / role_id / none
"account_id_field": "user_id", // 账号ID字段名(仅user_account模式)
"distinct_id_strategy": "auto", // 访客ID策略:auto / device_id / custom
"distinct_id_custom_value": null // 自定义访客ID值描述(仅strategy=custom时)
}属性类型(枚举): / / / /
(单个对象,包含子属性) / (对象数组,支持嵌套) / (字符串数组)
stringnumberbooldatetimeobjectarray_rowparent.childarray_string命名规则:事件名称/属性名称必须为;使用字段作为可读名称。
snake_casedisplay_name1.2 Merge Source Materials
1.2 合并素材来源
Merge order: existing_plan → template → codebase → prd → chat → autotrack
Earlier sources take precedence — same-name events keep the earlier version, later sources only add new events or merge without overwriting.
prop_names- existing_plan: Already imported and validated in Phase 0 (see "Modify Existing Tracking Plan Flow"). Events are in draft.json as the baseline; each item marked . Higher-priority sources supplement with new events only; same-name events keep the existing_plan version.
source: "existing_plan" - template: User-selected industry template (see "Template Lookup Convention" below) as baseline; each item marked
source: "template"- Templates are resolved by ae-cli from the ae-cli package root and user template directory
- Import command:
AE_LANG=<user_lang> ae-cli tracking code import-template --template-name "<template name>" --out .ae-cli/draft.json - ⚠️ Must validate immediately after template import (see Phase 1.6); template content may not be fully correct
- ⚠️ Do not manually translate template content after import: Do NOT read draft.json and model-translate ,
display_name,event_desc, or propertyevent_tag/display_name. Keep imported business content as produced by the CLI/template reader unless the user explicitly asks for semantic rewriting.desc - ⚠️ Use for localization owned by the CLI:
src/tracking/i18n+AE_LANG=<user_lang>control CLI messages, xlsx sheet names, xlsx headers, property type display values, and auto-track/i18n-owned labels. If these are wrong, inspect the existing translations underdraft.meta.lang, then regenerate with the intended locale instead of editing labels by hand.src/tracking/i18n - ⚠️ No model-invented translations for template labels: When replacing or explaining a localized template-owned label, use the exact value from resources. If no corresponding resource exists, preserve the template text and ask the user before changing semantics.
src/tracking/i18n - ⚠️ event_tag is not free-form model translation: Do not manually map /
业务事件to another language. Preserve template tags, or rely on系统事件and autotrack generation for system labels when the CLI owns them.src/tracking/i18n
- codebase: Scan project source directory, extract events/properties from business logic; same-name events merge prop_names without overwriting existing fields; new items
source: "codebase" - prd: Read all user-provided product documents (md / pdf / docx / URL / images), extract events and properties from each file; same-name events merge prop_names without overwriting existing fields; image files analyzed via multimodal interpretation of UI elements and interaction flows; all new items
source: "prd"- prd path is a folder: Recursively scan all files in the directory:
- md/pdf/docx → read text content, extract events/properties
- png/jpg/jpeg/webp → multimodal interpretation, analyze UI elements and interaction flows
- subdirectories → recurse
- other files → skip
- prd path is a URL: Fetch URL content directly, process by the same rules above
- prd path is a folder: Recursively scan all files in the directory:
- chat: Anchor phase business scenario + refine phase edit instructions,
source: "chat" - autotrack: Auto-inject SDK auto-track events based on (only for
meta.client_sdk_typeorclient_onlymode),bothsource: "autotrack"
合并顺序:existing_plan → template → codebase → prd → chat → autotrack
优先级高的素材优先——同名事件保留优先级高的版本,优先级低的素材仅添加新事件或合并而不覆盖。
prop_names- existing_plan:已在阶段0导入并校验(见「修改现有埋点方案流程」)。事件以draft.json为基准;每个条目标记。优先级更高的素材仅补充新事件;同名事件保留existing_plan版本。
source: "existing_plan" - template:用户选择的行业模板(见下文「模板查找规范」)作为基准;每个条目标记
source: "template"- 模板由ae-cli从ae-cli包根目录和用户模板目录解析
- 导入命令:
AE_LANG=<user_lang> ae-cli tracking code import-template --template-name "<template name>" --out .ae-cli/draft.json - ⚠️ 模板导入后必须立即校验(见阶段1.6);模板内容可能不完全正确
- ⚠️ 导入后不得手动翻译模板内容:不得读取draft.json并通过模型翻译、
display_name、event_desc或属性event_tag/display_name。除非用户明确要求重写语义,否则保留CLI/模板读取器生成的导入业务内容。desc - ⚠️ 使用处理CLI所属的本地化内容:
src/tracking/i18n+AE_LANG=<user_lang>控制CLI消息、Excel工作表名称、Excel表头、属性类型显示值以及自动采集/i18n所属标签。如果这些内容错误,检查draft.meta.lang下的现有翻译,然后使用目标区域设置重新生成,而非手动编辑标签。src/tracking/i18n - ⚠️ 不得通过模型自行生成模板标签的翻译:替换或解释模板所属的本地化标签时,使用资源中的精确值。如果没有对应的资源,保留模板文本并在更改语义前询问用户。
src/tracking/i18n - ⚠️ event_tag并非自由模型翻译:不得手动将「业务事件」/「系统事件」映射到其他语言。保留模板标签,或当CLI拥有系统标签时,依赖和自动采集生成。
src/tracking/i18n
- codebase:扫描项目源目录,从业务逻辑中提取事件/属性;同名事件合并prop_names而不覆盖现有字段;新条目标记
source: "codebase" - prd:读取用户提供的所有产品文档(md / pdf / docx / URL / 图片),从每个文件中提取事件和属性;同名事件合并prop_names而不覆盖现有字段;图片文件通过UI元素和交互流程的多模态分析处理;所有新条目标记
source: "prd"- prd路径为文件夹:递归扫描目录中的所有文件:
- md/pdf/docx → 读取文本内容,提取事件/属性
- png/jpg/jpeg/webp → 多模态解读,分析UI元素和交互流程
- 子目录 → 递归处理
- 其他文件 → 跳过
- prd路径为URL:直接获取URL内容,按上述规则处理
- prd路径为文件夹:递归扫描目录中的所有文件:
- chat:锚点阶段的业务场景 + 优化阶段的编辑指令,标记
source: "chat" - autotrack:根据自动注入SDK自动采集事件(仅
meta.client_sdk_type或client_only模式),标记bothsource: "autotrack"
1.3 Inject Business Dimension Events
1.3 注入业务维度事件
Based on collected in Phase 0, inject corresponding events by the following rules.
meta.business_dimensionRevenue model → Required events:
| Revenue Model | Injected Events | Description |
|---|---|---|
| | Ad impression / click / reward claim |
| | Payment success / failure |
| All IAA + IAP events | |
| | Subscription start / renew / cancel |
| | Order create / payment / commission settlement |
Core loop → Event sequence:
Parse node actions from user's description, map to events:
core_loopExample: "Players repeatedly clear stages to earn coins, use coins to gacha for heroes"
→ Stage module: (stage begin), (stage clear), (stage fail)
→ Resource gain: (coin gain, props: , )
→ Gacha module: (gacha pull), (pool type), (draw count)
→ Hero gain: (hero acquired),
stage_startstage_completestage_failtoken_gettoken_type=diamondtoken_amountgacha_drawpool_typedraw_counthero_gethero_idFunctional entries → Module event groups:
| Functional Entry | Event Examples | Description |
|---|---|---|
| Stage | | Stage start / complete / fail |
| Gacha | | Gacha pull / pool / count / acquire |
| Shop | | Shop open / buy / balance |
| Guild | | Guild join / donate / boss fight |
| Leaderboard | | Ranking view / refresh / click |
| Tasks | | Task accept / complete / reward claim |
| Achievements | | Achievement unlock / reward claim |
| Daily Check-in | | Daily sign-in / reward claim |
Currency system → Property design:
| Currency Type | Event | Properties |
|---|---|---|
| Hard currency (diamonds) gain | | |
| Soft currency (gold) gain | | |
| Hard currency spend | | |
| Soft currency spend | | |
Injection rules:
- Business dimension events marked
source: "business_dimension" - When merging with source material events, same-name events keep the source material version, do not overwrite
- When revenue model is (no monetization), skip revenue-related event injection
none
根据阶段0收集的,按以下规则注入对应事件。
meta.business_dimension收入模型 → 必填事件:
| 收入模型 | 注入事件 | 描述 |
|---|---|---|
| | 广告展示 / 点击 / 奖励领取 |
| | 支付成功 / 失败 |
| 所有IAA + IAP事件 | |
| | 订阅开始 / 续订 / 取消 |
| | 订单创建 / 支付 / 佣金结算 |
核心循环 → 事件序列:
从用户的描述中解析节点操作,映射为事件:
core_loop示例:"玩家反复通关关卡赚取金币,使用金币抽卡获取英雄"
→ 关卡模块:(关卡开始)、(关卡通关)、(关卡失败)
→ 资源获取:(金币获取,属性:、)
→ 抽卡模块:(抽卡)、(卡池类型)、(抽卡次数)
→ 英雄获取:(获取英雄)、
stage_startstage_completestage_failtoken_gettoken_type=diamondtoken_amountgacha_drawpool_typedraw_counthero_gethero_id功能入口 → 模块事件组:
| 功能入口 | 事件示例 | 描述 |
|---|---|---|
| 关卡 | | 关卡开始 / 通关 / 失败 |
| 抽卡 | | 抽卡 / 卡池 / 次数 / 获取英雄 |
| 商店 | | 商店打开 / 购买 / 余额 |
| 公会 | | 公会加入 / 捐赠 / 公会BOSS战开始 |
| 排行榜 | | 排行榜查看 / 刷新 / 点击 |
| 任务 | | 任务接受 / 完成 / 奖励领取 |
| 成就 | | 成就解锁 / 奖励领取 |
| 每日签到 | | 每日签到 / 奖励领取 |
货币体系 → 属性设计:
| 货币类型 | 事件 | 属性 |
|---|---|---|
| 硬通货(钻石)获取 | | |
| 软通货(金币)获取 | | |
| 硬通货消耗 | | |
| 软通货消耗 | | |
注入规则:
- 业务维度事件标记
source: "business_dimension" - 与素材来源事件合并时,同名事件保留素材来源版本,不得覆盖
- 若收入模型为(无变现),跳过收入相关事件注入
none
1.4 Auto-inject SDK Auto-track Events
1.4 自动注入SDK自动采集事件
Based on SDK integration mode collected in Phase 0, decide whether to inject auto-track events:
Injection conditions:
- → inject auto-track events
sdk_integration_mode === "client_only" - → inject auto-track events (client side only)
sdk_integration_mode === "both" - → do NOT inject (server SDKs have no auto-track)
sdk_integration_mode === "server_only" - → do NOT inject (no SDK; data ingestion via other methods)
sdk_integration_mode === "none"
Injection rules:
- Only inject recommended events; optional events are not auto-injected (prompted in Refine phase for optional enablement)
- Auto-track events placed at the end of array, marked
eventssource: "autotrack" - Auto-track event set to
event_tag"System Event" - Auto-track events only carry preset properties (is empty or contains only preset property names)
prop_names - Preset properties prefixed with are not added to
#pool (auto-collected by SDK)event_properties - Cleanup + Deduplication: The CLI will:
- Remove auto-track events inherited from templates or existing plans that don't match the user's selected SDKs. For example: if a template built for Android/iOS contains ,
ta_app_install,ta_app_startbut the user selects JavaScript SDK, thoseta_app_endevents will be automatically removed since JavaScript SDK does not support them.ta_app_* - Inject the correct auto-track events for the user's selected SDKs.
- Deduplicate by event name globally — won't inject events that already exist in the draft (correct auto-track events inherited from templates are kept).
- Remove auto-track events inherited from templates or existing plans that don't match the user's selected SDKs. For example: if a template built for Android/iOS contains
SDK type → Recommended events (see for details):
references/autotrack-events.md| SDK Type | Recommended (auto-inject) | Optional (Refine prompt) |
|---|---|---|
| Android / iOS | | |
| JavaScript | | |
| WeChat Mini-program | | |
| WeChat Mini-game | | — |
| Unity | | |
| Unity WeChat Mini-game | | |
| Other game engines | | — |
Auto-track event purpose notes:
- Auto-track events are the SDK's built-in auto-reporting mechanism; you do not need to manually define same-name events
- Example: JavaScript SDK's auto-collects page views; no need to define
ta_page_show,home_page_showetc.about_page_show - If templates already contain auto-track events (e.g. in industry templates), CLI will not inject duplicates
ta_app_install - These events require enabling corresponding switches during SDK initialization in the phase
ae-generate-tracking-code
Draft JSON example:
json
{
"event_name": "ta_app_install",
"display_name": "App Install",
"event_desc": "Triggered on first app install; upgrades do not trigger; reinstall after deletion triggers",
"event_tag": "System Event",
"platform": "client",
"prop_names": [],
"source": "autotrack"
}Note: Auto-track event is always , because only client SDKs have auto-track capability.
platform"client"根据阶段0收集的SDK集成模式,决定是否注入自动采集事件:
注入条件:
- → 注入自动采集事件
sdk_integration_mode === "client_only" - → 注入自动采集事件(仅客户端)
sdk_integration_mode === "both" - → 不注入(服务端SDK无自动采集功能)
sdk_integration_mode === "server_only" - → 不注入(无SDK;通过其他方式导入数据)
sdk_integration_mode === "none"
注入规则:
- 仅注入推荐事件;可选事件不自动注入(优化阶段提示用户是否启用)
- 自动采集事件放在数组末尾,标记
eventssource: "autotrack" - 自动采集事件的设置为
event_tag"System Event" - 自动采集事件仅携带预置属性(为空或仅包含预置属性名称)
prop_names - 以为前缀的预置属性不添加到
#池(由SDK自动采集)event_properties - 清理 + 去重:CLI将:
- 移除模板或现有方案中与用户选择的SDK不匹配的自动采集事件。例如:若为Android/iOS构建的模板包含、
ta_app_install、ta_app_start,但用户选择JavaScript SDK,这些ta_app_end事件将被自动移除,因为JavaScript SDK不支持它们。ta_app_* - 注入用户选择的SDK对应的正确自动采集事件。
- 全局去重按事件名称——不会注入草稿中已存在的事件(模板继承的正确自动采集事件将保留)。
- 移除模板或现有方案中与用户选择的SDK不匹配的自动采集事件。例如:若为Android/iOS构建的模板包含
SDK类型 → 推荐事件(详情见):
references/autotrack-events.md| SDK类型 | 推荐(自动注入) | 可选(优化阶段提示) |
|---|---|---|
| Android / iOS | | |
| JavaScript | | |
| 微信小程序 | | |
| 微信小游戏 | | — |
| Unity | | |
| Unity微信小游戏 | | |
| 其他游戏引擎 | | — |
自动采集事件用途说明:
- 自动采集事件是SDK内置的自动上报机制;无需手动定义同名事件
- 示例:JavaScript SDK的自动采集页面浏览量;无需定义
ta_page_show、home_page_show等事件。about_page_show - 若模板已包含自动采集事件(例如行业模板中的),CLI不会注入重复事件
ta_app_install - 这些事件需要在阶段的SDK初始化时启用对应开关
ae-generate-tracking-code
草稿JSON示例:
json
{
"event_name": "ta_app_install",
"display_name": "应用安装",
"event_desc": "首次安装应用时触发;升级不触发;删除后重新安装触发",
"event_tag": "System Event",
"platform": "client",
"prop_names": [],
"source": "autotrack"
}注意:自动采集事件的始终为,因为只有客户端SDK具备自动采集能力。
platform"client"1.5 Persist + Generate xlsx
1.5 持久化 + 生成Excel
Must write draft.json first, then run draft command. Do not skip this step and run ae-cli tracking plan draft directly.
- Save draft to
.ae-cli/draft.json - ⚠️ Write : Set
meta.langbased on user's current language (draft.meta.lang/zh/en/ja), ensuring generated xlsx headers / sheet names / type values match the AE platform languageko - Must verify file was updated after writing (check file modification time or content); only generate xlsx after confirming new content
- Generate upload-ready xlsx:
bash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx必须先写入draft.json,再运行draft命令。不得跳过此步骤直接运行ae-cli tracking plan draft。
- 将草稿保存到
.ae-cli/draft.json - ⚠️ 写入:根据用户当前语言设置
meta.lang(draft.meta.lang/zh/en/ja),确保生成的Excel表头/工作表名称/类型值与AE平台语言一致ko - 必须验证写入后文件已更新(检查文件修改时间或内容);确认新内容后再生成Excel
- 生成可上传的Excel:
bash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx1.6 Rule Validation (must execute)
1.6 规则校验(必须执行)
Auto-validate during xlsx generation to ensure compliance with AE tracking plan rules:
bash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx --fixValidation rules:
| Rule | Description | Auto-fix |
|---|---|---|
| Display name uniqueness | Within same property pool, | ✅ Add distinguishing prefix |
| Object array consistency | Same | ✅ Fill missing sub-properties |
| snake_case | Event/property names must match | ❌ Manual fix needed |
| Property name uniqueness | Property names must not repeat | ❌ Manual fix needed |
| Event name uniqueness | Event names must not repeat | ✅ Remove later duplicates |
Validation flow:
- CLI auto-validates draft.json
- Fixable issues found → auto-fix → update draft.json → generate xlsx
- Non-fixable issues found → error; manual fix of draft.json needed
- No issues → proceed to Phase 1.7
Note: Display names can be the same across different property pools (e.g. can be both an event property and a user property).
vip_levelRelationship to Phase 0 existing_plan validation: The underlying rule engine is the same, but Phase 0 uses interactive 3-tier (Minor/Medium/Severe) because the user is present to confirm each fix. Phase 1.6 uses batch 2-tier (auto-fixable / manual-fix-needed) because it runs as part of the automated draft generation. Rules that are "Medium (needs confirmation)" in Phase 0 appear as "❌ Manual fix needed" here — the same rule, just without the interactive prompt.
生成Excel时自动校验,确保符合AE埋点方案规则:
bash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx --fix校验规则:
| 规则 | 描述 | 自动修复 |
|---|---|---|
| 显示名称唯一性 | 同一属性池内, | ✅ 添加区分前缀 |
| 对象数组一致性 | 不同事件中相同的 | ✅ 填充缺失的子属性 |
| snake_case规则 | 事件/属性名称必须匹配 | ❌ 需要手动修复 |
| 属性名称唯一性 | 属性名称不得重复 | ❌ 需要手动修复 |
| 事件名称唯一性 | 事件名称不得重复 | ✅ 删除后续重复项 |
校验流程:
- CLI自动校验draft.json
- 发现可修复问题→自动修复→更新draft.json→生成Excel
- 发现不可修复问题→报错;需要手动修复draft.json
- 无问题→进入阶段1.7
注意:不同属性池中的显示名称可以相同(例如可以同时是事件属性和用户属性)。
vip_level与阶段0现有方案校验的关系:底层规则引擎相同,但阶段0使用交互式三级(轻微/中等/严重),因为用户在场可确认每项修复。阶段1.6使用批量两级(可自动修复/需手动修复),因为它是自动草稿生成的一部分。阶段0中为「中等(需确认)」的规则在此处显示为「❌ 需要手动修复」——规则相同,只是没有交互式提示。
1.7 Show Summary
1.7 展示摘要
Display to user via markdown table: event count / event property pool size / super property count / user property count; show deliverable paths.
After displaying, tell user:
Phase 1 complete.
Next: Phase 2 — Refine to confirm the plan.通过Markdown表格向用户展示:事件数量 / 事件属性池大小 / 公共属性数量 / 用户属性数量;展示交付物路径。
展示后告知用户:
阶段1完成。
下一步:阶段2 — 优化方案并确认。📁 Template Lookup Convention
📁 模板查找规范
Run the following command to dynamically discover available templates:
bash
AE_LANG=<user_lang> ae-cli tracking plan list-templates --jsonLanguage rules: Template names and template business content must not be model-translated. Use localized names only when they are returned by the CLI or found in resources. If only returns the original template , display that name as-is and keep it unchanged for import. Before presenting or modifying any localized template-owned label, look it up in ; do not invent a translation.
src/tracking/i18nlist-templates --jsonnamesrc/tracking/i18nBuilt-in templates are resolved by ae-cli from the ae-cli package root. User templates are resolved from the ae-cli user template directory. Do not manually construct paths from the user's current workspace.
./tracking-plan-template/...Search directories in order:
- — bundled templates
<ae-cli package root>/tracking-plan-template/ - — user-provided template directory
~/.ae-cli/templates/
Each template prefers distilled file (if same-name exists, return md path; otherwise return xlsx path).
Display the template names returned by the CLI, and keep the exact from the JSON result for import. Auto-detect format on import:
.md.mdnamebash
AE_LANG=<user_lang> ae-cli tracking code import-template --template-name "<template name>" --out .ae-cli/draft.json运行以下命令动态发现可用模板:
bash
AE_LANG=<user_lang> ae-cli tracking plan list-templates --json语言规则:模板名称和模板业务内容不得通过模型翻译。仅当CLI返回或在资源中找到本地化名称时,才使用本地化名称。如果仅返回原始模板,则按原样显示该名称并保持不变用于导入。在展示或修改任何模板所属的本地化标签前,先在中查找;不得自行生成翻译。
src/tracking/i18nlist-templates --jsonnamesrc/tracking/i18n内置模板由ae-cli从ae-cli包根目录解析。用户模板从ae-cli用户模板目录解析。不得从用户当前工作区手动构造路径。
./tracking-plan-template/...搜索目录顺序:
- — 捆绑模板
<ae-cli package root>/tracking-plan-template/ - — 用户提供的模板目录
~/.ae-cli/templates/
每个模板优先选择提炼文件(如果存在同名文件,返回md路径;否则返回xlsx路径)。
展示CLI返回的模板名称,并使用JSON结果中的精确进行导入。导入时自动检测格式:
.md.mdnamebash
AE_LANG=<user_lang> ae-cli tracking code import-template --template-name "<template name>" --out .ae-cli/draft.jsonPhase 2 — Refine (5-segment loop)
阶段2 — 优化(5段循环)
In order, one conversation round per segment:
- sdk_config (SDK config + User identity, combined) — Show SDK integration mode, platform/language, visitor ID strategy, account ID source, corresponding SDK calls
- business (Business dimension + Business events, combined) — Show revenue model, core loop, functional entries, injected event modules (grouped by platform)
- autotrack (Auto-track events) — Show SDK auto-track events in a separate table, note enablement method
- common_props (Super properties) — Show all super properties, note usage scenarios and considerations
- props (Event properties + User properties) — Show event property pool grouped by event + user properties table
Per-segment flow:
- Display corresponding section of current draft
- Ask a segment-specific confirmation question. Always include the current segment number, current segment key, and next segment key:
For Segment 5:text
Segment <n>/5 <segment_key> confirmed? Reply ok to continue to Segment <n+1>/5 <next_segment_key>, or describe changes.textSegment 5/5 props confirmed? Reply ok to archive the plan and continue to Phase 3, or describe changes. - User gives natural language instructions → update → re-run:
.ae-cli/draft.jsonbashAE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx - User → proceed to next segment
ok
okokokUser may say "Go back to segment N" at any time to jump to any segment (N = 1-5).
按顺序进行,每段一轮对话:
- sdk_config(SDK配置 + 用户身份,合并) — 展示SDK集成模式、平台/语言、访客ID策略、账号ID来源、对应的SDK调用
- business(业务维度 + 业务事件,合并) — 展示收入模型、核心循环、功能入口、注入的事件模块(按平台分组)
- autotrack(自动采集事件) — 在单独表格中展示SDK自动采集事件,说明启用方式
- common_props(公共属性) — 展示所有公共属性,说明使用场景和注意事项
- props(事件属性 + 用户属性) — 展示按事件分组的事件属性池 + 用户属性表格
每段流程:
- 展示当前草稿的对应部分
- 询问该段专属的确认问题。必须包含当前段编号、当前段标识和下一段标识:
对于第5段:text
第<n>/5段 <segment_key> 确认完毕?回复ok继续到第<n+1>/5段 <next_segment_key>,或描述修改内容。text第5/5段 props 确认完毕?回复ok归档方案并继续到阶段3,或描述修改内容。 - 用户给出自然语言指令→更新→重新运行:
.ae-cli/draft.jsonbashAE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx - 用户回复→进入下一段
ok
okokok用户可随时说**「回到第N段」**跳转到任意段(N=1-5)。
sdk_config (Phase 2 Segment 1)
sdk_config(阶段2第1段)
Show SDK integration config + user identity system:
SDK Integration Config:
- Integration mode: <client_only / server_only / both / none>
- Client: <platform> (<language>)
- Server: <language>
User Identity Config:
- Account ID source: <user_account / role_id / none>
- Account ID field: <specific field>
- Visitor ID strategy: <auto / device_id / custom>
User ok / modify.
展示SDK集成配置 + 用户身份体系:
SDK集成配置:
- 集成模式:<client_only / server_only / both / none>
- 客户端:<平台>(<语言>)
- 服务端:<语言>
用户身份配置:
- 账号ID来源:<user_account / role_id / none>
- 账号ID字段:<具体字段>
- 访客ID策略:<auto / device_id / custom>
用户回复ok / 修改。
business (Phase 2 Segment 2)
business(阶段2第2段)
Show business dimensions + business events:
Business Dimensions:
- Revenue model: <IAA / IAP / mixed / subscription / commission>
- Core loop: <description>
- Functional entries: <list>
- Currency system: <hard currency / soft currency>
Injected Event Modules (grouped by platform):
Client events (platform=client):
- <event>: <display_name> — <event_desc>
- ...
Server events (platform=server):
- <event>: <display_name> — <event_desc>
- ...
Both-platform events (platform=both):
- <event>: <display_name> — <event_desc>Conflict detection: If business dimensions contradict source materials, prominently flag for user confirmation.
User ok / modify.
展示业务维度 + 业务事件:
业务维度:
- 收入模型:<IAA / IAP / mixed / subscription / commission>
- 核心循环:<描述>
- 功能入口:<列表>
- 货币体系:<硬通货 / 软通货>
注入的事件模块(按平台分组):
客户端事件(platform=client):
- <event>:<display_name> — <event_desc>
- ...
服务端事件(platform=server):
- <event>:<display_name> — <event_desc>
- ...
跨平台事件(platform=both):
- <event>:<display_name> — <event_desc>冲突检测:若业务维度与素材来源矛盾,突出标记供用户确认。
用户回复ok / 修改。
autotrack (Phase 2 Segment 3)
autotrack(阶段2第3段)
Only shown for or mode.
client_onlybothDisplay SDK auto-track event list, with notes:
- These events are auto-collected by the SDK; no manual track() calls needed during code generation — just enable corresponding switches during SDK init
- or
display_namecan be adjusted; event names cannot be changedevent_desc
User ok / modify.
仅在或模式下展示。
client_onlyboth展示SDK自动采集事件列表,并附带说明:
- 这些事件由SDK自动采集;代码生成期间无需手动调用track()——只需在SDK初始化时启用对应开关
- 或
display_name可调整;事件名称不可更改event_desc
用户回复ok / 修改。
common_props (Phase 2 Segment 4)
common_props(阶段2第4段)
Show all super properties ( / / / ).
namedisplay_nametypedescNotes:
- Super properties are attached to every event; ideal for business-wide global dimensions
- Common super properties (by app type):
- H5/Web: (source channel),
channel(referring domain)referrer_domain - Mobile App: ,
channel,app_versionplatform - Game: ,
channel,vip_levelserver_id - Mini-program: ,
channelscene
- H5/Web:
- Prohibited: Do NOT set SDK preset properties (prefix) as super properties
#
User ok / modify.
展示所有公共属性( / / / )。
namedisplay_nametypedesc说明:
- 公共属性附加到所有事件;适用于全业务全局维度
- 按应用类型划分的常见公共属性:
- H5/Web:(来源渠道)、
channel(来源域名)referrer_domain - 移动应用:、
channel、app_versionplatform - 游戏:、
channel、vip_levelserver_id - 小程序:、
channelscene
- H5/Web:
- 禁止:不得将SDK预置属性(前缀)设置为公共属性
#
用户回复ok / 修改。
props (Phase 2 Segment 5)
props(阶段2第5段)
Show event property pool (grouped by event) + user properties table:
- Event properties: /
name/display_name/type, grouped bydescevent_tag - User properties: /
name/display_name/type/update_typedesc
User property update methods:
| Update Method | Description | Use Case |
|---|---|---|
| Only set on first occurrence; subsequent updates ignored | First registration time, first payment time, first channel |
| Overwrite update; always takes latest value | Current level, current balance, nickname, VIP status |
| Numeric accumulation; suitable for cumulative values | Total recharge amount, total login days, total ads watched |
User ok → immediately execute archive command, then proceed to Phase 3.
展示按事件分组的事件属性池 + 用户属性表格:
- 事件属性:/
name/display_name/type,按desc分组event_tag - 用户属性:/
name/display_name/type/update_typedesc
用户属性更新方式:
| 更新方式 | 描述 | 使用场景 |
|---|---|---|
| 仅首次设置;后续更新被忽略 | 首次注册时间、首次支付时间、首次来源渠道 |
| 覆盖更新;始终取最新值 | 当前等级、当前余额、昵称、VIP状态 |
| 数值累加;适用于累计值 | 累计充值金额、累计登录天数、累计观看广告次数 |
用户回复ok → 立即执行归档命令,然后进入阶段3。
Refine Phase Heuristic Suggestions
优化阶段启发式建议
- Super properties vs Event properties: Property appears on 3+ events → promote to super property; super properties are suitable for business-wide global dimensions (,
channel,vip_level)ab_test_group - Prohibited: Do NOT set SDK preset properties (prefix) as super properties
# - Events must have properties: Every event must have at least one semantically meaningful, describable property
- Nested properties: parent properties have
array_rowsub-properties describing a group of objectsparent.child
- 公共属性 vs 事件属性:属性出现在3个以上事件中→提升为公共属性;公共属性适用于全业务全局维度(、
channel、vip_level)ab_test_group - 禁止:不得将SDK预置属性(前缀)设置为公共属性
# - 事件必须包含属性:每个事件必须至少包含一个语义明确、可描述的属性
- 嵌套属性:父属性包含
array_row子属性,描述一组对象parent.child
Post-Phase 2 — Pre-delivery Self-check
阶段2后 — 交付前自检
⚠️ Before uploading to AE, must complete the following self-check. Fix any issues before uploading.
⚠️ 上传到AE前必须完成以下自检。修复所有问题后再上传。
Naming Convention Check
命名规范检查
- Do event/property names start with a letter?
- Do event/property names contain only letters, digits, and underscores (no Chinese, no spaces)?
- Are there duplicate event names or synonymous events coexisting (e.g. and
order_create)?create_order - Does the same property name map to multiple display names or types?
- Does every event, event property, common event property, and user property have a non-empty in the user's language?
display_name
- 事件/属性名称是否以字母开头?
- 事件/属性名称是否仅包含字母、数字和下划线(无中文、无空格)?
- 是否存在重复事件名称或同义事件共存(例如和
order_create)?create_order - 同一属性名称是否映射到多个显示名称或类型?
- 每个事件、事件属性、公共事件属性和用户属性是否包含用户语言的非空?
display_name
Revenue Model Required Events Check
收入模型必填事件检查
| Revenue Model | Must Include Events | Check |
|---|---|---|
| IAA | | [ ] |
| IAP | | [ ] |
| All IAA + IAP events | [ ] |
| | [ ] |
| commission | | [ ] |
| 收入模型 | 必须包含事件 | 检查 |
|---|---|---|
| IAA | | [ ] |
| IAP | | [ ] |
| 所有IAA + IAP事件 | [ ] |
| | [ ] |
| commission | | [ ] |
Paired Event Consistency Check
配对事件一致性检查
Start/end paired events (e.g. /) must carry same-name, same-structure object arrays:
battle_startbattle_end- Object array sub-properties reported by start event must be same name and same type in end event
- Check: stage pairs (/
stage_start), battle pairs (stage_complete/battle_start), gacha pairs (battle_end/gacha_draw), etc.hero_get
开始/结束配对事件(例如/)必须携带同名、同结构的对象数组:
battle_startbattle_end- 开始事件上报的对象数组子属性必须与结束事件中的子属性名称和类型相同
- 检查:关卡配对(/
stage_start)、战斗配对(stage_complete/battle_start)、抽卡配对(battle_end/gacha_draw)等hero_get
Unit Description Check
单位描述检查
- Are monetary fields annotated with unit (cents/USD)?
- Are duration fields annotated with unit (seconds/milliseconds)?
- Are balance fields annotated as post-recharge balance or pre-operation balance?
- 货币字段是否标注单位(分/美元)?
- 时长字段是否标注单位(秒/毫秒)?
- 余额字段是否标注为充值后余额或操作前余额?
Enum Value Check
枚举值检查
- Are enum values listed in event description (≤ 10 values)?
- For > 10 values, is there a note to use a dimension table?
- Is the null-value fallback strategy documented (e.g. "unknown channel → use ")?
unknown
- 事件描述中是否列出枚举值(≤10个值)?
- 若超过10个值,是否注明使用维度表?
- 是否记录空值回退策略(例如:"未知渠道→使用")?
unknown
Object Array Usage Check
对象数组使用检查
Only use object arrays () when ALL THREE conditions are met; otherwise use object or plain properties:
array_row- An event property has multiple same-type entities to record
- Each entity needs ≥ 2 properties recorded
- Entity count is variable
仅当全部三个条件满足时才使用对象数组();否则使用对象或普通属性:
array_row- 事件属性需要记录多个同类型实体
- 每个实体需要记录≥2个属性
- 实体数量可变
Object Usage Check
对象使用检查
Use object () when the following condition is met; distinguish from object arrays:
object- One-to-one relationship → use : e.g. user's current "equipment" details, player's "current deployed hero" (only one)
object - One-to-many relationship → use : e.g. "backpack items" list, "lineup heroes" list (multiple)
array_row
Quick rule: data shaped like → use ; data shaped like → use .
{...}object[{...}]array_row满足以下条件时使用对象();与对象数组区分:
object- 一对一关系→使用:例如用户当前的「装备」详情、玩家「当前部署的英雄」(仅一个)
object - 一对多关系→使用:例如「背包物品」列表、「阵容英雄」列表(多个)
array_row
快速规则:数据格式为→使用;数据格式为→使用。
{...}object[{...}]array_rowPost-Phase 2 — Archive
阶段2后 — 归档
After all 5 Refine segments are confirmed (user on Segment 5), archive immediately; do not skip or delay:
okbash
AE_LANG=<user_lang> ae-cli tracking plan archive --draft .ae-cli/draft.json --xlsx .ae-cli/draft.xlsx --name "<plan_name>"| Parameter | Description | Example |
|---|---|---|
| draft.json path (required) | |
| draft.xlsx path (required) | |
| Plan name used as output filename prefix (required) | |
Output lands at ; is updated with .
plans/<date>-<plan_name>.xlsxdraft.jsonmeta.archived_atAfter archiving, tell user:
✅ Archive complete
File path: plans/<date>-<plan_name>.xlsx
Next: Phase 3 — Upload to AE:
1. Login to AE to get token
2. Get AE project ID
3. Upload plan to AE⚠️ Hard rule: Archive must complete before entering Phase 3. Before Phase 3.1's first question, must confirm exists.
meta.archived_at所有5个优化段确认完毕后(用户回复第5段),立即归档;不得跳过或延迟:
okbash
AE_LANG=<user_lang> ae-cli tracking plan archive --draft .ae-cli/draft.json --xlsx .ae-cli/draft.xlsx --name "<plan_name>"| 参数 | 描述 | 示例 |
|---|---|---|
| draft.json路径(必填) | |
| draft.xlsx路径(必填) | |
| 用作输出文件名前缀的方案名称(必填) | |
输出文件位于;将更新字段。
plans/<date>-<plan_name>.xlsxdraft.jsonmeta.archived_at归档后告知用户:
✅ 归档完成
文件路径:plans/<date>-<plan_name>.xlsx
下一步:阶段3 — 上传到AE:
1. 登录AE获取令牌
2. 获取AE项目ID
3. 将方案上传到AE⚠️ 硬性规则:进入阶段3前必须完成归档。阶段3.1的第一个问题前,必须确认存在。
meta.archived_atPhase 3 — Token & projectId
阶段3 — 令牌与项目ID
At the start of Phase 3, tell user:
undefined阶段3开始时告知用户:
undefinedPhase 3 — Upload Preparation
阶段3 — 上传准备
Next steps:
- Check active AE host and login status
- Login to AE to get token if needed
- AE project ID
undefined下一步:
- 检查当前AE主机和登录状态
- 若需登录AE获取令牌
- 获取AE项目ID
undefined3.1 Check Active AE Host and Login Status
3.1 检查当前AE主机和登录状态
Do not ask for the AE web address first. ae-cli stores an active AE host, and auth commands can use it directly.
First check current auth/host status:
bash
ae-cli auth statusIf an active host is configured, save that host to . If reports , skip login and continue to project ID.
.ae-cli/draft.jsonmeta.hostauth statusauthenticated: trueOnly if ae-cli reports no active host / no AE host configured, ask the user:
"What is the AE web address?"
After user responds, configure it and save the same value to :
.ae-cli/draft.jsonmeta.hostbash
ae-cli config set-host <host>If reports unauthenticated, use the agent split-flow. Do not run blocking directly from an AI agent.
auth statusae-cli auth loginStep 1 — request an authorization URL and return control to the user:
bash
ae-cli auth login --no-waitShow the returned to the user and ask them to complete authorization. Keep the returned for the next step.
verification_urldevice_codeStep 2 — after the user says authorization is complete, finish login:
bash
ae-cli auth login --device-code <device_code>
ae-cli auth statusDo not retry with unless the previous command explicitly failed because no active host was configured. In that case, configure the host first, then restart the split-flow with .
ae-cli auth login --host <host>--no-waitCommon error tips and self-recovery:
| Error | Cause | What to Tell the User |
|---|---|---|
| The agent runtime cannot reach the authorization service | Report that no device code was created and include the exact error |
| A legacy browser-token flow was attempted | Retry the split-flow device-code login; do not ask the user for browser tokens |
| A legacy browser-token flow was attempted | Retry the split-flow device-code login; do not ask the user to open Chrome |
Token cached for 20 hours; same host avoids re-auth.
不得先询问AE网页地址。ae-cli存储当前AE主机,认证命令可直接使用。
首先检查当前认证/主机状态:
bash
ae-cli auth status若已配置当前主机,将该主机保存到的。若显示,跳过登录直接进入项目ID环节。
.ae-cli/draft.jsonmeta.hostauth statusauthenticated: true仅当ae-cli报告无当前主机/未配置AE主机时,询问用户:
「AE网页地址是什么?」
用户回复后,配置主机并将相同值保存到的:
.ae-cli/draft.jsonmeta.hostbash
ae-cli config set-host <host>若显示未认证,使用Agent分流流程。不得直接从AI代理运行阻塞式。
auth statusae-cli auth login步骤1 — 请求授权URL并将控制权交还给用户:
bash
ae-cli auth login --no-wait向用户展示返回的并要求完成授权。保留返回的用于下一步。
verification_urldevice_code步骤2 — 用户告知授权完成后,完成登录:
bash
ae-cli auth login --device-code <device_code>
ae-cli auth status除非前一个命令明确因未配置当前主机而失败,否则不得使用重试。若出现该情况,先配置主机,然后使用重启分流流程。
ae-cli auth login --host <host>--no-wait常见错误提示与自我恢复:
| 错误 | 原因 | 告知用户内容 |
|---|---|---|
| Agent运行时无法连接到授权服务 | 报告未创建设备代码并包含精确错误信息 |
| 尝试了旧版浏览器令牌流程 | 重试分流式设备代码登录;不得要求用户提供浏览器令牌 |
| 尝试了旧版浏览器令牌流程 | 重试分流式设备代码登录;不得要求用户打开Chrome |
令牌缓存20小时;同一主机无需重新认证。
3.2 Get AE Project ID and Update Draft
3.2 获取AE项目ID并更新草稿
Ask user: "What is the AE project ID? Go to AE Admin → 'Project Settings' → 'Integration Config' → copy 'Project ID', or check the AE system URL parameter currentProjectId=<id>"
After user provides projectId, update .
.ae-cli/draft.jsonmeta.project_id询问用户:「AE项目ID是什么?前往AE管理后台→『项目设置』→『集成配置』→复制『项目ID』,或查看AE系统URL参数currentProjectId=<id>」
用户提供projectId后,更新的。
.ae-cli/draft.jsonmeta.project_idPhase 4 — Upload
阶段4 — 上传
At the start of Phase 4, tell user:
undefined阶段4开始时告知用户:
undefinedPhase 4 — Upload to AE
阶段4 — 上传到AE
Checking project's existing plan...
undefined检查项目现有方案...
undefined4.1 Check Project's Existing Plan
4.1 检查项目现有方案
Before uploading, check if the project already has a tracking plan:
bash
AE_LANG=<user_lang> ae-cli tracking plan fetch --project <projectId> > .ae-cli/existing-plan.jsonDo not add here unless the user explicitly provides a reachable override for this command. In agent sandboxes, ae-cli can resolve the request host from the sandbox-provisioned ; passing a stale Kubernetes internal host can bypass that fallback.
--hostcli-token.jsonResult assessment:
- File empty or command error → project has no plan; upload directly
404 - File has content → project has an existing plan; show summary + conflict detection
When existing plan exists, display:
Project already has a tracking plan:
- Events: XX
- Event properties: YY
- Super properties: ZZ
- User properties: WW
Choose upload mode:
1. Append (keep existing plan, add new events/properties)
2. Replace (delete existing plan, upload new plan)
Append / Replace?上传前检查项目是否已有埋点方案:
bash
AE_LANG=<user_lang> ae-cli tracking plan fetch --project <projectId> > .ae-cli/existing-plan.json除非用户明确为此命令提供可访问的覆盖主机,否则不得添加。在Agent沙箱中,ae-cli可从沙箱提供的解析请求主机;传递过时的Kubernetes内部主机可能绕过该回退机制。
--hostcli-token.json结果评估:
- 文件为空或命令报错→项目无方案;直接上传
404 - 文件有内容→项目已有方案;展示摘要 + 冲突检测
当项目已有方案时,展示:
项目已存在埋点方案:
- 事件:XX
- 事件属性:YY
- 公共属性:ZZ
- 用户属性:WW
选择上传模式:
1. 追加(保留现有方案,添加新事件/属性)
2. 替换(删除现有方案,上传新方案)
追加 / 替换?4.2 Append Mode Conflict Detection
4.2 追加模式冲突检测
When user chooses "Append", must detect conflicts (AE merge-by-name has silent discard risk):
Read two files:
- Existing plan:
.ae-cli/existing-plan.json - New plan:
.ae-cli/draft.json
Detect two types of conflicts:
当用户选择「追加」时,必须检测冲突(AE按名称合并存在静默丢弃风险):
读取两个文件:
- 现有方案:
.ae-cli/existing-plan.json - 新方案:
.ae-cli/draft.json
检测两种冲突类型:
Conflict Type A: Same-name property type mismatch (severe)
冲突类型A:同名属性类型不匹配(严重)
AE rule: Same-name properties must have the same type, otherwise reported data will be discarded.
Detection logic:
Compare / / three property pools:
event_propertiescommon_event_propertiesuser_properties- For each property in the new plan, find same-name property in existing plan
- If same name but different type → record as (severe error)
property_type_conflict
Conflict display:
⚠️ Severe conflict: Same-name property type mismatch
The following properties have different types in the existing plan vs. new plan.
Appending will cause reported data to be discarded:
| Property Name | Existing Type | New Plan Type |
|---|---|---|
| order_amount | number | string |
| vip_level | string | number |
Suggestions:
1. Modify the new plan's property types to match the existing plan
2. Or choose "Replace" mode to redefine types
Continue append (without fixing) / Modify draft / Switch to replace?AE规则:同名属性必须具有相同类型,否则上报数据将被丢弃。
检测逻辑:
比较 / / 三个属性池:
event_propertiescommon_event_propertiesuser_properties- 对于新方案中的每个属性,在现有方案中查找同名属性
- 若名称相同但类型不同→记录为(严重错误)
property_type_conflict
冲突展示:
⚠️ 严重冲突:同名属性类型不匹配
以下属性在现有方案与新方案中的类型不同。
追加将导致上报数据被丢弃:
| 属性名称 | 现有类型 | 新方案类型 |
|---|---|---|
| order_amount | number | string |
| vip_level | string | number |
建议:
1. 修改新方案的属性类型以匹配现有方案
2. 或选择「替换」模式重新定义类型
继续追加(不修复) / 修改草稿 / 切换为替换?Conflict Type B: Same-name events (advisory)
冲突类型B:同名事件(提示)
AE merge-by-name: Same-name events are not overwritten; new-name events are added.
Detection logic:
For each event in the new plan, find same-name event in existing plan:
- If same-name event exists → record as (advisory, not an error)
event_exists
Conflict display (advisory only):
⚠️ Advisory: The following events already exist in the project (append mode will not overwrite)
- user_login (existing: 2 properties, new plan: 3 properties)
- order_create (existing: 5 properties, new plan: 5 properties)
After append:
- Existing event property associations will not change
- New properties for existing events will not be added
- New events will be added normally
Continue append? yes / noAE按名称合并:同名事件不会被覆盖;新名称事件将被添加。
检测逻辑:
对于新方案中的每个事件,在现有方案中查找同名事件:
- 若存在同名事件→记录为(提示,非错误)
event_exists
冲突展示(仅提示):
⚠️ 提示:以下事件已存在于项目中(追加模式不会覆盖)
- user_login(现有:2个属性,新方案:3个属性)
- order_create(现有:5个属性,新方案:5个属性)
追加后:
- 现有事件的属性关联不会改变
- 现有事件的新属性不会被添加
- 新事件将正常添加
继续追加?是 / 否4.3 Upload Flow
4.3 上传流程
Decide based on conflict detection results:
| Detection Result | Action |
|---|---|
| No conflicts | Upload directly |
| Advisory only (Type B) | Upload after user confirmation |
| Severe conflict (Type A) | User fixes or switches to replace |
Upload command:
bash
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]- With : Delete existing project plan first then upload (when user chooses "Replace", or severe conflict switches to replace)
--replace - Without : AE merge-by-name merge (no conflicts, or advisory only with user confirmation to append)
--replace
Upload commands MUST pass explicitly. must match the generated xlsx language and ; is only used for CLI messages and xlsx regeneration context. Do not call AE user language config APIs and do not use . If the xlsx language is wrong, regenerate the xlsx with the intended language before uploading:
--lang <user_lang>--langdraft.meta.langAE_LANG--switch-langbash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]On successful upload, prompt user to verify in AE Admin. Provide the full URL (tracking plan page URL format: ).
https://<host>/#/data/planThen read the uploaded plan back through ae-cli and synchronize its display names to any event/property metadata
that already exists in the project:
bash
AE_LANG=<user_lang> ae-cli tracking plan get --project-id <projectId> --host <host>
AE_LANG=<user_lang> ae-cli tracking plan sync-display-names \
--project-id <projectId> \
--draft .ae-cli/draft.json \
--host <host>sync-display-names- It fills only blank event/property metadata display names.
- It never overwrites a non-empty display name already maintained in AE.
- means that the event/property has not appeared in project metadata yet; it is not an upload failure. Report those names and rerun the same command after the first Debug or production data reaches AE.
missing_in_metadata - means the generated plan is incomplete. Add the missing localized
missing_display_name_in_draft, regenerate/validate the xlsx, and rerun the upload/synchronization flow.display_name
根据冲突检测结果决定操作:
| 检测结果 | 操作 |
|---|---|
| 无冲突 | 直接上传 |
| 仅提示(类型B) | 用户确认后上传 |
| 严重冲突(类型A) | 用户修复或切换为替换模式 |
上传命令:
bash
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]- 带:先删除现有项目方案再上传(当用户选择「替换」,或严重冲突切换为替换模式时)
--replace - 不带:AE按名称合并(无冲突,或仅提示且用户确认追加)
--replace
上传命令必须显式传递。必须与生成的Excel语言和匹配;仅用于CLI消息和Excel重新生成上下文。不得调用AE用户语言配置API,不得使用。若Excel语言错误,上传前重新生成Excel:
--lang <user_lang>--langdraft.meta.langAE_LANG--switch-langbash
AE_LANG=<user_lang> ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]上传成功后,提示用户在AE管理后台验证。提供完整URL(埋点方案页面URL格式:)。
https://<host>/#/data/plan然后通过ae-cli读取上传后的方案,并将其显示名称同步到项目中已存在的任何事件/属性元数据:
bash
AE_LANG=<user_lang> ae-cli tracking plan get --project-id <projectId> --host <host>
AE_LANG=<user_lang> ae-cli tracking plan sync-display-names \
--project-id <projectId> \
--draft .ae-cli/draft.json \
--host <host>sync-display-names- 仅填充空白的事件/属性元数据显示名称。
- 绝不会覆盖AE中已维护的非空显示名称。
- 表示事件/属性尚未出现在项目元数据中;这不是上传失败。 报告这些名称,并在首次调试或生产数据到达AE后重新运行相同命令。
missing_in_metadata - 表示生成的方案不完整。添加缺失的本地化
missing_display_name_in_draft, 重新生成/校验Excel,然后重新运行上传/同步流程。display_name
4.4 Upload Failure Handling and Auto-fix
4.4 上传失败处理与自动修复
Use option on upload (enabled by default); CLI auto-detects and fixes errors:
--auto-fixbash
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]上传时使用选项(默认启用);CLI自动检测并修复错误:
--auto-fixbash
AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae-cli/draft.xlsx --draft .ae-cli/draft.json --lang <user_lang> [--replace]AE API Error Types
AE API错误类型
| Error Type | Description | Auto-fix |
|---|---|---|
| Event property display name duplicate | ✅ Add distinguishing prefix |
| Object array sub-property inconsistency | ✅ Fill missing sub-properties |
| Event name duplicate | ✅ Remove later duplicates |
| Property type mismatch (append mode) | ❌ Switch to replace mode |
| 错误类型 | 描述 | 自动修复 |
|---|---|---|
| 事件属性显示名称重复 | ✅ 添加区分前缀 |
| 对象数组子属性不一致 | ✅ 填充缺失的子属性 |
| 事件名称重复 | ✅ 删除后续重复项 |
| 属性类型不匹配(追加模式) | ❌ 切换为替换模式 |
Auto-fix Flow
自动修复流程
CLI auto-executes:
- Upload xlsx to TE
- Check if has errors
eventErrorMap - Fixable errors → auto-fix draft.json → regenerate xlsx → re-upload
- Loop up to 3 times; prompt user for manual intervention if exceeded
Example output:
🔧 Auto-fixing upload errors (attempt 1/3)...
Fixed: Fixed object array sub-property inconsistency, Fixed display name duplicate
[plan-upload] regenerated: .ae-cli/draft.xlsxCLI自动执行:
- 将Excel上传到TE
- 检查是否有错误
eventErrorMap - 可修复错误→自动修复draft.json→重新生成Excel→重新上传
- 最多循环3次;若超过次数提示用户手动干预
示例输出:
🔧 自动修复上传错误(尝试1/3)...
已修复:修复对象数组子属性不一致,修复显示名称重复
[plan-upload] 已重新生成:.ae-cli/draft.xlsx4.5 Post-success Actions
4.5 上传成功后操作
After successful upload and display-name synchronization, prompt user to verify in AE Admin. Provide the full URL
(tracking plan page URL format: ). Include a short synchronization summary:
updated counts, preserved existing counts, and any names still missing from project metadata.
https://<host>/#/data/planAsk about generating tracking code:
The tracking plan has been uploaded successfully. Would you like to generate tracking code next?
- Yes → guide user to use the skill
ae-generate-tracking-code - No → inform user of plan archive location: ; can continue anytime
plans/<date>-<plan_name>.xlsx
上传成功并完成显示名称同步后,提示用户在AE管理后台验证。提供完整URL
(埋点方案页面URL格式:)。包含简短的同步摘要:
更新数量、保留的现有数量以及仍未出现在项目元数据中的名称。
https://<host>/#/data/plan询问是否生成埋点代码:
埋点方案已上传成功。是否要继续生成埋点代码?
- 是 → 引导用户使用技能
ae-generate-tracking-code - 否 → 告知用户方案归档位置:;可随时继续
plans/<date>-<plan_name>.xlsx
Prohibitions
禁止操作
- Asking all anchor questions at once
- Skipping Phase 3 and uploading directly
- Manually assembling xlsx bypassing
.ae-cli/draft.json - Translating "Super Property" as "超级属性" in any user-facing output (interaction prompts, plan summaries, event/property descriptions) — the correct AE Chinese term is "公共事件属性" or "公共属性"
- Calling AE API directly within the skill — all AE communication must go through project scripts / CLI
fetch
- 一次性询问所有锚点问题
- 跳过阶段3直接上传
- 绕过手动组装Excel
.ae-cli/draft.json - 在任何面向用户的输出(交互提示、方案摘要、事件/属性描述)中将"Super Property"翻译为「超级属性」——AE官方中文术语为「公共事件属性」或「公共属性」
- 在技能中直接调用AE API——所有AE通信必须通过项目脚本/CLI进行
fetch
Internal Reference (contributor use; not skill usage paths)
内部参考(贡献者使用;非技能使用路径)
- — AE backend endpoint capture documentation
skills/ae-generate-tracking-plan/references/te-api.md - — xlsx format contract (writer rules + reader compatibility)
skills/ae-generate-tracking-plan/references/xlsx-schema.md - — SDK auto-track event definitions (per-platform event lists + SDK type mapping)
skills/ae-generate-tracking-plan/references/autotrack-events.md - — Business dimension → event/property mapping table (revenue model / functional entries / currency system → injected events)
skills/ae-generate-tracking-plan/references/business-dimension-mapping.md - — Draft TypeScript type definitions
src/plan/types.ts
- — AE后端端点捕获文档
skills/ae-generate-tracking-plan/references/te-api.md - — Excel格式契约(写入规则 + 读取兼容性)
skills/ae-generate-tracking-plan/references/xlsx-schema.md - — SDK自动采集事件定义(按平台事件列表 + SDK类型映射)
skills/ae-generate-tracking-plan/references/autotrack-events.md - — 业务维度→事件/属性映射表(收入模型 / 功能入口 / 货币体系→注入事件)
skills/ae-generate-tracking-plan/references/business-dimension-mapping.md - — 草稿TypeScript类型定义
src/plan/types.ts