@thinkingai/ae-cli 6.1.30 → 6.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +11 -5
  2. package/README.zh.md +11 -5
  3. package/bin/ai-monitor.js +2 -0
  4. package/dist/ai-monitor-MKMHSSNI.js +32 -0
  5. package/dist/ai-monitor.js +135 -0
  6. package/dist/{auth-ADZHUIJR.js → auth-CZHHPZOQ.js} +10 -9
  7. package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
  8. package/dist/{capability-QXFRJYZD.js → capability-64KVJFIA.js} +27 -31
  9. package/dist/{chunk-YULUBP3R.js → chunk-3ULDJJTZ.js} +1 -1
  10. package/dist/{chunk-HRUOV6EQ.js → chunk-4XKTRCRK.js} +15 -15
  11. package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
  12. package/dist/chunk-6M7ZEDT2.js +182 -0
  13. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  14. package/dist/chunk-BNBCMCYN.js +563 -0
  15. package/dist/chunk-CF6JTT2U.js +64 -0
  16. package/dist/{chunk-CG773QXN.js → chunk-DWBYNGSR.js} +564 -314
  17. package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
  18. package/dist/{chunk-TFORY6WY.js → chunk-FCAA7I2D.js} +2 -2
  19. package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
  20. package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
  21. package/dist/chunk-IDDWEZ7F.js +1285 -0
  22. package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
  23. package/dist/{chunk-AVXDJAFC.js → chunk-NLEXY2TM.js} +47 -12
  24. package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
  25. package/dist/{chunk-EUFP4M2A.js → chunk-T7WF4HYW.js} +84 -32
  26. package/dist/{chunk-Y3AM6LIO.js → chunk-TMQGS4TO.js} +15 -10
  27. package/dist/{compat-check-HERBTQZN.js → compat-check-ZJNCMNQV.js} +2 -2
  28. package/dist/{config-E3KANXMK.js → config-FSH2NMNZ.js} +25 -12
  29. package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
  30. package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
  31. package/dist/index.js +81 -583
  32. package/dist/{memory-SNFR5M23.js → memory-VEZZVAAP.js} +4 -4
  33. package/dist/{metadata-EXQYDZTH.js → metadata-3IWHX3V4.js} +7 -7
  34. package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
  35. package/dist/{personal-semantic-preference-ETY3KU2O.js → personal-semantic-preference-YITU23SA.js} +6 -6
  36. package/dist/{project-semantic-UHRMVOJF.js → project-semantic-MHEXJF3C.js} +15 -13
  37. package/dist/{sync-XKEBXESC.js → sync-AQHVCSPI.js} +4 -4
  38. package/dist/{te-agent-S6UQR4IE.js → te-agent-RXI7WOH4.js} +5 -5
  39. package/dist/{te-analysis-WOFFCIBC.js → te-analysis-CZY74HVF.js} +380 -191
  40. package/dist/{te-community-R7B6QYOO.js → te-community-DKCYUBCM.js} +6 -6
  41. package/dist/{te-dataops-KPILYVHA.js → te-dataops-QEH6VE56.js} +3 -3
  42. package/dist/{te-engage-IAUM6ONX.js → te-engage-WK7WKDKF.js} +6 -6
  43. package/dist/{te-experiment-TMLRA7B3.js → te-experiment-LH3RPIOE.js} +274 -29
  44. package/dist/{te-kb-GKWPSLSY.js → te-kb-UPORIOVN.js} +16 -7
  45. package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
  46. package/dist/{te-team-ISN52YNG.js → te-team-LLVTO2G4.js} +5 -5
  47. package/dist/{things-DDQ52Z3Q.js → things-XLMLBYQR.js} +5 -5
  48. package/dist/{update-CTLNTX35.js → update-7J5UQHSK.js} +3 -3
  49. package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
  50. package/package.json +9 -7
  51. package/skills/ae-ai-monitor/SKILL.md +179 -0
  52. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  53. package/skills/ae-analysis/SKILL.md +10 -4
  54. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  55. package/skills/ae-analysis/references/ai_models/path.md +5 -6
  56. package/skills/ae-analysis/references/ai_models.md +1 -0
  57. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  58. package/skills/ae-analysis/references/asset_search.md +1 -1
  59. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  60. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  61. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  62. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  63. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  64. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  65. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  66. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  67. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  68. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  69. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  70. package/skills/ae-analysis/references/catalog_list.md +2 -0
  71. package/skills/ae-analysis/references/command_index.md +38 -29
  72. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  73. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  74. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  75. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  76. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  77. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  78. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  79. package/skills/ae-analysis/references/folder_share.md +8 -2
  80. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  81. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  82. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  83. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  84. package/skills/ae-analysis/references/project_member_add.md +3 -1
  85. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  86. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  87. package/skills/ae-analysis/references/project_member_update.md +3 -1
  88. package/skills/ae-analysis/references/project_owner_update.md +3 -1
  89. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  90. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  91. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  92. package/skills/ae-analysis/references/project_space_share.md +8 -2
  93. package/skills/ae-analysis/references/property_get.md +2 -0
  94. package/skills/ae-analysis/references/public_link_list.md +3 -1
  95. package/skills/ae-analysis/references/query_cancel.md +4 -1
  96. package/skills/ae-analysis/references/report_data_run.md +1 -1
  97. package/skills/ae-analysis/references/report_list.md +3 -3
  98. package/skills/ae-analysis/references/scenario_append.md +2 -2
  99. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  100. package/skills/ae-analysis/references/scenario_list.md +2 -1
  101. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  102. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  103. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  104. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  105. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  106. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  107. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  108. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  109. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  110. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  111. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  112. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  113. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  114. package/skills/ae-automation/SKILL.md +4 -2
  115. package/skills/ae-capability/SKILL.md +9 -5
  116. package/skills/ae-community/SKILL.md +1 -0
  117. package/skills/ae-dataops/SKILL.md +1 -0
  118. package/skills/ae-engage/SKILL.md +1 -0
  119. package/skills/ae-evaluation/SKILL.md +17 -2
  120. package/skills/ae-experiment/SKILL.md +38 -11
  121. package/skills/ae-experiment/references/experiment_approval.md +171 -0
  122. package/skills/ae-experiment/references/manage_experiment.md +11 -2
  123. package/skills/ae-experiment/references/save_experiment.md +28 -8
  124. package/skills/ae-experiment/references/save_submit_experiment.md +18 -3
  125. package/skills/ae-experiment/references/save_submit_external_experiment.md +57 -3
  126. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  127. package/skills/ae-kb/SKILL.md +5 -3
  128. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  129. package/skills/ae-kb/references/query-workflow.md +3 -1
  130. package/skills/ae-kb/references/versions.md +1 -1
  131. package/skills/ae-metadata/SKILL.md +1 -0
  132. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  133. package/skills/ae-team/SKILL.md +1 -1
  134. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  135. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  136. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  137. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  138. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  139. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  140. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  141. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  142. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  143. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  144. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  145. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  146. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  147. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  148. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  149. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  150. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  151. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  152. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  153. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  154. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  155. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  156. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  157. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  158. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  159. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  160. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  161. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  162. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  163. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  164. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  165. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  166. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  167. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  168. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  169. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  170. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  171. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  172. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  173. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  174. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  175. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  176. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  177. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  178. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  179. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  180. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  181. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  182. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  183. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  184. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  185. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  186. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  187. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  188. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  189. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  190. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  191. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  192. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  193. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  194. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  195. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  196. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  197. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  198. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  199. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  200. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  201. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  202. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  203. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  204. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  205. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  206. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  207. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  208. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  209. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  210. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  211. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  212. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  213. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  214. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  215. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  216. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  217. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  218. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  219. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  220. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  221. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  222. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  223. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  224. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  225. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  226. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  227. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  228. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  229. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  230. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  231. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  232. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  233. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  234. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  235. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  236. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  237. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  238. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  239. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  240. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  241. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  242. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  243. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  244. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  245. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  246. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  247. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  248. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  249. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  250. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  251. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  252. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  253. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  254. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  255. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  256. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  257. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  258. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  259. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  260. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  261. package/dist/chunk-AMBFK2K3.js +0 -28
@@ -0,0 +1,1268 @@
1
+ ---
2
+ code: egret_sdk_installation
3
+ name: "Egret"
4
+ wikiToken: KRmJwCLouikD7NkD9kucQkjUnDf
5
+ parentWikiToken: BAU2w0eipiqGnckeUsIc0mYQnZc
6
+ updateTime: 1751966093000
7
+ sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=egret_sdk_installation
8
+ ---
9
+
10
+ # Egret
11
+
12
+ ::: tip Note
13
+
14
+ Before integration, please read the Pre-installation Guide first.
15
+
16
+ Egret SDK supported platforms: HTML5, iOS, Android, WeChat Mini Game, Baidu Mini Game, Xiaomi Quick Game, OPPO Mini Game, vivo Mini Game, QQ Mini Game, 360 Mini Game, ByteDance Mini Game, Huawei Quick Game, Alipay Mini Game, Taobao Creative Interactive Mini Program, Facebook.
17
+
18
+ :::
19
+
20
+ **Latest Version:** v3.0.2
21
+
22
+ **Update Time:** 2024-02-09
23
+
24
+ **Resource Download:** Source Code, SDK Download
25
+
26
+ ::: warning Warning
27
+
28
+ This document applies to v3.0.0 and later versions, for historical versions please refer to Egret Integration Guide (V2), SDK Download (v2.2.4)
29
+
30
+ :::
31
+
32
+ ### I. Integrate SDK
33
+
34
+ Download and unzip Egret SDK.
35
+
36
+ Introducing SDK library is the same as introducing other third-party libraries, import the library in egretProperties.json and compile the engine.
37
+
38
+ ```
39
+ {
40
+ "name": "ta_egret_sdk",
41
+ "path": "./libs/ta_egret_sdk"
42
+ }
43
+ ```
44
+
45
+ After importing into the project, compile the engine to use the SDK library.
46
+
47
+ ### II. Initialization
48
+
49
+ After importing TE SDK, you can use TDAnalytics in your code:
50
+
51
+ ```
52
+ // TE SDK configuration object
53
+ var config = {
54
+ appId: "YOUR_APPID", // Project APP ID
55
+ serverUrl: "YOUR_SERVER_URL", // Upload address
56
+ autoTrack: {
57
+ appLaunch: true, // Auto-track ta_mg_launch
58
+ appShow: true, // Auto-track ta_mg_show
59
+ appHide: true // Auto-track ta_mg_hide
60
+ }
61
+ };
62
+ // Initialize
63
+ TDAnalytics.init(config);
64
+ ```
65
+
66
+ TE configuration object parameter description:
67
+
68
+ - `appId`: Your project's APP ID, required, can be viewed in TE backend project management page
69
+ - `serverUrl`: Data upload URL, required
70
+ - If you are using cloud service, enter: https://global-receiver-ta.thinkingdata.cn
71
+ - If you are using a privately deployed version, please confirm the upload address with your operations team
72
+ - `autoTrack`: Optional, indicates whether to enable auto-tracking feature, each element represents the following auto-tracking events, all disabled by default:
73
+ - `appLaunch`: Auto-track mini program initialization
74
+ - `appShow`: Auto-track mini game startup, or from background to foreground
75
+ - `appHide`: Auto-track mini game from foreground to background, and record the duration of this visit (from startup to entering background)
76
+ ::: warning Warning
77
+
78
+ Before uploading data, please add the data transfer URL to the server domain's request list in the WeChat public platform or other platform's development settings.
79
+
80
+ :::
81
+
82
+ ### III. Common Features
83
+
84
+ Before using common features, we recommend that you first understand the user identification rules; SDK will generate a random number as a visitor ID by default, and persistently store the visitor ID locally; before the user logs in, the visitor ID will be used as the identity identification ID. Note: The visitor ID will change when the user clears cache or changes the device.
85
+
86
+ #### 3.1 Set Account ID
87
+
88
+ When a user logs in, you can call `login` to set the user's account ID. The TE platform will use the account ID as the identity identification ID, and the set account ID will be retained until `logout` is called. Calling `login` multiple times will override the previous account ID.
89
+
90
+ ```
91
+ // The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
92
+ TDAnalytics.login("TA");
93
+ ```
94
+
95
+ <!-- unsupported block: 34 -->
96
+
97
+ **This method will not upload a login event**
98
+
99
+ #### 3.2 Set Public Event Properties
100
+
101
+ Public event properties refer to properties that will be present in every event. You can call `setSuperProperties` to set public event properties. We recommend that you set public event properties before sending events. For some important properties, such as user membership level, source channel, etc., these properties need to be set in every event, you can set these properties as public event properties.
102
+
103
+ ```
104
+ var superProperties = {
105
+ channel : "ta", //string
106
+ age : 1,//number
107
+ isSuccess : true,//boolean
108
+ birthday : new Date(),//object
109
+ object : { key : "value" },//object
110
+ object_arr : [ { key : "value" } ],//object array
111
+ arr : [ "value" ]//array
112
+ };
113
+ TDAnalytics.setSuperProperties(superProperties);//Set public event properties
114
+ ```
115
+
116
+ Public event properties will be saved to the cache and do not need to be called every time the App starts. If you call `setSuperProperties` to upload a previously set public event property, it will override the previous property.
117
+
118
+ - Key is the property name, is a string type, can only start with a letter, contain numbers, letters and underscores "\_", maximum length 50 characters, case-insensitive, TE will uniformly convert to lowercase letters
119
+ - Value is the property value, supports string, number, boolean, time, object, object array, array
120
+ <!-- unsupported block: 34 -->
121
+
122
+ **Event properties and user properties requirements are the same as public event properties**
123
+
124
+ #### 3.3 Send Event
125
+
126
+ You can call `track` to upload events. It is recommended that you set event properties and conditions for sending information based on your previously documented tracking plan. Here is an example of a user purchasing a product:
127
+
128
+ ```
129
+ TDAnalytics.track({
130
+ eventName: "product_buy", // Event name
131
+ properties: {
132
+ product_name: "Product Name"
133
+ } //Event properties
134
+ });
135
+ ```
136
+
137
+ The event name is a string type, can only start with a letter, can contain numbers, letters and underscores "\_", maximum length 50 characters.
138
+
139
+ #### 3.4 Set User Properties
140
+
141
+ For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will override existing property values. If the user property did not exist before, it will be created with the same type as the uploaded property. Here is an example of setting the username:
142
+
143
+ ```
144
+ //At this time username is TA
145
+ TDAnalytics.userSet({
146
+ properties: {
147
+ username: "TA"
148
+ }
149
+ });
150
+ //At this time userName is TE
151
+ TDAnalytics.userSet({
152
+ properties: {
153
+ username: "TE"
154
+ }
155
+ });
156
+ ```
157
+
158
+ ### IV. Best Practices
159
+
160
+ The following example code includes all the above operations. We recommend following these steps:
161
+
162
+ ```
163
+ var TDAnalytics = require("./tdanalytics.egert.min.js");
164
+ var config = {
165
+ appId: "YOU-APP-ID", // Project's APP ID
166
+ serverUrl: "https://youserverurl.com", // Data upload address
167
+ autoTrack: {
168
+ appLaunch: true, // Auto-track ta_mp_launch
169
+ appShow: true, // Auto-track ta_mp_show
170
+ appHide: true, // Auto-track ta_mp_hide
171
+ pageShow: true, // Auto-track ta_mp_view
172
+ pageShare: true // Auto-track ta_mp_share
173
+ }
174
+ };
175
+ // Initialize
176
+ TDAnalytics.init(config);
177
+ // The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
178
+ TDAnalytics.login("TA");
179
+ //Set public event properties
180
+ var superProperties = {
181
+ channel : "ta", //string
182
+ age : 1,//number
183
+ isSuccess : true,//boolean
184
+ birthday : new Date(),//object
185
+ object : { key : "value" },//object
186
+ object_arr : [ { key : "value" } ],//object array
187
+ arr : [ "value" ]//array
188
+ };
189
+ TDAnalytics.setSuperProperties(superProperties);
190
+ //Send event
191
+ TDAnalytics.track({
192
+ eventName: "product_buy", // Event name
193
+ properties: {
194
+ product_name: "Product Name"
195
+ } //Event properties
196
+ });
197
+ //Set user properties
198
+ TDAnalytics.userSet({
199
+ properties: {
200
+ username: "TE"
201
+ }
202
+ });
203
+ ```
204
+
205
+ ###
206
+
207
+ ###
208
+
209
+ ####
210
+
211
+ ---
212
+
213
+ # Advanced Guide
214
+
215
+ ### I. Set User ID
216
+
217
+ The SDK instance defaults to using a random number as the default visitor ID for each user, which will serve as the identity identification ID for users in an unauthenticated state. Note that the visitor ID will change when the user clears cache or changes the device.
218
+
219
+ #### 1.1 Set Visitor ID
220
+
221
+ ::: tip Note
222
+
223
+ Generally, you do not need to customize the visitor ID. Please ensure you understand the user identification rules before setting the visitor ID.
224
+
225
+ :::
226
+
227
+ If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set the visitor ID:
228
+
229
+ ```
230
+ // Set the visitor ID to "Thinker"
231
+ TDAnalytics.setDistinctId("Thinker");
232
+ ```
233
+
234
+ If you need to get the current visitor ID, you can call `getDistinctId`:
235
+
236
+ ```
237
+ //Return visitor ID
238
+ let distinctId = TDAnalytics.getDistinctId();
239
+ ```
240
+
241
+ <!-- unsupported block: 34 -->
242
+
243
+ If you need to set it, you must call this interface before initialization
244
+
245
+ #### 1.2 Set Account ID
246
+
247
+ When a user performs login behavior, you can call `login` to set the user's account ID. TE platform prioritizes account ID as identity identification, and the set account ID will be saved. Calling `login` multiple times will override the previous account ID:
248
+
249
+ ```
250
+ //The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
251
+ TDAnalytics.login("TA");
252
+ ```
253
+
254
+ **Please note, this method will not upload user login event**
255
+
256
+ #### 1.3 Clear Account ID
257
+
258
+ After a user performs logout behavior, you can call `logout` to clear the account ID. Before calling `login` again, the visitor ID will be used as the identity identification ID:
259
+
260
+ ```
261
+ // Remove "#account_id" from reported data, subsequent data will not have "#account_id"
262
+ TDAnalytics.logout();
263
+ ```
264
+
265
+ <!-- unsupported block: 34 -->
266
+
267
+ Please note, this method will not upload user logout event
268
+
269
+ ### II. Send Events
270
+
271
+ #### 2.1 Ordinary Events
272
+
273
+ You can directly call `track` to upload custom events. It is recommended that you set event properties and conditions for sending information based on your previously documented tracking plan. Here is an example of purchasing a product:
274
+
275
+ ```
276
+ TDAnalytics.track({
277
+ eventName: "product_buy", // Event name
278
+ properties: {
279
+ product_name: "Product Name"
280
+ } //Event properties
281
+ });
282
+ ```
283
+
284
+ - `track` interface has two parameters, the first parameter is the event name, the second parameter is the event properties
285
+ - The event name is a string, can only start with a letter, can contain numbers, letters and underscores "\_", maximum length 50 characters, case-insensitive.
286
+ - Event properties are a JS object, each element represents a property.
287
+ - The name of the element corresponds to the property name, can only start with a letter, contain numbers, letters and underscores "\_", maximum length 50 characters, case-insensitive.
288
+ - The Value of the element is the property value, supports `String`, `Number`, `Boolean`, `Date`, `Object` and `Array`; Content in `Object` can be `String`, `Number`, `Boolean`, `Date`, `Array` (content as string); Content in `Array` can be `Object` and `String`
289
+
290
+ #### 2.2 First-time Event
291
+
292
+ First-time events refer to events that will only be recorded once for a certain device or other dimensional ID. For example, in some scenarios, you may want to record the first occurrence of an event on a certain device, then you can use first-time events to report the data.
293
+
294
+ ```
295
+ TDAnalytics.trackFirst({
296
+ eventName: "device_activation",
297
+ properties: { key: "value" }
298
+ });
299
+ ```
300
+
301
+ If you want to determine whether it is the first time based on other dimensions other than the device, you can set the first_check_id for the first-time event. For example, if you need to record the first event of a certain account, you can set the account ID as the first_check_id of the first-time event:
302
+
303
+ ```
304
+ // Set the user ID as the first_check_id of the first-time event to implement the collection of user first activation event
305
+ TDAnalytics.trackFirst({
306
+ eventName: "account_activation",
307
+ firstCheckId: "TA",
308
+ properties: { key: "value" }
309
+ });
310
+ ```
311
+
312
+ <!-- unsupported block: 34 -->
313
+
314
+ Note: Since the verification of whether it is the first time is completed on the server side, first-time events will be delayed by 1 hour before entering the database by default.
315
+
316
+ #### 2.3 Updatable Events
317
+
318
+ You can implement the need to modify event data in specific scenarios through updatable events. Updatable events need to specify an ID that identifies the event, and pass it when creating the updatable event object. The TE backend will determine the data to be updated based on the event name and event ID.
319
+
320
+ ```
321
+ // Example: Report an event that can be updated, assuming the event name is UPDATABLE_EVENT
322
+ // After reporting, the event property status is 3, price is 100
323
+ TDAnalytics.trackUpdate({
324
+ eventName: "UPDATABLE_EVENT",
325
+ properties: { status: 3, price: 100 },
326
+ eventId: "test_event_id"
327
+ });
328
+
329
+ // After reporting, the event property status is updated to 5, price remains unchanged
330
+ TDAnalytics.trackUpdate({
331
+ eventName: "UPDATABLE_EVENT",
332
+ properties: { status: 5 },
333
+ eventId: "test_event_id"
334
+ });
335
+ ```
336
+
337
+ #### 2.4 Overwritable Events
338
+
339
+ Overwritable events are similar to updatable events, the difference is that overwritable events will completely overwrite historical data with the latest data, which effectively is equivalent to deleting the previous data and storing the latest data. The TE backend will determine the data to be updated based on the event name and event ID.
340
+
341
+ ```
342
+ // Example: Report an event that can be overwritten, assuming the event name is OVERWRITE_EVENT
343
+ // After reporting, the event property status is 3, price is 100
344
+ TDAnalytics.trackOverwrite({
345
+ eventName: "OVERWRITE_EVENT",
346
+ properties: { status: 3, price: 100 },
347
+ eventId: "test_event_id"
348
+ });
349
+
350
+ // After reporting, the event property status is updated to 5, price property is deleted
351
+ TDAnalytics.trackOverwrite({
352
+ eventName: "OVERWRITE_EVENT",
353
+ properties: { status: 5 },
354
+ eventId: "test_event_id"
355
+ });
356
+ ```
357
+
358
+ #### 2.5 Public Event Properties
359
+
360
+ For some important properties, such as user device ID, source channel, user status, etc., these properties need to be set in every event, you can set these properties as public properties, i.e., properties that are present in every event. We recommend that you set public properties before sending events.
361
+
362
+ Public properties include two types, event public properties and dynamic public properties. During event reporting, public properties will be inserted into the data's properties. If at this time the public property has the same key value as a custom property set in the event, the property value will be determined according to the following priority: `Custom Properties > Dynamic Public Event Properties > Static Public Event Properties > Preset Properties`
363
+
364
+ ##### 2.5.1 Static Public Event Properties
365
+
366
+ Event public properties refer to static public properties, only constants can be passed when setting, suitable for setting stable properties. You can call `setSuperProperties` to set public event properties, the format requirements for public event properties are the same as event properties.
367
+
368
+ <!-- unsupported block: 34 -->
369
+
370
+ According to property priority, custom properties have higher priority than event public properties, so event public properties can also be used as a default value for a property, set the same Key to override the default value in events that need modification.
371
+
372
+ ```
373
+ // Set public event properties, all data events will have these properties
374
+ TDAnalytics.setSuperProperties({
375
+ channel: "Channel Name",
376
+ user_name: "User Name"
377
+ });
378
+ ```
379
+
380
+ If you call `setSuperProperties` multiple times to set public event properties, subsequent calls with the same name field will override previous ones, different name fields will be added.
381
+
382
+ If you need to delete a public event property, you can call `unsetSuperProperty()` to clear one public event property; if you want to clear all public event properties, you can call `clearSuperProperties()`; if you want to get all public event properties, you can call `getSuperProperties`;
383
+
384
+ ```
385
+ // Get static public event properties
386
+ var superProperties = TDAnalytics.getSuperProperties();
387
+ // Clear one static public event property, for example clear previously set 'channel' property, subsequent data will not have this property
388
+ TDAnalytics.unsetSuperProperty("channel");
389
+ // Clear all static public event properties
390
+ TDAnalytics.clearSuperProperties();
391
+ ```
392
+
393
+ ##### 2.5.2 Dynamic Public Event Properties
394
+
395
+ Dynamic public properties will execute a function during event reporting, and use the return value as the value of this dynamic public property, adding to the event. You can call the `setDynamicSuperProperties` interface to set dynamic public properties. This interface accepts a function as a parameter.
396
+
397
+ ```
398
+ // Set UTC time as event property upload through dynamic public properties
399
+ TDAnalytics.setDynamicSuperProperties(() => {
400
+ var localDate = new Date();
401
+ return {
402
+ utcTime: new Date(
403
+ localDate.getTime() + localDate.getTimezoneOffset() * 60000
404
+ )
405
+ };
406
+ });
407
+ ```
408
+
409
+ <!-- unsupported block: 34 -->
410
+
411
+ The function must return a JS object, each element represents a property. Property format requirements are the same as event properties.
412
+
413
+ #### 2.6 Record Event Duration
414
+
415
+ You can call `timeEvent` to start timing, configure the event name you want to time. When you upload that event, a `#duration` property will automatically be added to your event properties to represent the recorded duration in seconds.
416
+
417
+ ```
418
+ //The following example completes the statistics of the user's stay duration on a certain product page
419
+ TDAnalytics.timeEvent({
420
+ eventName: "stay_shop"
421
+ });
422
+ /**do someting
423
+ .......
424
+ **/
425
+ //User leaves the product page, timing ends, the "stay_shop" event will have a property #duration representing the event duration
426
+ TDAnalytics.track({
427
+ eventName: "stay_shop",
428
+ properties: {
429
+ product_name: "Product Name"
430
+ }
431
+ });
432
+ ```
433
+
434
+ ### III. User Properties
435
+
436
+ #### 3.1 userSet
437
+
438
+ For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will override existing property values. If the user property did not exist before, it will be created
439
+
440
+ ```
441
+ // username is TA
442
+ TDAnalytics.userSet({
443
+ properties: {
444
+ username: "TA"
445
+ }
446
+ });
447
+ //username is TE
448
+ TDAnalytics.userSet({
449
+ properties: {
450
+ username: "TE"
451
+ }
452
+ });
453
+ ```
454
+
455
+ <!-- unsupported block: 34 -->
456
+
457
+ Property format requirements are the same as event properties.
458
+
459
+ #### 3.2 userSetOnce
460
+
461
+ If you need to upload user properties that should only be set once, you can call `userSetOnce` to set them. When the property already has a value, this information will be ignored.
462
+
463
+ ```
464
+ //first_payment_time is 2018-01-01 01:23:45.678
465
+ TDAnalytics.userSetOnce({
466
+ properties: {
467
+ first_payment_time: "2018-01-01 01:23:45.678"
468
+ }
469
+ });
470
+ //first_payment_time is still 2018-01-01 01:23:45.678
471
+ TDAnalytics.userSetOnce({
472
+ properties: {
473
+ first_payment_time: "2018-12-31 01:23:45.678"
474
+ }
475
+ });
476
+ ```
477
+
478
+ <!-- unsupported block: 34 -->
479
+
480
+ Property format requirements are the same as event properties.
481
+
482
+ #### 3.3 userAdd
483
+
484
+ When you need to upload numeric properties, you can call `userAdd` to perform an accumulation operation on the property. If the property has not been set, it will be assigned 0 before calculation
485
+
486
+ ```
487
+ //At this time total_revenue is 30
488
+ TDAnalytics.userAdd({
489
+ properties: {
490
+ total_revenue: 30
491
+ }
492
+ });
493
+ //At this time total_revenue is 678
494
+ TDAnalytics.userAdd({
495
+ properties: {
496
+ total_revenue: 648
497
+ }
498
+ });
499
+ ```
500
+
501
+ <!-- unsupported block: 34 -->
502
+
503
+ The property key is a string, and Value only allows numeric values.
504
+
505
+ #### 3.4 userUnset
506
+
507
+ When you need to clear a user's user property value, you can call `userUnset` to clear the specified property. If the property has not been created in the cluster yet, `userUnset` will not create the property
508
+
509
+ ```
510
+ // Clear the user property value named userPropertykey, i.e., set to NULL
511
+ TDAnalytics.userUnset({
512
+ property: "userPropertykey"
513
+ });
514
+ ```
515
+
516
+ <!-- unsupported block: 34 -->
517
+
518
+ The passed value of userUnset is the Key of the property to be cleared.
519
+
520
+ #### 3.5 userDelete
521
+
522
+ If you need to delete a user, you can call `userDelete` to delete that user. You will no longer be able to query that user's user properties, but the events generated by that user can still be queried
523
+
524
+ ```
525
+ TDAnalytics.userDelete();
526
+ ```
527
+
528
+ #### 3.6 userAppend
529
+
530
+ You can call `userAppend` to append elements to Array (List) type user data.
531
+
532
+ ```
533
+ TDAnalytics.userAppend({
534
+ properties: {
535
+ user_list: ["apple", "ball"]
536
+ }
537
+ });
538
+ ```
539
+
540
+ <!-- unsupported block: 34 -->
541
+
542
+ Note: This feature needs to be used with TE platform version 2.5 and later
543
+
544
+ #### 3.7 userUniqAppend
545
+
546
+ Starting from v2.1.0, you can call `userUniqAppend` to **deduplicate** and append elements to Array (List) type user data.
547
+
548
+ ```
549
+ //At this time user_list property value is ["apple", "ball"]
550
+ TDAnalytics.userAppend({
551
+ properties: {
552
+ user_list: ["apple", "ball"]
553
+ }
554
+ });
555
+ //At this time user_list property value is ["apple", "apple", "ball", "cube"]
556
+ TDAnalytics.userAppend({
557
+ properties: {
558
+ user_list: ["apple", "cube"]
559
+ }
560
+ });
561
+ //At this time user_list property value is ["apple", "ball", "cube"]
562
+ TDAnalytics.userUniqAppend({
563
+ properties: {
564
+ user_list: ["apple", "cube"]
565
+ }
566
+ });
567
+ ```
568
+
569
+ <!-- unsupported block: 34 -->
570
+
571
+ Note: This feature needs to be used with TE platform version 3.6 and later
572
+
573
+ ### V. Other Features
574
+
575
+ #### 5.1 Get Device ID
576
+
577
+ You can call `getDeviceId()` to get the device ID, **Due to runtime environment, device ID will be saved in local cache, once user deletes cache, device ID will change, so device ID cannot guarantee stability**
578
+
579
+ ```
580
+ var deviceId = TDAnalytics.getDeviceId();
581
+ ```
582
+
583
+ #### 5.2 onCompelete Callback Function
584
+
585
+ For track, userSet, userSetOnce, userAdd, userDel interfaces, onComplete callback can be passed.
586
+
587
+ onComplete can be passed directly after the original parameter list, or using parameter object method. If using parameter object, the parameter object must include onComplete, otherwise a parameter error will occur.
588
+
589
+ Using uploading event as an example:
590
+
591
+ ```
592
+ TDAnalytics.track({
593
+ eventName: "test", // Required
594
+ properties: { testkey: 123 }, // Optional
595
+ time: new Date(),
596
+ onComplete: res => {
597
+ console.log(res);
598
+ }
599
+ });
600
+ ```
601
+
602
+ The parameter res of onComplete is object type, with two properties code and msg.
603
+
604
+ res.code is int type, defined as follows:
605
+
606
+ - 0: Success
607
+ - -1: Data format incorrect
608
+ - -2: APP ID invalid
609
+ - -3: Network or server exception
610
+ Debug mode is defined as follows:
611
+
612
+ - 0: Success
613
+ - -1: Parameter or permission validation issue
614
+ - 1: Indicates field basic error, will give detailed error field and reason
615
+ - 2: Indicates whole record error
616
+ - -3: Network or server exception
617
+ res.msg is a textual explanation of res.code.
618
+
619
+ #### 5.3 Set Event Cache Upload
620
+
621
+ Starting from v2.2.0, you can configure event cache upload during initialization.
622
+
623
+ ```
624
+ // TE SDK configuration object
625
+ var config = {
626
+ appId: "YOU-APP-ID", // Project's APP ID
627
+ serverUrl: "https://youserverurl.com", // Data upload address
628
+ enableBatch: true, // Whether to enable event cache batch upload, true=enable, false=disable
629
+ batchConfig: {
630
+ size: 5, // Event cache upload count
631
+ interval: 5000 // Event cache upload interval (milliseconds)
632
+ }
633
+ };
634
+ // Initialize
635
+ TDAnalytics.init(config);
636
+ ```
637
+
638
+ ### VI. Channel SDK Compatibility
639
+
640
+ #### 6.1 Tencent Advertising
641
+
642
+ ##### 6.1.1 Solution Overview
643
+
644
+ After integrating TDAnalytics SDK, you don't need to additionally integrate Tencent advertising SDK. Once you complete TDAnalytics initialization method, the system will automatically trigger Tencent advertising SDK initialization. When you report registration, payment, and other key events, the system will automatically report these event information to Tencent advertising according to your configuration.
645
+
646
+ ##### 6.1.2 Integration Process
647
+
648
+ 1. Download Tencent advertising SDK, currently using version 1.5.4, other versions can also be used.
649
+ Place dn-sdk-minigame.cjs.js in the same directory as TDAnalytics SDK.
650
+
651
+ 1. Initialize
652
+ <!-- unsupported block: 19 -->
653
+
654
+ TDAnalytics SDK version needs >= 3.0.4
655
+
656
+ ```
657
+ TDAnalytics.init({
658
+ appId: 'AppId',
659
+ serverUrl: 'ServerUrl',
660
+ tgaInitParams: {
661
+ user_action_set_id: 100001,// Data source ID, number, required
662
+ secret_key: '5e853xxxxxxd57a690xxxxxxxxxx',// Encryption key, required
663
+ appid: 'wx123xyz123xyz123x',//WeChat mini game APPID, wx prefix, required
664
+ },
665
+ reportingToTencentSdk: 2,//1 Report only to Tencent 2 Report to both Tencent and TA 3 Report only to TA
666
+ debugMode: 'debug'// If debug mode, will print Tencent advertising SDK local debug logs
667
+ })
668
+ ```
669
+
670
+ 1. Set User ID
671
+
672
+ - setOpenId
673
+ openid is usually obtained asynchronously by calling backend interface (get openid method), please call sdk.setOpenId() method after obtaining openid. Only one of openid and unionid can be set, openid is preferred.
674
+
675
+ ```
676
+ wx.request({
677
+ url: 'Backend interface URL to get openid and determine if registered user',
678
+ success: function(res){
679
+ if(res.openid){
680
+ // Set openid, must set openid before reporting registration behavior. setOpenId is a synchronous method, can report registration behavior immediately after setting.
681
+ TDAnalytics.login(res.openid);
682
+
683
+ //Report registration behavior, backend interface determines if registered user
684
+ if(res.isRegisterUser){
685
+ TDAnalytics.track({
686
+ eventName: "REGISTER"
687
+ });
688
+ }
689
+ }
690
+ }
691
+ });
692
+ ```
693
+
694
+ - setUnionId
695
+ unionid is usually obtained asynchronously by calling backend interface (get unionid method), please call sdk.setUnionId() method after obtaining unionid. Only use this method to set unionid when openid is not available.
696
+
697
+ ```
698
+ wx.request({
699
+ url: 'Backend interface URL to get openid and determine if registered user',
700
+ success: function(res){
701
+ if(res.unionid){
702
+ // Set unionid, please use openid first, only set unionid when openid is not available or backend uniformly uses unionid.
703
+ TDAnalytics.setDistinctId(res.unionid);
704
+
705
+ //Report registration behavior, backend interface determines if registered user
706
+ if(res.isRegisterUser){
707
+ TDAnalytics.track({
708
+ eventName: "REGISTER"
709
+ });
710
+ }
711
+ }
712
+ }
713
+ });
714
+ ```
715
+
716
+ 1. Report Behavior
717
+
718
+ ```
719
+ TDAnalytics.track({
720
+ eventName: "product_buy", // Event name
721
+ properties: {
722
+ product_name: "Product Name"
723
+ } //Event properties
724
+ });
725
+ ```
726
+
727
+ For the following specific events, need to report specified event name
728
+
729
+ Event
730
+
731
+ Event Name
732
+
733
+ Event Properties (need to include key)
734
+
735
+ ##### Mini Game Startup
736
+
737
+ ##### START_APP
738
+
739
+ None
740
+
741
+ ##### Payment
742
+
743
+ ##### PURCHASE
744
+
745
+ {
746
+
747
+ value: 600
748
+
749
+ }
750
+
751
+ ##### Registration
752
+
753
+ ##### REGISTER
754
+
755
+ ##### Silent Wake-up
756
+
757
+ ##### RE_ACTIVE
758
+
759
+ {
760
+
761
+ backFlowDay: 30
762
+
763
+ }
764
+
765
+ ##### Add Mini Game to Wishlist
766
+
767
+ ##### ADD_TO_WISHLIST
768
+
769
+ {
770
+
771
+ type: 'default',
772
+
773
+ }
774
+
775
+ ##### Share Mini Game
776
+
777
+ ##### SHARE
778
+
779
+ {
780
+
781
+ target: 'APP_MESSAGE'
782
+
783
+ }
784
+
785
+ ##### Create Role
786
+
787
+ ##### CREATE_ROL
788
+
789
+ {
790
+
791
+ name: 'SuperMan'
792
+
793
+ }
794
+
795
+ ##### Complete Tutorial
796
+
797
+ ##### TUTORIAL_FINISH
798
+
799
+ None
800
+
801
+ ##### Game Level Up
802
+
803
+ ##### UPDATE_LEVEL
804
+
805
+ {
806
+
807
+ level: 2,
808
+
809
+ power: 85,
810
+
811
+ }
812
+
813
+ ##### View Mall Page
814
+
815
+ ##### VIEW_CONTENT
816
+
817
+ {
818
+
819
+ // Key scene visit: Mall
820
+
821
+ item: 'Mall',
822
+
823
+ }
824
+
825
+ ##### View Game Activity
826
+
827
+ ##### VIEW_CONTENT
828
+
829
+ {
830
+
831
+ // Key scene visit: Activity
832
+
833
+ item: 'Activity',
834
+
835
+ }
836
+
837
+ For example, report game level up event
838
+
839
+ ```
840
+ TDAnalytics.track({
841
+ eventName: "UPDATE_LEVEL",
842
+ properties: {
843
+ level: 2,
844
+ power: 85,
845
+ }
846
+ });
847
+ ```
848
+
849
+ ---
850
+
851
+ # Native Support
852
+
853
+ ### I. iOS Native Support
854
+
855
+ **Build iOS platform application, configure iOS project**
856
+
857
+ - Add iOS project dependency files
858
+ - `EgretProxyApi.h`
859
+ - `EgretProxyApi.mm`
860
+ - `ThinkingSDK.framework`
861
+ - Build Settings Settings
862
+ - Add `-ObjC` in `Other Linker Flags`
863
+ - Register Native proxy
864
+ - Register Native proxy in `AppDelegate.mm`'s `application:didFinishLaunchingWithOptions:` method, call code `[EgretProxyApi registExternalInterface:_native]`
865
+
866
+ ### II. Android Native Support
867
+
868
+ **Build Android platform application, configure Android project**
869
+
870
+ - Add Android project dependency files
871
+ - `EgretProxyApi.java`
872
+ - Add the following configuration dependency in `Project` level `build.gradle` file
873
+
874
+ ```
875
+ buildscript {
876
+ repositories {
877
+ jcenter()
878
+ mavenCentral()
879
+ }
880
+ }
881
+ ```
882
+
883
+ - Add dependency in `Module`'s `build.gradle` file
884
+
885
+ ```
886
+ dependencies {
887
+ implementation 'cn.thinkingdata.android:ThinkingAnalyticsSDK:2.7.6.1'
888
+ }
889
+ ```
890
+
891
+ - Register Native proxy
892
+ - Register Native proxy in `MainActivity`'s `onCreate` method, call code `EgretProxyApi.registExternalInterface(nativeAndroid,this)`
893
+
894
+ ### III. Enable Native Support
895
+
896
+ When initializing SDK, add `enableNative: true` in `config` to enable Native support.
897
+
898
+ ```
899
+ // TA SDK configuration object
900
+ var config = {
901
+ appId: "YOUR_APPID", // Project APP ID
902
+ serverUrl: "YOUR_SERVER_URL", // Upload address
903
+ enableNative: true, // Allow calling Native code
904
+ autoTrack: {
905
+ appShow: true, // Auto-track startup event
906
+ appHide: true, // Auto-track close event
907
+ appClick: true, // Auto-track click event (only native effective)
908
+ appView: true, // Auto-track page view event (only native effective)
909
+ appCrash: true, // Auto-track crash event (only native effective)
910
+ appInstall: true // Auto-track install event (only native effective)
911
+ }
912
+ };
913
+
914
+ // Initialize
915
+ TDAnalytics.init(config);
916
+ // Report a simple event, event name is test_event
917
+ TDAnalytics.track({
918
+ eventName: 'test_event'
919
+ });
920
+ ```
921
+
922
+ ---
923
+
924
+ # Real-time Debugging
925
+
926
+ During SDK integration, you can perform real-time debugging by viewing SDK logs in the IDE console or using TE's Debug feature.
927
+
928
+ #### I. Print SDK Logs
929
+
930
+ ```
931
+ var config = {
932
+ appid: "YOUR_APPID",
933
+ server_url: "YOUR_SERVER_URL",
934
+ enableLog:true//Enable log switch, default is false
935
+ };
936
+ TDAnalytics.init(config);
937
+ ```
938
+
939
+ <!-- unsupported block: 34 -->
940
+
941
+ After enabling logs, you can filter ThinkingAnalytics related logs in the IDE to observe SDK data reporting.
942
+
943
+ #### II. Enable Debug Mode
944
+
945
+ Enabling Debug mode requires the following two steps:
946
+
947
+ 1. Enable Debug mode on the client side
948
+ The following is an example code for enabling Debug mode on the client side:
949
+
950
+ ```
951
+ /*
952
+ Set the running mode to Debug mode
953
+ none: Data will be stored in cache and reported according to a certain cache strategy. Default is NORMAL mode; recommended for production environment
954
+ debug: Data is reported one by one. When problems occur, users will be prompted with logs and exceptions; not recommended for production environment
955
+ debugOnly: Only validates data, will not be stored in database; not recommended for production environment
956
+ */
957
+ var config = {
958
+ appid: "YOUR_APPID",
959
+ server_url: "YOUR_SERVER_URL",
960
+ debugMode: "debug"
961
+ };
962
+ TDAnalytics.init(config);
963
+ ```
964
+
965
+ 1. Add Debug device in TE backend
966
+ To prevent Debug mode from being launched in production environments, only specified devices can enable Debug mode. Debug mode can only be enabled if Debug mode is enabled on the client side and the device ID is configured in the "Debug Data" section of the "Tracking Management" page in TE backend.
967
+
968
+ Device ID can be obtained through the following three ways:
969
+
970
+ - The #device_id property in event data in TE platform
971
+ - Client logs: SDK will print device DeviceId after initialization completes
972
+ - Through instance interface call: Get Device ID
973
+ <!-- unsupported block: 34 -->
974
+
975
+ Debug mode may affect data collection quality and App stability, it is only used for data verification during integration stage, do not use it in production environment.
976
+
977
+ ---
978
+
979
+ # Auto-tracking
980
+
981
+ In the instance's config, enable the auto-tracking events you need, and SDK will automatically collect mini game behaviors. Currently, the following types of events support auto-tracking:
982
+
983
+ Currently supported automatic data collection:
984
+
985
+ 1. Mini game returns to foreground event
986
+ 1. Mini game enters background, and records the duration of this visit (from startup to entering background)
987
+ Next, we will detail the collection method for each type of data
988
+
989
+ ### I. Enable Auto-tracking Events
990
+
991
+ In config, the elements in parameter `autoTrack` represent the switch for each auto-tracking event, set to `true` to enable auto-tracking:
992
+
993
+ ```
994
+ var config = {
995
+ appid: "YOUR_APPID",
996
+ server_url: "YOUR_SERVER_URL",
997
+ autoTrack: {
998
+ appLaunch: true, // Auto-track ta_mg_launch
999
+ appShow: true, // Auto-track ta_mg_show
1000
+ appHide: true, // Auto-track ta_mg_hide
1001
+ properties: { // Auto-track custom propertiesstaticKey: 'staticValue'},
1002
+ callback: (eventType:any) =>{ // Auto-track callback
1003
+ if (eventType === 'appShow')
1004
+ {
1005
+ return { appShowKey: 'appShowValue' };
1006
+ }
1007
+ else if (eventType === 'appHide')
1008
+ {
1009
+ return { appHideKey: 'appHideValue' };
1010
+ }
1011
+ else {
1012
+ return {};
1013
+ }
1014
+ }
1015
+ }
1016
+ };
1017
+ ```
1018
+
1019
+ - appLaunch: Auto-track mini program initialization
1020
+ - appShow: Auto-track mini game startup, or from background to foreground
1021
+ - appHide: Auto-track mini game from foreground to background
1022
+ - properties: Auto-track custom properties (supports appShow/appHide)
1023
+ - callback: Auto-track callback (supports appShow/appHide)
1024
+
1025
+ ### II. Auto-tracking Event Details
1026
+
1027
+ #### 2.1 Mini Game Startup
1028
+
1029
+ Mini game startup will be triggered when mini game is started or mini game is brought from background to foreground, detailed event introduction:
1030
+
1031
+ - Event name: ta_mg_show
1032
+ - Auto-track properties:
1033
+ - `#scene`, scene value, from WeChat provided scene value
1034
+ - `#start_reason`, app start source, parameters from `getLaunchOptionsSync` interface
1035
+ Mini game startup is affected by foreground/background switching (large number of records), so it is not suitable for direct analysis, but can mark a user's usage in behavioral path, and can be used as the initial behavior of user behavioral path
1036
+
1037
+ #### 2.2 Mini Game Hide
1038
+
1039
+ Mini game hide will be triggered when mini game enters background, and records the duration of this usage, detailed event introduction:
1040
+
1041
+ - Event name: ta_mg_hide
1042
+ - Auto-track properties:
1043
+ - `#scene`, scene value, from WeChat provided scene value
1044
+ - `#duration`, numeric type, represents the duration from this startup (ta_mg_show) to hide
1045
+ Mini game hide event records usage duration (in seconds), so you can directly calculate user total usage duration and average duration per person, or calculate single usage duration by dividing by initialization count.
1046
+
1047
+ ---
1048
+
1049
+ # Preset Properties
1050
+
1051
+ #### I. Preset Properties for All Events
1052
+
1053
+ <!-- unsupported block: 34 -->
1054
+
1055
+ Preset properties collected by each platform will have certain differences. For details, please refer to the following documents: Android Platform, iOS Platform
1056
+
1057
+ **Mini Game Platform Preset Properties for All Events:**
1058
+
1059
+ **Property Name**
1060
+
1061
+ **Chinese Name**
1062
+
1063
+ **Property Type**
1064
+
1065
+ **Description**
1066
+
1067
+ #ip
1068
+
1069
+ IP Address
1070
+
1071
+ Text
1072
+
1073
+ User's IP address, TE will use this to obtain user's geographic location information
1074
+
1075
+ #country
1076
+
1077
+ Country
1078
+
1079
+ Text
1080
+
1081
+ User's country, generated based on IP address
1082
+
1083
+ #country_code
1084
+
1085
+ Country Code
1086
+
1087
+ Text
1088
+
1089
+ User's country code (ISO 3166-1 alpha-2, i.e., two uppercase English letters), generated based on IP address
1090
+
1091
+ #province
1092
+
1093
+ Province
1094
+
1095
+ Text
1096
+
1097
+ User's province, generated based on IP address
1098
+
1099
+ #city
1100
+
1101
+ City
1102
+
1103
+ Text
1104
+
1105
+ User's city, generated based on IP address
1106
+
1107
+ #device_model
1108
+
1109
+ Device Model
1110
+
1111
+ Text
1112
+
1113
+ User's device model, such as iPhone 8, etc.
1114
+
1115
+ #device_id
1116
+
1117
+ Device ID
1118
+
1119
+ Text
1120
+
1121
+ User's device ID, taken from UUID generated during initialization
1122
+
1123
+ #screen_height
1124
+
1125
+ Screen Height
1126
+
1127
+ Number
1128
+
1129
+ User's device screen height, such as 1920, etc.
1130
+
1131
+ #screen_width
1132
+
1133
+ Screen Width
1134
+
1135
+ Number
1136
+
1137
+ User's device screen height, such as 1080, etc.
1138
+
1139
+ #manufacturer
1140
+
1141
+ Device Manufacturer
1142
+
1143
+ Text
1144
+
1145
+ User's device manufacturer, such as Apple, vivo, etc.
1146
+
1147
+ #os_version
1148
+
1149
+ Operating System Version
1150
+
1151
+ Text
1152
+
1153
+ iOS 11.2.2, Android 8.0.0, etc.
1154
+
1155
+ #os
1156
+
1157
+ Operating System
1158
+
1159
+ Text
1160
+
1161
+ Such as Android, iOS, etc.
1162
+
1163
+ #network_type
1164
+
1165
+ Network Status
1166
+
1167
+ Text
1168
+
1169
+ Network status when uploading event, such as WIFI, 3G, 4G, etc.
1170
+
1171
+ #lib
1172
+
1173
+ SDK Type
1174
+
1175
+ Text
1176
+
1177
+ The type of SDK you integrated, such as MG (Mini Game)
1178
+
1179
+ #lib_version
1180
+
1181
+ SDK Version
1182
+
1183
+ Text
1184
+
1185
+ The version of SDK you integrated
1186
+
1187
+ #scene
1188
+
1189
+ Scene Value
1190
+
1191
+ Number
1192
+
1193
+ Scene value passed when WeChat mini game starts
1194
+
1195
+ #mp_platform
1196
+
1197
+ Mini Game Platform
1198
+
1199
+ Text
1200
+
1201
+ Identifies the platform where the application is located
1202
+
1203
+ #zone_offset
1204
+
1205
+ Timezone Offset
1206
+
1207
+ Number
1208
+
1209
+ Number of hours the data time is offset relative to UTC time
1210
+
1211
+ #### II. Preset Properties for Auto-tracking Events
1212
+
1213
+ The following preset properties are unique to each auto-tracking event
1214
+
1215
+ - Mini Game Hide (ta_mg_hide) preset properties
1216
+ **Property Name**
1217
+
1218
+ **Chinese Name**
1219
+
1220
+ **Property Type**
1221
+
1222
+ **Description**
1223
+
1224
+ #duration
1225
+
1226
+ Event Duration
1227
+
1228
+ Number
1229
+
1230
+ Represents the duration from this startup `ta_mg_show` to hide `ta_mg_hide`, in seconds
1231
+
1232
+ #### III. Get Preset Properties
1233
+
1234
+ When server-side tracking needs some preset properties from the App side, you can get the preset properties from the client side through this method and pass them to the server side.
1235
+
1236
+ ```
1237
+ //Get property object
1238
+ var presetProperties = TDAnalytics.getPresetProperties();
1239
+ //Generate event preset properties
1240
+ var properties = presetProperties.toEventPresetProperties();
1241
+ /*
1242
+ {
1243
+ "#device_model":"iPhone 5",
1244
+ "#device_id":"3204487163-1624513721217",
1245
+ "#screen_width":320,
1246
+ "#screen_height":568,
1247
+ "#os":"iOS",
1248
+ "#os_version":"10.0.1",
1249
+ "#network_type":"wifi",
1250
+ "#zone_offset":8,
1251
+ "#manufacturer":"Apple"
1252
+ }
1253
+ */
1254
+ //Get a specific preset property
1255
+ var os=presetProperties.os;//os type, such as Android
1256
+ var osVersion=presetProperties.osVersion;//System version number
1257
+ var networkType=presetProperties.networkType;//Network type
1258
+ var manufacture=presetProperties.manufacturer;//Device manufacturer
1259
+ var deviceModel=presetProperties.deviceModel;//Device model
1260
+ var screenWidth=presetProperties.screenWidth;//Screen width
1261
+ var screenHeight=presetProperties.screenHeight;//Screen height
1262
+ var deviceId=presetProperties.deviceId;//Device ID
1263
+ var zoneOffset=presetProperties.zoneOffset;//Timezone offset value
1264
+ ```
1265
+
1266
+ <!-- unsupported block: 34 -->
1267
+
1268
+ IP, country and city information are generated by server-side analysis, client does not provide interface to get these properties