Ae Generate Tracking Code
Interactive generation of AE tracking code, LogBus2 configuration, and debug scripts from a tracking plan. Trigger words: 代码埋点、埋点代码、tracking code、埋点落地、logbus 配置、AE 上报代码、generate tracking code、insert tracking、トラッキングコード、트래킹 코드. Supports independent output mode selection per platform (insert/snippet). Server-side defaults to LoggerConsumer + LogBus2 architecture.
- Skill ID
- thinkingaiagenticengine/ae-cli/ae-generate-tracking-code
- Publisher
- thinkingaiagenticengine
- Repository
- ae-cli
- Installs
- 0
- Files
- 12
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
thinkingaiagenticengine/ae-cli/ae-generate-tracking-codeInstalls these files- SKILL.md
- references/autotrack-enum.md
- references/client-sdk-insert.md
- references/datax-config.md
- references/debug-script.md
- references/logbus-config.md
- references/modes.md
- references/restful-call.md
- references/sdk-index.md
- references/server-sdk-insert.md
- references/snippet-delivery.md
- references/te-api.md
What this skill tells the agent
ae-generate-tracking-code
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, code comments, etc. ⚠️ CRITICAL: Many reference documents (wiki SDK docs, code examples) contain Chinese text. When reading Chinese source material to answer an English/Japanese user, you MUST translate headings, descriptions, and comments to the user's language. The source document's language is NOT the user's language. Use the Terminology Glossary above to map terms accurately. Do NOT copy Chinese text verbatim from this document into English/Japanese replies. Document link language: When providing official documentation URLs, uselan=zh-CNfor Chinese users,lan=en-USfor all others.
Terminology Glossary
| 中文 | English | Notes |
|---|---|---|
| 埋点方案 | Tracking Plan | AE project-level event/property definitions |
| 代码埋点 | Tracking Code Generation | Generating SDK/LogBus code from a plan |
| 埋点代码 | Tracking Code | The generated SDK init + track() calls + helpers |
| 输出方式 | Output Mode | insert (inject) or snippet (file delivery) |
| 插入 | Insert | Direct code injection into the user's project |
| 片段 / 代码片段 | Snippet | Code delivered as files under .ae-cli/output/ |
| 采集端 | Collection Platform / Platform | Where events are sent from: client, server, or both |
| 客户端 | Client | Client-side SDK (Android/iOS/Web/etc.) |
| 服务端 | Server | Server-side SDK (Java/Python/Go/etc.) |
| 两端都采集 | Both | Events collected from both client and server |
| SDK 集成模式 | SDK Integration Mode | client_only / server_only / both |
| 用户体系 | User Identity System | distinct_id / account_id strategy |
| 校验脚本 | Validation / Debug Script | Test code to verify tracking works |
| LogBus2 配置 | LogBus2 Configuration | daemon.json for LogBus2 log sync tool |
| LoggerConsumer | LoggerConsumer | Server SDK consumer that writes events to local log files |
| BatchConsumer | BatchConsumer | Server SDK consumer that uploads events in batches |
| 公共属性 | Super Property | Properties attached to all events automatically. ⚠️ The correct Chinese AE term is "公共属性" or "公共事件属性". Never translate "Super Property" as "超级属性" — that is NOT a valid AE term. |
| 预置属性 | Preset Property | System properties prefixed with # (e.g. #device_id, #time) |
| 事件属性 | Event Property | Custom properties on specific events |
| 用户属性 | User Property | Properties set on the user profile |
| 上报地址 | SERVER_URL | Data ingestion endpoint (different from web URL!) |
| APP_ID | APP_ID | Application ID from AE Admin → "Integration Config" |
| project_id | Project ID | AE project identifier (≠ APP_ID) |
| 自动采集 | Auto-track | Auto-collected events (app install, start, view, click) |
| 埋点方案上传 | Plan Upload | Upload tracking plan xlsx to AE |
When to Trigger
Trigger when user says: "generate tracking code / help me add web tracking / generate logbus config / server-side reporting code" etc. Supports multiple platforms with independent output mode selection per platform.
Phase 0 — Anchor (one question per message)
Pre-check: Read existing configuration from draft.json
First, check if .ae-cli/draft.json exists and read existing configuration:
| Config Item | draft.json Field | Handling |
|---|---|---|
| AE projectId | meta.project_id | Has value → confirm; missing → ask |
| AE web address | meta.host | Has value → confirm; missing → ask |
| SERVER_URL | meta.server_url | Has value → confirm; missing → try lookup from project config, then ask if unavailable |
| APP_ID | meta.app_id | Has value → confirm; missing → try lookup from accessible project list, then ask if unavailable |
| SDK integration mode | meta.sdk_integration_mode | Has value → use directly |
| Client SDK type | meta.client_platforms (preferred) or meta.client_sdk_type | Has value → use directly |
| Server language | meta.server_language | Has value → use directly |
| User identity system | meta.user_identity | Has value → use directly |
Important: project_id ≠ APP_ID, and host ≠ SERVER_URL. Even if project_id and host are already set, SERVER_URL and APP_ID must still be resolved and confirmed separately. Prefer lookup first; ask the user only when lookup is unavailable or ambiguous.
Multi-platform support:
- If
client_platformsexists (array): multi-platform scenario — generate code for each platform - If only
client_sdk_typeexists: single platform (backward compatible) - Example:
client_platforms: ["android", "openharmony"]→ generate code for Android + OpenHarmony
Language support:
- Android SDK: supports Java / Kotlin (can generate both)
- iOS SDK: supports Objective-C / Swift (can generate both)
- Other SDKs: fixed language, no selection needed
Language configuration source:
- Prefer
meta.client_platform_languages(e.g.{"android": ["java", "kotlin"]}) - If not configured, ask user for Android/iOS platforms only
Confirmation flow:
- Has value → ask "Confirm using draft.json config: <value>? yes / enter new value"
- User says
yes→ use draft value - User enters new value → update draft.json and use new value
Required configuration (must resolve and confirm each item)
⚠️ Key: SERVER_URL and APP_ID are independent config items. Even if draft.json has project_id and host, you MUST resolve and confirm them. `project_id` ≠ `APP_ID`, `host` ≠ `SERVER_URL`.
- APP_ID — Prefer automatic lookup before asking:
- If
meta.project_idis known, runae-cli project info listonce for the current host. - Find the project whose
projectIdmatchesmeta.project_id. - If the matched project has
appId, ask: "I found APP_ID `<appId>` for project `<projectId>`. Use it? yes / enter new value" - If the project is missing, ambiguous, or has no
appId, ask the user to copy APP_ID from AE Admin → "Project Settings" → "Integration Config".
- SERVER_URL — Data ingestion endpoint (different from web URL; go to AE Admin → "Project Settings" → "Integration Config" → fill in "Public URL")
- If
meta.project_idis known, you may tryae-cli project info get --project-id <project_id>once. - Use the returned value only if the response explicitly contains a receiver URL field such as
serverUrl,pushUrl,push_url,receiverUrl,publicUrl,publicReceiverAddress,privateReceiverAddress, or equivalent ingestion endpoint field. - If both
publicReceiverAddressandprivateReceiverAddressare present, preferpublicReceiverAddressasSERVER_URLfor generated snippets unless the user explicitly needs an internal/private-network receiver. - If a value is found, ask: "I found SERVER_URL `<url>` for project `<projectId>`. Use it? yes / enter new value"
- ⚠️ "Public URL" only shows if previously filled in; if empty, this field won't display
- Solution: ask ops for the URL, or skip this step (use
SERVER_URLorPUSH_URLplaceholder in code)
host handling (optional):
- If you need to fetch plan from AE (no local draft.json) → ask for host
- If local draft.json exists → host is not required for code generation
- Before Debug validation, run
ae-cli config currentand confirm the active host matches the target AE environment; if it does not, runae-cli config set-host <AE_HOST> - Complete Debug validation with
ae-cli tracking debug-deviceandae-cli tracking debug-databy default; only hint the user to open the AE Debug page when those CLI capabilities are unavailable
If only xlsx file exists (no draft.json)
First, check if both .ae-cli/draft.json and .ae-cli/draft.xlsx exist:
If both are missing — the current environment hasn't generated a tracking plan yet. Remind user of two options:
More from thinkingaiagenticengine
Use this skill in a project
Open any RiverX project, search the Skills panel for thinkingaiagenticengine/ae-cli/ae-generate-tracking-code, and install it in one click.
