@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,953 @@
1
+ ---
2
+ code: cocos2d-x_sdk_installation
3
+ name: "Cocos2d-x"
4
+ wikiToken: RZ1DwICXOiehIZkqI8hckoPbn0e
5
+ parentWikiToken: BAU2w0eipiqGnckeUsIc0mYQnZc
6
+ updateTime: 1770184507000
7
+ sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=cocos2d-x_sdk_installation
8
+ ---
9
+
10
+ # Cocos2d-x
11
+
12
+ ::: tip Note
13
+
14
+ Before integration, please read the Pre-installation Guide first.
15
+
16
+ Cocos2d-x SDK supports running on iOS, Android, Mac, Windows platforms, size approximately 6.8M
17
+
18
+ :::
19
+
20
+ **Latest Version:** v2.0.4
21
+
22
+ **Update Time:** 2026-02-04
23
+
24
+ **Resource Download:** Source Code, SDK Download
25
+
26
+ ::: warning Warning
27
+
28
+ This document applies to v2.0.0 and later versions, for historical versions please refer to Cocos2d-x Integration Guide (V1), SDK Download (v1.3.5)
29
+
30
+ :::
31
+
32
+ ### I. Integrate SDK
33
+
34
+ 1. Download Cocos2d-x SDK resource files, unzip the files, and put the ThinkingAnalytics folder into the Classes folder
35
+ 1. Add the following configuration to `CMakeLists.txt`
36
+
37
+ ```
38
+ list(APPEND GAME_SOURCE
39
+ Classes/ThinkingAnalytics/Common/TDJSONObject.cpp
40
+ )
41
+ list(APPEND GAME_HEADER
42
+ Classes/ThinkingAnalytics/Common/TDJSONObject.h
43
+ Classes/ThinkingAnalytics/Common/TDAnalytics.h
44
+ )
45
+ if(ANDROID)
46
+ list(APPEND GAME_SOURCE
47
+ Classes/ThinkingAnalytics/Android/TDAnalytics.cpp
48
+ )
49
+ elseif(WINDOWS)
50
+ list(APPEND GAME_HEADER
51
+ Classes/ThinkingAnalytics/Other/ThinkingSDKObject.h
52
+ )
53
+ list(APPEND GAME_SOURCE
54
+ Classes/ThinkingAnalytics/Other/TDAnalytics.cpp
55
+ )
56
+ elseif(MACOSX)
57
+ list(APPEND GAME_HEADER
58
+ Classes/ThinkingAnalytics/Other/ThinkingSDKObject.h
59
+ )
60
+ list(APPEND GAME_SOURCE
61
+ Classes/ThinkingAnalytics/Other/TDAnalytics.cpp
62
+ )
63
+ ```
64
+
65
+ 1. Add Android Configuration
66
+
67
+ - Create a libs folder in the app directory under proj.android, and copy TDAnalytics.aar, TDCore.aar, TDThirdparty.aar to the libs folder
68
+ - Create cn/thinkingdata/analytics folder step by step in proj.android/app/src directory, and copy TDAnalyticsCocosAPI.java to the cn/thinkingdata/analytics folder
69
+ - Add the following configuration in build.gradle under proj.android/app directory
70
+
71
+ ```
72
+ dependencies {
73
+ implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
74
+ }
75
+ ```
76
+
77
+ 1. Add iOS Configuration
78
+ Use ios.toolchain.cmake tool to compile iOS project
79
+
80
+ - Add iOS related configuration in `CMakeLists.txt`
81
+
82
+ ```
83
+ list(APPEND GAME_SOURCE
84
+ Classes/ThinkingAnalytics/Common/TDJSONObject.cpp
85
+ )
86
+ list(APPEND GAME_HEADER
87
+ Classes/ThinkingAnalytics/Common/TDJSONObject.h
88
+ Classes/ThinkingAnalytics/Common/TDAnalytics.h
89
+ )
90
+ if(ANDROID)
91
+ list(APPEND GAME_SOURCE
92
+ Classes/ThinkingAnalytics/Android/TDAnalytics.cpp
93
+ )
94
+ elseif(WINDOWS)
95
+ list(APPEND GAME_HEADER
96
+ Classes/ThinkingAnalytics/Other/ThinkingSDKObject.h
97
+ )
98
+ list(APPEND GAME_SOURCE
99
+ Classes/ThinkingAnalytics/Other/TDAnalytics.cpp
100
+ )
101
+ elseif(IOS)
102
+ //iOS configuration
103
+ list(APPEND GAME_HEADER
104
+ Classes/ThinkingAnalytics/iOS/TDAnalyticsCocosAPI.h
105
+ )
106
+ list(APPEND GAME_SOURCE
107
+ Classes/ThinkingAnalytics/iOS/TDAnalytics.mm
108
+ Classes/ThinkingAnalytics/iOS/TDAnalyticsCocosAPI.m
109
+ )
110
+ elseif(MACOSX)
111
+ list(APPEND GAME_HEADER
112
+ Classes/ThinkingAnalytics/Other/ThinkingSDKObject.h
113
+ )
114
+ list(APPEND GAME_SOURCE
115
+ Classes/ThinkingAnalytics/Other/TDAnalytics.cpp
116
+ )
117
+
118
+ if(IOS)
119
+ //iOS configuration
120
+ set(CMAKE_EXE_LINKER_FLAGS -ObjC)
121
+ endif()
122
+ ```
123
+
124
+ - Open iOS project with Xcode, directly drag and drop `ThinkingSDK.framework` and `TAThirdParty.framework` from the iOS folder under ThinkingAnalytics to the Classes/ThinkingAnalytics/iOS directory of the specified Xcode project, as shown below
125
+ - Configuration complete, if version is lower than 2.0.2, you need to manually modify the header file import in Classes/ThinkingAnalytics/iOS/TDAnalyticsCocosAPI.m
126
+
127
+ ```
128
+ #import "ThinkingAnalyticsSDK.h"
129
+ //Change to the following
130
+ #import <ThinkingSDK/ThinkingSDK.h>
131
+ ```
132
+
133
+ 1. Open Xcode project directly in proj.ios_mac
134
+
135
+ - Open iOS project with Xcode, directly drag and drop the Common and iOS folders under ThinkingAnalytics into the Classes directory of Xcode project, as shown below
136
+ - Add `-ObjC` in `Build Setting` -> `Other Linker Flags`
137
+ - Add "$(SRCROOT)/../Classes/ThinkingAnalytics/iOS" in `Build Setting` - `Framework Search Paths`
138
+
139
+ - Add WebKit.framework, GameController.framework, MediaPlayer.framework in `Build Phases` - `Link Binary With Libraries`
140
+
141
+ - Configuration complete, if version is lower than 2.0.2, you need to manually modify the header file import in Classes/ThinkingAnalytics/iOS/TDAnalyticsCocosAPI.m
142
+
143
+ ```
144
+ #import "ThinkingAnalyticsSDK.h"
145
+ //Change to the following
146
+ #import <ThinkingSDK/ThinkingSDK.h>
147
+ ```
148
+
149
+ ### II. Initialization
150
+
151
+ ```
152
+ #include "./ThinkingAnalytics/Common/TDAnalytics.h"
153
+ using namespace thinkingdata::analytics;
154
+ // Initialize SDK in main thread
155
+ //Method 1
156
+ TDAnalytics::init(TA_APP_ID, TA_SERVER_URL);
157
+ //Method 2
158
+ TDConfig config(TA_APP_ID, TA_SERVER_URL);
159
+ TDAnalytics::init(config);
160
+ ```
161
+
162
+ Parameter description:
163
+
164
+ - `APPID`: Your project's APPID, can be obtained from TE backend project management page
165
+ - `SERVER_URL`: URL for data upload
166
+ - If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
167
+ - If you are using a privately deployed version, please bind a domain name for the data collection address and configure HTTPS certificate: https://your-data-collection-domain
168
+ <!-- unsupported block: 34 -->
169
+
170
+ Since Android 9.0+ restricts HTTP requests by default, please use HTTPS protocol
171
+
172
+ ### III. Common Features
173
+
174
+ 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 reinstalls the App or changes the device.
175
+
176
+ #### 3.1 Set Account ID
177
+
178
+ 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.
179
+
180
+ ```
181
+ // The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
182
+ TDAnalytics::login("TA");
183
+ ```
184
+
185
+ `Login` can be called multiple times. Each call will determine whether the passed account ID is consistent with the previously saved ID. If consistent, the call will be ignored; if inconsistent, the previous ID will be overridden.
186
+
187
+ <!-- unsupported block: 34 -->
188
+
189
+ **This method will not upload a login event**
190
+
191
+ #### 3.2 Set Public Event Properties
192
+
193
+ 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.
194
+
195
+ ```
196
+ TDJSONObject superProperties;
197
+ superProperties.setString("channel", "ta");//string
198
+ superProperties.setNumber("age",1);//number
199
+ superProperties.setBool("isSuccess",true);//boolean
200
+ superProperties.setDateTime("birthday","2020-01-02 10:52:52.290");//time
201
+
202
+ TDJSONObject object;
203
+ object.setString("key", "value");
204
+ superProperties.setJsonObject("object", object);// object
205
+
206
+ TDJSONObject object1;
207
+ object1.setString("key", "value");
208
+ vector<TDJSONObject> arr;
209
+ arr.push_back(object1);
210
+ superProperties.setList("object_arr", arr); // object array
211
+
212
+ vector<string> arr1;
213
+ arr1.push_back("value");
214
+ superProperties.setList("arr",arr1);//array
215
+
216
+ TDAnalytics::setSuperProperties(superProperties);
217
+ ```
218
+
219
+ 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.
220
+
221
+ - Event properties are of `TDJSONObject` type, where each element represents a property
222
+ - 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
223
+ - Value is the property value, supports string, number, boolean, time, object, object array, array
224
+ <!-- unsupported block: 34 -->
225
+
226
+ **Event properties and user properties requirements are the same as public event properties**
227
+
228
+ #### 3.3 Enable Auto-tracking
229
+
230
+ The following code example enables installation, start, and end events. If you want to learn more about SDK's auto-tracking capabilities, you can view the Auto-tracking Feature Introduction
231
+
232
+ ```
233
+ // Enable auto-tracking
234
+ TDAnalytics::enableAutoTrack();
235
+ ```
236
+
237
+ #### 3.4 Send Event
238
+
239
+ 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:
240
+
241
+ ```
242
+ TDJSONObject eventProperties;
243
+ eventProperties.setString("product_name", "Product Name");
244
+ TDAnalytics::track("product_buy", eventProperties);
245
+ ```
246
+
247
+ The event name is a string type, can only start with a letter, can contain numbers, letters and underscores "\_", maximum length 50 characters.
248
+
249
+ #### 3.5 Set User Properties
250
+
251
+ 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:
252
+
253
+ ```
254
+ //At this time username is TA
255
+ TDJSONObject properties;
256
+ properties.setString("username", "TA");
257
+ TDAnalytics::userSet(properties);
258
+ //At this time userName is TE
259
+ TDJSONObject newProperties;
260
+ newProperties.setString("username", "TE");
261
+ TDAnalytics::userSet(newProperties);
262
+ ```
263
+
264
+ <!-- unsupported block: 34 -->
265
+
266
+ Property format requirements are the same as event properties.
267
+
268
+ ### IV. Best Practices
269
+
270
+ The following example code includes all the above operations. We recommend following these steps:
271
+
272
+ ```
273
+ #include "./ThinkingAnalytics/Common/TDAnalytics.h"
274
+ using namespace thinkingdata::analytics;
275
+
276
+ if (Privacy Policy Authorization) {
277
+ //Initialize SDK
278
+ TDAnalytics::init(TA_APP_ID, TA_SERVER_URL);
279
+
280
+ //Enable auto-tracking events
281
+ TDAnalytics::enableAutoTrack();
282
+ //If the user has logged in, you can set the user's account ID as the unique identifier
283
+ TDAnalytics::login("TA");
284
+
285
+ //After setting public event properties, every event will have public event properties
286
+ TDJSONObject superProperties;
287
+ superProperties.setString("channel", "ta");//string
288
+ superProperties.setNumber("age",1);//number
289
+ superProperties.setBool("isSuccess",true);//boolean
290
+ superProperties.setDateTime("birthday","2020-01-02 10:52:52.290");//time
291
+
292
+ TDJSONObject object;
293
+ object.setString("key", "value");
294
+ superProperties.setJsonObject("object", object);// object
295
+
296
+ TDJSONObject object1;
297
+ object1.setString("key", "value");
298
+ vector<TDJSONObject> arr;
299
+ arr.push_back(object1);
300
+ superProperties.setList("object_arr", arr); // object array
301
+
302
+ vector<string> arr1;
303
+ arr1.push_back("value");
304
+ superProperties.setList("arr",arr1);//array
305
+ TDAnalytics::setSuperProperties(superProperties);
306
+
307
+ //Send event
308
+ TDJSONObject eventProperties;
309
+ eventProperties.setString("product_name", "Product Name");
310
+ TDAnalytics::track("product_buy",eventProperties);
311
+
312
+ //Set user properties
313
+ TDJSONObject userProperties;
314
+ userProperties.setString("username", "TE");
315
+ TDAnalytics::userSet(userProperties);
316
+ }
317
+ ```
318
+
319
+ ---
320
+
321
+ # Advanced Guide
322
+
323
+ ### I. Set User ID
324
+
325
+ The SDK instance defaults to using a random UUID 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 reinstalls the App or changes the device.
326
+
327
+ #### 1.1 Set Visitor ID
328
+
329
+ ::: tip Note
330
+
331
+ Generally, you do not need to customize the visitor ID. Please ensure you understand the user identification rules before setting the visitor ID.
332
+
333
+ If you need to replace the visitor ID, you should call it immediately after initializing the SDK. Do not call it multiple times to avoid creating unnecessary accounts.
334
+
335
+ :::
336
+
337
+ If your game has its own visitor ID management system for each user, you can call `setDistinctId` to set the visitor ID:
338
+
339
+ ```
340
+ // Set the visitor ID to "Thinker"
341
+ TDAnalytics::setDistinctId("Thinker");
342
+ ```
343
+
344
+ If you need to get the current visitor ID, you can call `getDistinctId`:
345
+
346
+ ```
347
+ //Return visitor ID
348
+ string distinctId = TDAnalytics::getDistinctId();
349
+ ```
350
+
351
+ #### 1.2 Set Account ID
352
+
353
+ 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.
354
+
355
+ ```
356
+ // The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
357
+ TDAnalytics::login("TA");
358
+ ```
359
+
360
+ <!-- unsupported block: 34 -->
361
+
362
+ **This method will not upload a login event**
363
+
364
+ #### 1.3 Clear Account ID
365
+
366
+ 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.
367
+
368
+ ```
369
+ TDAnalytics::logout();
370
+ ```
371
+
372
+ 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.
373
+
374
+ <!-- unsupported block: 34 -->
375
+
376
+ **This method will not upload a logout event**
377
+
378
+ ### II. Send Events
379
+
380
+ 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.
381
+
382
+ #### 2.1 Ordinary Events
383
+
384
+ 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:
385
+
386
+ ```
387
+ TDJSONObject eventProperties;
388
+ eventProperties.setString("product_name", "Product Name");
389
+ TDAnalytics::track("product_buy", eventProperties);
390
+ ```
391
+
392
+ #### 2.2 First-time Event
393
+
394
+ 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.
395
+
396
+ ```
397
+ TDJSONObject jsonObject;
398
+ jsonObject.setString("key","value");
399
+ TDFirstEventModel *firstEvent = new TDFirstEventModel("device_activation", jsonObject);
400
+ TDAnalytics::track(firstEvent);
401
+ ```
402
+
403
+ 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:
404
+
405
+ ```
406
+ // Set the user ID as the first_check_id of the first-time event to implement the collection of user first activation event
407
+ TDJSONObject jsonObject;
408
+ jsonObject.setString("key","value");
409
+ TDFirstEventModel *firstEvent = new TDFirstEventModel("account_activation", jsonObject);
410
+ firstEvent->setFirstCheckId("TA");
411
+ TDAnalytics::track(firstEvent);
412
+ ```
413
+
414
+ <!-- unsupported block: 34 -->
415
+
416
+ 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.
417
+
418
+ #### 2.3 Updatable Events
419
+
420
+ 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.
421
+
422
+ ```
423
+ // Example: Report an event that can be updated, assuming the event name is UPDATABLE_EVENT
424
+ // After reporting, the event property status is 3, price is 100
425
+ TDJSONObject jsonObject;
426
+ jsonObject.setNumber("status", 3);
427
+ jsonObject.setNumber("price", 100);
428
+ TDUpdatableEventModel *updatableEvent = new TDUpdatableEventModel("UPDATABLE_EVENT",jsonObject,"test_event_id");
429
+ TDAnalytics::track(updatableEvent);
430
+
431
+ // After reporting, the event property status is updated to 5, price remains unchanged
432
+ TDJSONObject jsonObject_new;
433
+ jsonObject_new.setNumber("status", 5);
434
+ TDUpdatableEventModel *updatableEvent = new TDUpdatableEventModel("UPDATABLE_EVENT",jsonObject_new,"test_event_id");
435
+ TDAnalytics::track(updatableEvent);
436
+ ```
437
+
438
+ #### 2.4 Overwritable Events
439
+
440
+ 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.
441
+
442
+ ```
443
+ // Example: Report an event that can be overwritten, assuming the event name is OVERWRITABLE_EVENT
444
+ // After reporting, the event property status is 3, price is 100
445
+ TDJSONObject jsonObject;
446
+ jsonObject.setNumber("status", 3);
447
+ jsonObject.setNumber("price", 100);
448
+ TDOverwritableEventModel *overWritableEvent = new TDOverwritableEventModel("OVERWRITABLE_EVENT",jsonObject,"test_event_id");
449
+ TDAnalytics::track(overWritableEvent);
450
+
451
+ // After reporting, the event property status is updated to 5, price property is deleted
452
+ TDJSONObject jsonObject_new;
453
+ jsonObject_new.setNumber("status", 5);
454
+ TDOverwritableEventModel overWritableEvent_new = new TDOverwritableEventModel("OVERWRITABLE_EVENT", jsonObject_new,"test_event_id");
455
+ TDAnalytics::track(overWritableEvent_new);
456
+ ```
457
+
458
+ #### 2.5 Public Event Properties
459
+
460
+ Public event properties refer to properties that will be uploaded with every event. Based on the property update frequency, public event properties are divided into `static public event properties` and `dynamic public event properties`. You can choose different public event property setting methods according to your specific business scenario requirements; we recommend that you set public event properties before sending events. For the same event, when the Key of public event properties, event custom properties, and preset properties are the same, we will assign values according to the following priority: `Custom Properties > Dynamic Public Event Properties > Static Public Event Properties > Preset Properties`.
461
+
462
+ ##### 2.5.1 Static Public Event Properties
463
+
464
+ Static public event properties are properties that change infrequently and are present in every event, such as user membership level. After setting static public event properties through `setSuperProperties`, the SDK will obtain the set public event properties as event properties when collecting events.
465
+
466
+ ```
467
+ TDJSONObject superProperties;
468
+ userProperties.setNumber("level",2);
469
+ TDAnalytics::setSuperProperties(superProperties);
470
+ ```
471
+
472
+ Static public event properties will be saved to the cache and do not need to be called every time the App starts. If the property already exists, the newly set property will override the original property value; if the property did not exist before, a new property will be created. Besides setting properties, we also provide other APIs to operate static public event properties to meet daily business needs.
473
+
474
+ ```
475
+ // Clear the public property named CHANNEL
476
+ TDAnalytics::unsetSuperProperty("CHANNEL");
477
+ // Clear all public properties
478
+ TDAnalytics::clearSuperProperties();
479
+ // Get all public properties
480
+ TDAnalytics::getSuperProperties();
481
+ ```
482
+
483
+ ##### 2.5.2 Dynamic Public Event Properties
484
+
485
+ Dynamic public event properties are properties that change frequently and are present in every event, such as the number of gold coins a user has. After setting the dynamic public property class through `setDynamicSuperPropertiesTracker`, the SDK will automatically obtain dynamic public event properties during event collection and add them to the triggered event.
486
+
487
+ ```
488
+ // Set dynamic public properties, dynamically get event occurrence time during event reporting
489
+ int coin = 0
490
+ TDJSONObject dynamicProperties()
491
+ {
492
+ coin++;
493
+ TDJSONObject obj;
494
+ obj.setNumber("coin",coin);
495
+ return obj;
496
+ }
497
+ TDAnalytics::setDynamicSuperProperties(dynamicProperties);
498
+ ```
499
+
500
+ #### 2.6 Record Event Duration
501
+
502
+ 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.
503
+
504
+ ```
505
+ //The following example completes the statistics of the user's stay duration on a certain product page
506
+ //User enters the product page, start timing
507
+ TDAnalytics::timeEvent("stay_shop");
508
+ // do some thing...
509
+ //User leaves the product page, timing ends, the "stay_shop" event will have a property #duration representing the event duration
510
+ TDAnalytics::track("stay_shop");
511
+ ```
512
+
513
+ ### III. User Properties
514
+
515
+ The user property setting APIs supported by TE platform are: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`.
516
+
517
+ #### 3.1 userSet
518
+
519
+ 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:
520
+
521
+ ```
522
+ //At this time username is TA
523
+ TDJSONObject properties;
524
+ properties.setString("username", "TA");
525
+ TDAnalytics::userSet(properties);
526
+ //At this time userName is TE
527
+ TDJSONObject newProperties;
528
+ newProperties.setString("username", "TE");
529
+ TDAnalytics::userSet(newProperties);
530
+ ```
531
+
532
+ #### 3.2 userSetOnce
533
+
534
+ 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:
535
+
536
+ ```
537
+ //first_payment_time is 2018-01-01 01:23:45.678
538
+ TDJSONObject userProperties;
539
+ userProperties.setString("first_payment_time","2018-01-01 01:23:45.678");
540
+ TDAnalytics::userSetOnce(userProperties);
541
+
542
+ //first_payment_time is still 2018-01-01 01:23:45.678
543
+ TDJSONObject newUserProperties;
544
+ newUserProperties.setString("first_payment_time","2018-12-31 01:23:45.678");
545
+ TDAnalytics::userSetOnce(newUserProperties);
546
+ ```
547
+
548
+ #### 3.3 userAdd
549
+
550
+ 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. Negative values can be passed, which is equivalent to a subtraction operation. Here is an example of accumulating total payment amount:
551
+
552
+ ```
553
+ //At this time total_revenue is 30
554
+ TDJSONObject userProperties;
555
+ userProperties.setNumber("total_revenue",30);
556
+ TDAnalytics::userAdd(userProperties);
557
+
558
+ //At this time total_revenue is 678
559
+ TDJSONObject newUserProperties;
560
+ newUserProperties.setNumber("total_revenue",648);
561
+ TDAnalytics::userAdd(newUserProperties);
562
+ ```
563
+
564
+ <!-- unsupported block: 34 -->
565
+
566
+ The property key is a string, and Value only allows numeric values.
567
+
568
+ #### 3.4 userUnset
569
+
570
+ If you need to reset a user's property, you can call `userUnset` to clear the value of a specified user property. This interface supports passing string or list type parameters:
571
+
572
+ ```
573
+ TDAnalytics::userUnset("coin");
574
+ ```
575
+
576
+ <!-- unsupported block: 34 -->
577
+
578
+ The passed value is the Key of the property to be cleared.
579
+
580
+ #### 3.5 userDelete
581
+
582
+ 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.
583
+
584
+ ```
585
+ TDAnalytics::userDelete();
586
+ ```
587
+
588
+ #### 3.6 userAppend
589
+
590
+ You can call `userAppend` to append elements to `List` type user properties:
591
+
592
+ ```
593
+ TDJSONObject userProperties;
594
+ vector<string> listValue;
595
+ listValue.push_back("apple");
596
+ listValue.push_back("ball");
597
+ userProperties.setList("user_list",listValue);
598
+ TDAnalytics::userAppend(userProperties);
599
+ ```
600
+
601
+ #### 3.7 userUniqAppend
602
+
603
+ You can call `userUniqAppend` to append elements to array type user properties. Calling `userUniqAppend` interface will deduplicate the appended user properties, while `userAppend` interface does not deduplicate, so user properties may contain duplicates.
604
+
605
+ ```
606
+ //At this time user_list property value is ["apple", "ball"]
607
+ TDJSONObject properties;
608
+ vector<string> dataArray;
609
+ dataArray.push_back("apple");
610
+ dataArray.push_back("ball");
611
+ properties.setList("user_list",dataArray);
612
+ TDAnalytics::userAppend(properties);
613
+
614
+ //At this time user_list property value is ["apple", "apple", "ball", "cube"]
615
+ TDJSONObject properties1;
616
+ vector<string> dataArray1;
617
+ dataArray1.push_back("apple");
618
+ dataArray1.push_back("cube");
619
+ properties1.setList("user_list",dataArray1);
620
+ TDAnalytics::userAppend(properties1);
621
+
622
+ //At this time user_list property value is ["apple", "ball", "cube"]
623
+ TDAnalytics::userUniqAppend(properties1);
624
+ ```
625
+
626
+ ### IV. Other Features
627
+
628
+ #### 4.1 Get Device ID
629
+
630
+ After SDK initialization is complete, SDK will automatically generate a device ID and record it in local cache. For the same application/game, the device ID of one device is unchanged. You can call `getDeviceId()` to get the device ID:
631
+
632
+ ```
633
+ TDAnalytics::getDeviceId();
634
+
635
+ // Use device ID as visitor ID
636
+ // TDAnalytics::setDistinctId(TDAnalytics::getDeviceId());
637
+ ```
638
+
639
+ #### 4.2 Calibrate Time
640
+
641
+ By default, SDK uses the local time as the event occurrence time for reporting. If users manually modify the device time, it will affect your business analysis. At this time, you can ensure the accuracy of event occurrence time through time calibration operations. We provide two time calibration methods: `timestamp` and `NTP`.
642
+
643
+ - You can use the current timestamp obtained from the server to calibrate SDK time. After that, all calls without specified time, including event data and user property setting operations, will use the calibrated time as the occurrence time.
644
+
645
+ ```
646
+ // 1585633785954 is the current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
647
+ TDAnalytics::calibrateTime(1585633785954);
648
+ ```
649
+
650
+ - You can also set the NTP server address. After that, SDK will attempt to obtain the current time from the passed NTP service address and calibrate SDK time. If the correct return result is not obtained within the default timeout time (3 seconds), the local time will be used to report data subsequently.
651
+
652
+ ```
653
+ // Use Apple NTP service to calibrate time
654
+ TDAnalytics::calibrateTimeWithNtp("time.apple.com");
655
+ ```
656
+
657
+ <!-- unsupported block: 34 -->
658
+
659
+ 1. Using NTP service for time calibration has certain uncertainty, we recommend you use the timestamp calibration method first
660
+
661
+ 2. You need to carefully select your NTP server address to ensure that user devices can quickly obtain server time under good network conditions
662
+
663
+ #### 4.3 Flush Data Immediately
664
+
665
+ In some business scenarios, if you expect data to be reported to the TE server immediately, you can complete it by calling the `flush` interface
666
+
667
+ ```
668
+ TDAnalytics::flush();
669
+ ```
670
+
671
+ #### 4.4 Data Encryption
672
+
673
+ Starting from version v1.3.2, SDK supports encryption function. The client supports using 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.
674
+
675
+ Call `setEnableEncrypt` to enable encryption, and set RSA public key information through `setSecretKey`
676
+
677
+ ```
678
+ TDConfig config1(APPID,SERVER_URL);
679
+ config1.setEnableEncrypt(true);// encryption
680
+ config1.setSecretKey(TDSecretKey(_version, _secretKey));
681
+ TDAnalytics::init(config1);
682
+ ```
683
+
684
+ ---
685
+
686
+ # Multiple Instances
687
+
688
+ In actual business, if you want to send data to multiple projects, you can use the multiple instance feature we provide.
689
+
690
+ Pass different project information to complete SDK initialization, and you can create multiple SDK instances.
691
+
692
+ ```
693
+ //Support initializing multiple APPID instances
694
+ TDAnalytics::init(TA_APP_ID, TA_SERVER_URL);
695
+ TDAnalytics::init(TA_APP_ID_1, TA_SERVER_URL_1);
696
+ //Use multiple instances for data tracking
697
+ TDJSONObject eventProperties;
698
+ eventProperties.setString("product_name", "Product Name");
699
+ TDAnalytics::track("product_buy", eventProperties, TA_APP_ID_1);
700
+ ```
701
+
702
+ <!-- unsupported block: 34 -->
703
+
704
+ Visitor ID, account ID, public properties, etc. are not shared among multiple projects, and need to be set separately for each APP ID instance.
705
+
706
+ ---
707
+
708
+ # Real-time Debugging
709
+
710
+ During SDK integration, you can perform real-time debugging by viewing SDK logs in the IDE console or using TE's Debug feature.
711
+
712
+ ### I. Print SDK Logs
713
+
714
+ ```
715
+ TDAnalytics::enableTrackLog(true);
716
+ ```
717
+
718
+ <!-- unsupported block: 34 -->
719
+
720
+ After enabling logs, you can filter ThinkingData related logs in the IDE to observe SDK data reporting.
721
+
722
+ ### II. Enable Debug Mode
723
+
724
+ Enabling Debug mode requires the following two steps:
725
+
726
+ 1. Enable Debug mode on the client side
727
+ The following is an example code for enabling Debug mode on the client side:
728
+
729
+ ```
730
+ /*
731
+ Set the running mode to Debug mode
732
+ NORMAL mode: Data will be stored in cache and reported according to a certain cache strategy. Default is NORMAL mode; recommended for production environment
733
+ Debug mode: Data is reported one by one. When problems occur, users will be prompted with logs and exceptions; not recommended for production environment
734
+ DebugOnly mode: Only validates data, will not be stored in database; not recommended for production environment
735
+ */
736
+ TDConfig config(TA_APP_ID, TA_SERVER_URL);// Set the running mode to Debug mode
737
+ config.setModel(TDModel::TD_DEBUG);
738
+ // Initialize SDK
739
+ TDAnalytics::init(config);
740
+ ```
741
+
742
+ 1. Add Debug device in TE backend
743
+ 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.
744
+
745
+ Device ID can be obtained through the following three ways:
746
+
747
+ - The #device_id property in event data in TE platform
748
+ - Client logs: SDK will print device DeviceId after initialization completes
749
+ - Through instance interface call: Get Device ID
750
+ <!-- unsupported block: 34 -->
751
+
752
+ 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.
753
+
754
+ ---
755
+
756
+ # Auto-tracking
757
+
758
+ TDAnalytics SDK provides auto-tracking for three types of events:
759
+
760
+ - ta_app_install: Game installation, this event will be collected when the game is first opened after installation
761
+ - ta_app_start: This event will be collected when the game enters foreground
762
+ - ta_app_end: This event will be collected when the game exits to background
763
+ Auto-tracking can be enabled by calling the `enableAutoTrack` interface:
764
+
765
+ ```
766
+ // Enable auto-tracking
767
+ TDAnalytics::enableAutoTrack();
768
+ ```
769
+
770
+ <!-- unsupported block: 34 -->
771
+
772
+ Note: If you need to customize the visitor ID, please be sure to call the setDistinctId interface to set the visitor ID before enabling the auto-tracking feature.
773
+
774
+ Starting from version v1.3.2, it supports setting custom properties for auto-tracking events. When collecting specified events, custom properties will be merged into the event properties and reported.
775
+
776
+ ```
777
+ // Enable auto-tracking and set custom properties
778
+ TDJSONObject autoProperties;
779
+ autoProperties.setString("auto_track_key", "auto_track_value");
780
+ TDAnalytics::enableAutoTrack(autoProperties);
781
+ ```
782
+
783
+ ---
784
+
785
+ # Preset Properties
786
+
787
+ ### I. Preset Properties Description
788
+
789
+ <!-- unsupported block: 34 -->
790
+
791
+ Preset properties collected by each platform will have certain differences. For details, please refer to the following documents: Android Platform, iOS Platform
792
+
793
+ **PC Platform Preset Properties:**
794
+
795
+ **Property Name**
796
+
797
+ **Chinese Name**
798
+
799
+ **Property Type**
800
+
801
+ **Description**
802
+
803
+ #ip
804
+
805
+ IP Address
806
+
807
+ Text
808
+
809
+ User's IP address, TE will use this to obtain user's geographic location information
810
+
811
+ #country
812
+
813
+ Country
814
+
815
+ Text
816
+
817
+ User's country, generated based on IP address
818
+
819
+ #country_code
820
+
821
+ Country Code
822
+
823
+ Text
824
+
825
+ User's country code (ISO 3166-1 alpha-2, i.e., two uppercase English letters), generated based on IP address
826
+
827
+ #province
828
+
829
+ Province
830
+
831
+ Text
832
+
833
+ User's province, generated based on IP address
834
+
835
+ #city
836
+
837
+ City
838
+
839
+ Text
840
+
841
+ User's city, generated based on IP address
842
+
843
+ #os
844
+
845
+ Operating System
846
+
847
+ Text
848
+
849
+ Such as MacOS, Windows, etc.
850
+
851
+ #device_id
852
+
853
+ Device ID
854
+
855
+ Text
856
+
857
+ User's device ID
858
+
859
+ #screen_height
860
+
861
+ Screen Height
862
+
863
+ Number
864
+
865
+ User's device screen height, such as 1920, etc.
866
+
867
+ #screen_width
868
+
869
+ Screen Width
870
+
871
+ Number
872
+
873
+ User's device screen height, such as 1080, etc.
874
+
875
+ #lib
876
+
877
+ SDK Type
878
+
879
+ Text
880
+
881
+ The type of SDK you integrated, such as Android, iOS, etc.
882
+
883
+ #lib_version
884
+
885
+ SDK Version
886
+
887
+ Text
888
+
889
+ The version of SDK you integrated
890
+
891
+ #zone_offset
892
+
893
+ Timezone Offset
894
+
895
+ Number
896
+
897
+ The number of hours the data time is offset relative to UTC time
898
+
899
+ #system_language
900
+
901
+ System Language
902
+
903
+ Text
904
+
905
+ User's device system language (ISO 639-1, i.e., two lowercase English letters), such as zh, en, etc.
906
+
907
+ ### II. Get Preset Properties
908
+
909
+ When server-side tracking needs some preset properties from the App side, you can get the preset properties from the App side through this method and pass them to the server side.
910
+
911
+ ```
912
+ //Get property object
913
+ TDPresetProperties* presetProperties = TDAnalytics::getPresetProperties();
914
+
915
+ //Generate event preset properties
916
+ TDJSONObject* properties = presetProperties->toEventPresetProperties();
917
+ /*
918
+ {
919
+ "#carrier": "China Telecom",
920
+ "#os": "Android",
921
+ "#device_id": "abb8e87bfb5ce66c",
922
+ "#screen_height": 2264,
923
+ "#bundle_id": "com.sw.thinkingdatademo",
924
+ "#manufacturer": "realme",
925
+ "#device_model": "RMX1991",
926
+ "#screen_width": 1080,
927
+ "#system_language": "zh",
928
+ "#os_version": "10",
929
+ "#network_type": "WIFI",
930
+ "#zone_offset": 8,
931
+ "#app_version":"1.0"
932
+ }
933
+ */
934
+
935
+ //Get a specific preset property
936
+ string bundleId = presetProperties->bundleId;//Package name
937
+ string os = presetProperties->os;//os type, such as Android
938
+ string systemLanguage = presetProperties->systemLanguage;//Mobile system language type
939
+ int screenWidth = presetProperties->screenWidth;//Screen width
940
+ int screenHeight = presetProperties->screenHeight;//Screen height
941
+ string deviceModel = presetProperties->deviceModel;//Device model
942
+ string deviceId = presetProperties->deviceId;//Device unique identifier
943
+ string carrier = presetProperties->carrier;//Mobile SIM card carrier information, for dual SIM dual standby, take the main card's carrier information
944
+ string manufacture = presetProperties->manufacturer;//Mobile manufacturer, such as HuaWei
945
+ string networkType = presetProperties->networkType;//Network type
946
+ string osVersion = presetProperties->osVersion;//System version number
947
+ string appVersion = presetProperties->appVersion;//app version number
948
+ double zoneOffset = presetProperties->zoneOffset;//Timezone offset value
949
+ ```
950
+
951
+ <!-- unsupported block: 34 -->
952
+
953
+ IP, country and city information are generated by server-side analysis, client does not provide interface to get these properties