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