@thinkingai/ae-cli 6.1.30 → 6.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +11 -5
  2. package/README.zh.md +11 -5
  3. package/bin/ai-monitor.js +2 -0
  4. package/dist/ai-monitor-MKMHSSNI.js +32 -0
  5. package/dist/ai-monitor.js +135 -0
  6. package/dist/{auth-ADZHUIJR.js → auth-CZHHPZOQ.js} +10 -9
  7. package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
  8. package/dist/{capability-QXFRJYZD.js → capability-64KVJFIA.js} +27 -31
  9. package/dist/{chunk-YULUBP3R.js → chunk-3ULDJJTZ.js} +1 -1
  10. package/dist/{chunk-HRUOV6EQ.js → chunk-4XKTRCRK.js} +15 -15
  11. package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
  12. package/dist/chunk-6M7ZEDT2.js +182 -0
  13. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  14. package/dist/chunk-BNBCMCYN.js +563 -0
  15. package/dist/chunk-CF6JTT2U.js +64 -0
  16. package/dist/{chunk-CG773QXN.js → chunk-DWBYNGSR.js} +564 -314
  17. package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
  18. package/dist/{chunk-TFORY6WY.js → chunk-FCAA7I2D.js} +2 -2
  19. package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
  20. package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
  21. package/dist/chunk-IDDWEZ7F.js +1285 -0
  22. package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
  23. package/dist/{chunk-AVXDJAFC.js → chunk-NLEXY2TM.js} +47 -12
  24. package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
  25. package/dist/{chunk-EUFP4M2A.js → chunk-T7WF4HYW.js} +84 -32
  26. package/dist/{chunk-Y3AM6LIO.js → chunk-TMQGS4TO.js} +15 -10
  27. package/dist/{compat-check-HERBTQZN.js → compat-check-ZJNCMNQV.js} +2 -2
  28. package/dist/{config-E3KANXMK.js → config-FSH2NMNZ.js} +25 -12
  29. package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
  30. package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
  31. package/dist/index.js +81 -583
  32. package/dist/{memory-SNFR5M23.js → memory-VEZZVAAP.js} +4 -4
  33. package/dist/{metadata-EXQYDZTH.js → metadata-3IWHX3V4.js} +7 -7
  34. package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
  35. package/dist/{personal-semantic-preference-ETY3KU2O.js → personal-semantic-preference-YITU23SA.js} +6 -6
  36. package/dist/{project-semantic-UHRMVOJF.js → project-semantic-MHEXJF3C.js} +15 -13
  37. package/dist/{sync-XKEBXESC.js → sync-AQHVCSPI.js} +4 -4
  38. package/dist/{te-agent-S6UQR4IE.js → te-agent-RXI7WOH4.js} +5 -5
  39. package/dist/{te-analysis-WOFFCIBC.js → te-analysis-CZY74HVF.js} +380 -191
  40. package/dist/{te-community-R7B6QYOO.js → te-community-DKCYUBCM.js} +6 -6
  41. package/dist/{te-dataops-KPILYVHA.js → te-dataops-QEH6VE56.js} +3 -3
  42. package/dist/{te-engage-IAUM6ONX.js → te-engage-WK7WKDKF.js} +6 -6
  43. package/dist/{te-experiment-TMLRA7B3.js → te-experiment-LH3RPIOE.js} +274 -29
  44. package/dist/{te-kb-GKWPSLSY.js → te-kb-UPORIOVN.js} +16 -7
  45. package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
  46. package/dist/{te-team-ISN52YNG.js → te-team-LLVTO2G4.js} +5 -5
  47. package/dist/{things-DDQ52Z3Q.js → things-XLMLBYQR.js} +5 -5
  48. package/dist/{update-CTLNTX35.js → update-7J5UQHSK.js} +3 -3
  49. package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
  50. package/package.json +9 -7
  51. package/skills/ae-ai-monitor/SKILL.md +179 -0
  52. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  53. package/skills/ae-analysis/SKILL.md +10 -4
  54. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  55. package/skills/ae-analysis/references/ai_models/path.md +5 -6
  56. package/skills/ae-analysis/references/ai_models.md +1 -0
  57. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  58. package/skills/ae-analysis/references/asset_search.md +1 -1
  59. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  60. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  61. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  62. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  63. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  64. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  65. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  66. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  67. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  68. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  69. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  70. package/skills/ae-analysis/references/catalog_list.md +2 -0
  71. package/skills/ae-analysis/references/command_index.md +38 -29
  72. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  73. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  74. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  75. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  76. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  77. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  78. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  79. package/skills/ae-analysis/references/folder_share.md +8 -2
  80. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  81. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  82. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  83. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  84. package/skills/ae-analysis/references/project_member_add.md +3 -1
  85. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  86. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  87. package/skills/ae-analysis/references/project_member_update.md +3 -1
  88. package/skills/ae-analysis/references/project_owner_update.md +3 -1
  89. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  90. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  91. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  92. package/skills/ae-analysis/references/project_space_share.md +8 -2
  93. package/skills/ae-analysis/references/property_get.md +2 -0
  94. package/skills/ae-analysis/references/public_link_list.md +3 -1
  95. package/skills/ae-analysis/references/query_cancel.md +4 -1
  96. package/skills/ae-analysis/references/report_data_run.md +1 -1
  97. package/skills/ae-analysis/references/report_list.md +3 -3
  98. package/skills/ae-analysis/references/scenario_append.md +2 -2
  99. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  100. package/skills/ae-analysis/references/scenario_list.md +2 -1
  101. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  102. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  103. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  104. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  105. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  106. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  107. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  108. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  109. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  110. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  111. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  112. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  113. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  114. package/skills/ae-automation/SKILL.md +4 -2
  115. package/skills/ae-capability/SKILL.md +9 -5
  116. package/skills/ae-community/SKILL.md +1 -0
  117. package/skills/ae-dataops/SKILL.md +1 -0
  118. package/skills/ae-engage/SKILL.md +1 -0
  119. package/skills/ae-evaluation/SKILL.md +17 -2
  120. package/skills/ae-experiment/SKILL.md +38 -11
  121. package/skills/ae-experiment/references/experiment_approval.md +171 -0
  122. package/skills/ae-experiment/references/manage_experiment.md +11 -2
  123. package/skills/ae-experiment/references/save_experiment.md +28 -8
  124. package/skills/ae-experiment/references/save_submit_experiment.md +18 -3
  125. package/skills/ae-experiment/references/save_submit_external_experiment.md +57 -3
  126. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  127. package/skills/ae-kb/SKILL.md +5 -3
  128. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  129. package/skills/ae-kb/references/query-workflow.md +3 -1
  130. package/skills/ae-kb/references/versions.md +1 -1
  131. package/skills/ae-metadata/SKILL.md +1 -0
  132. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  133. package/skills/ae-team/SKILL.md +1 -1
  134. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  135. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  136. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  137. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  138. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  139. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  140. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  141. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  142. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  143. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  144. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  145. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  146. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  147. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  148. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  149. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  150. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  151. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  152. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  153. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  154. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  155. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  156. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  157. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  158. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  159. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  160. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  161. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  162. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  163. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  164. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  165. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  166. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  167. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  168. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  169. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  170. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  171. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  172. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  173. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  174. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  175. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  176. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  177. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  178. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  179. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  180. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  181. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  182. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  183. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  184. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  185. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  186. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  187. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  188. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  189. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  190. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  191. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  192. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  193. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  194. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  195. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  196. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  197. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  198. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  199. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  200. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  201. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  202. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  203. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  204. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  205. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  206. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  207. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  208. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  209. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  210. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  211. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  212. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  213. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  214. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  215. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  216. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  217. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  218. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  219. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  220. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  221. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  222. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  223. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  224. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  225. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  226. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  227. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  228. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  229. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  230. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  231. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  232. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  233. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  234. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  235. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  236. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  237. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  238. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  239. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  240. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  241. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  242. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  243. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  244. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  245. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  246. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  247. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  248. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  249. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  250. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  251. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  252. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  253. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  254. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  255. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  256. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  257. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  258. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  259. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  260. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  261. package/dist/chunk-AMBFK2K3.js +0 -28
@@ -0,0 +1,902 @@
1
+ ---
2
+ code: openharmony_sdk_installation
3
+ name: "OpenHarmony"
4
+ wikiToken: CdewwjvM9irVHckq2lvctVPNnhf
5
+ parentWikiToken: FTcTwinIOi3OiRkK4MPc2Ex7neg
6
+ updateTime: 1768296999000
7
+ sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=openharmony_sdk_installation
8
+ ---
9
+
10
+ # OpenHarmony
11
+
12
+ ::: tip Tip
13
+
14
+ Before integration, please read the Pre-Integration Guide first.
15
+
16
+ SDK requires minimum system version of API 10
17
+
18
+ SDK (har format) size is approximately 56 KB
19
+
20
+ SDK Name: ThinkingData SDK
21
+
22
+ Developer: ThinkingData Information Technology (Shanghai) Co., Ltd.
23
+
24
+ Version: 1.7.6
25
+
26
+ Function: SDK collects client logs through events and user properties, with capabilities for statistics on daily active users, usage duration, retention behavior analysis, etc.
27
+
28
+ Privacy Statement: ThinkingData SDK Privacy Statement
29
+
30
+ Compliance Guide: ThinkingData SDK Compliance Guide
31
+
32
+ :::
33
+
34
+ **Latest Version:** 1.7.6
35
+
36
+ **Resource Download:** SDK Download
37
+
38
+ **SDK Package Name:** @thinkingdata/analytics
39
+
40
+ **MD5 Value:** 1b29126f457d46724e4287fecb0e4cdc
41
+
42
+ **Update Time:** 2026-01-05
43
+
44
+ ### 1. SDK Integration
45
+
46
+ 1. Import SDK
47
+
48
+ - Execute the following command
49
+
50
+ ```
51
+ ohpm i @thinkingdata/analytics
52
+ ```
53
+
54
+ - Or manually add dependency in oh-packages.json5 under dependencies, then IDE will prompt ohpm install, click to install
55
+
56
+ ```
57
+ "dependencies": {
58
+ "@thinkingdata/analytics": "1.7.6",
59
+ }
60
+ ```
61
+
62
+ ### 2. Initialization
63
+
64
+ ```
65
+ import { TDAnalytics, TDConfig, TDMode } from '@thinkingdata/analytics';
66
+
67
+ // Method 1
68
+ TDAnalytics.init(context, "appId", "serverUrl")
69
+
70
+ // Method 2
71
+ let config = new TDConfig()
72
+ config.appId = 'appId'
73
+ config.serverUrl = 'serverUrl'
74
+ config.mode = TDMode.NORMAL
75
+ config.enableAutoCalibrated = true
76
+ TDAnalytics.initWithConfig(context, config)
77
+ ```
78
+
79
+ During SDK initialization, it collects operating system version, device manufacturer, operating system, screen resolution, device model, APP version, network status, network carrier, application installation time, system language and other information for statistical analysis functions.
80
+
81
+ Parameter description:
82
+
83
+ - `APPID`: Your project's APPID, can be obtained through TE project management page
84
+ - `SERVER_URL`: Data upload URL
85
+ - If you are connecting to cloud service, please check the reporting address in Project Management -> Integration Configuration.
86
+ - If you use privately deployed version, you can customize the data collection address.
87
+ - `mode`: SDK reporting mode, default is Normal mode.
88
+ - `enableAutoCalibrated`: Automatically enable time calibration.
89
+
90
+ ### 3. Common Features
91
+
92
+ Before using common features, we recommend you understand user identification rules first; SDK will generate random number as visitor ID by default, and persist visitor ID locally; before user logs in, visitor ID will be used as identity identification ID. Note: Visitor ID will change when user reinstalls App or changes device.
93
+
94
+ #### 3.1 Set Account ID
95
+
96
+ When user logs in, you can call `login` to set user's account ID, TE platform will use account ID as identity identification ID, and the set account ID will be retained until `logout` is called. Calling `login` multiple times will overwrite the previous account ID.
97
+
98
+ ```
99
+ // User's unique login identifier, this data corresponds to #account_id in reported data, at this time #account_id value is TA
100
+ TDAnalytics.login("TA");
101
+ ```
102
+
103
+ **This method will not upload login event**
104
+
105
+ #### 3.2 Set Public Event Properties
106
+
107
+ Public event properties are properties that every event will have, you can call `setSuperProperties` to set public event properties, we recommend you set public event properties before sending events. For some important properties, such as user's membership level, source channel, etc., these properties need to be set in every event, you can set these properties as public event properties.
108
+
109
+ ```
110
+ let superProperties = {};
111
+ superProperties["channel"] = "ta";//String
112
+ superProperties["age"] = 1;//Number
113
+ superProperties["isSuccess"] = true;//Boolean
114
+ superProperties["birthday"] = new Date();//Time
115
+ superProperties["object"] = {key:"value"};//Object
116
+ superProperties["object_arr"] = [{key:"value"}];//Object array
117
+ superProperties["arr"] = ["value"];//Array
118
+ TDAnalytics.setSuperProperties(superProperties)
119
+ ```
120
+
121
+ Public event properties will be saved to cache, no need to call every time when starting App. If `setSuperProperties` is called to upload previously set public event properties, it will overwrite previous properties.
122
+
123
+ #### 3.3 Enable Auto-tracking
124
+
125
+ It is recommended to enable enableAutoTrack after onWindowStageCreate, the following code example enables all auto-tracking events:
126
+
127
+ ```
128
+ //APP install event TDAutoTrackEventType.APP_INSTALL
129
+ //APP start event TDAutoTrackEventType.APP_START
130
+ //APP end event TDAutoTrackEventType.APP_END
131
+ //APP page view event TDAutoTrackEventType.APP_VIEW_SCREEN
132
+ //APP control click event TDAnalytics.TDAutoTrackEventType.APP_CLICK
133
+ //APP crash event TDAutoTrackEventType.APP_CRASH
134
+ TDAnalytics.enableAutoTrack(context,TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_INSTALL | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_VIEW_SCREEN | TDAutoTrackEventType.APP_CLICK | TDAutoTrackEventType.APP_CRASH)
135
+ ```
136
+
137
+ #### 3.4 Send Event
138
+
139
+ You can call `track` to upload events, we recommend you set event properties according to the previously prepared tracking document, here we use user purchasing a product as an example:
140
+
141
+ ```
142
+ TDAnalytics.track({
143
+ eventName: 'product_buy',
144
+ properties:{
145
+ product_name:"Product Name"
146
+ }
147
+ })
148
+ ```
149
+
150
+ Event name is string type, must start with letter, can contain numbers, letters and underscore "\_".
151
+
152
+ #### 3.5 Set User Properties
153
+
154
+ For general user properties, you can call `userSet` to set them, properties uploaded using this interface will overwrite existing property values; if the user property did not exist before, it will create a new user property with the same type as the passed property type, here we use setting username as an example:
155
+
156
+ ```
157
+ // username is TA
158
+ TDAnalytics.userSet({
159
+ properties: {
160
+ username: "TA"
161
+ }
162
+ })
163
+ //username is TE
164
+ TDAnalytics.userSet({
165
+ properties: {
166
+ username: "TE"
167
+ }
168
+ })
169
+ ```
170
+
171
+ ### 4. Best Practices
172
+
173
+ The following example code includes all the above operations, we recommend using the following steps:
174
+
175
+ ```
176
+ import { TDAnalytics, TDConfig, TDMode } from '@thinkingdata/analytics';
177
+ let config = new TDConfig()
178
+ config.appId = 'appId'
179
+ config.serverUrl = 'serverUrl'
180
+ config.enableAutoCalibrated = true
181
+ config.mode = TDMode.NORMAL
182
+ // Initialize
183
+ TDAnalytics.initWithConfig(this.context, config)
184
+ //Enable auto-tracking
185
+ TDAnalytics.enableAutoTrack(context,TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_INSTALL | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_VIEW_SCREEN | TDAutoTrackEventType.APP_CLICK | TDAutoTrackEventType.APP_CRASH)
186
+ // User's unique login identifier, this data corresponds to #account_id in reported data, at this time #account_id value is TA
187
+ TDAnalytics.login("TA");
188
+ //Set public event properties
189
+ let superProperties = {
190
+ channel : "ta", //String
191
+ age : 1,//Number
192
+ isSuccess : true,//Boolean
193
+ birthday : new Date(),//Object
194
+ object : { key : "value" },//Object
195
+ object_arr : [ { key : "value" } ],//Object array
196
+ arr : [ "value" ]//Array
197
+ };
198
+ TDAnalytics.setSuperProperties(superProperties);
199
+ //Send event
200
+ TDAnalytics.track({
201
+ eventName: "product_buy", // Event name
202
+ properties: {
203
+ product_name: "Product Name"
204
+ } //Event properties
205
+ });
206
+ //Set user properties
207
+ TDAnalytics.userSet({
208
+ properties: {
209
+ username: "TE"
210
+ }
211
+ });
212
+ ```
213
+
214
+ ---
215
+
216
+ # Advanced Guide
217
+
218
+ ### 1. Set User Identification
219
+
220
+ SDK instance will use random UUID as default visitor ID for each user by default, this ID will be used as identity identification ID for user in unlogged state. Note that visitor ID will change when user reinstalls App or changes device.
221
+
222
+ #### 1.1 Set Visitor ID
223
+
224
+ ::: tip Tip
225
+
226
+ Generally, you don't need to customize visitor ID. Please make sure you understand user identification rules before setting visitor ID.
227
+
228
+ If you need to replace visitor ID, you should call it immediately after SDK initialization ends, do not call multiple times to avoid creating useless accounts
229
+
230
+ :::
231
+
232
+ If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set visitor ID:
233
+
234
+ ```
235
+ // Set visitor ID to Thinker
236
+ TDAnalytics.setDistinctId("Thinker");
237
+ ```
238
+
239
+ If you need to get current visitor ID, you can call `getDistinctId` to get:
240
+
241
+ ```
242
+ //Return visitor ID
243
+ let distinctId = TDAnalytics.getDistinctId();
244
+ ```
245
+
246
+ #### 1.2 Set Account ID
247
+
248
+ When user logs in, you can call `login` to set user's account ID, TE platform will use account ID as identity identification ID, and the set account ID will be retained until `logout` is called. Calling `login` multiple times will overwrite the previous account ID.
249
+
250
+ ```
251
+ //User's unique login identifier, this data corresponds to #account_id in reported data, at this time #account_id value is TA
252
+ TDAnalytics.login("TA");
253
+ ```
254
+
255
+ **This method will not upload login event**
256
+
257
+ #### 1.3 Clear Account ID
258
+
259
+ After user logs out, you can call `logout` to clear account ID, before calling `login` next time, visitor ID will be used as identity identification ID.
260
+
261
+ ```
262
+ // Remove #account_id from reported data, subsequent data will not have #account_id
263
+ TDAnalytics.logout();
264
+ ```
265
+
266
+ We recommend you call `logout` when there is an explicit logout event, such as when user performs account cancellation action, rather than calling it when closing App.
267
+
268
+ **This method will not upload logout event**
269
+
270
+ ### 2. Send Event
271
+
272
+ After SDK initialization is complete, you can perform data tracking and collect user behavior information. Generally, normal events can meet business scenario requirements, you can also use first, updatable and other events according to your actual business scenarios.
273
+
274
+ #### 2.1 Normal Event
275
+
276
+ You can call `track` to upload events, we recommend you set event properties and conditions for sending events according to the previously prepared document, here we use user purchasing a product as an example:
277
+
278
+ ```
279
+ TDAnalytics.track({
280
+ eventName: "product_buy", // Event name
281
+ properties: {
282
+ product_name: "Product Name"
283
+ } //Event properties
284
+ });
285
+ ```
286
+
287
+ #### 2.2 First Event
288
+
289
+ First event refers to events that will only be recorded once for a certain device or other dimension ID. For example, in some scenarios, you may want to record the activation event on a certain device, then you can use first event to report data.
290
+
291
+ ```
292
+ TDAnalytics.trackFirst({
293
+ eventName: "device_activation",
294
+ properties: { key: "value" }
295
+ });
296
+ ```
297
+
298
+ If you want to determine whether it's the first time based on dimensions other than device, you can customize first_check_id for first event:
299
+
300
+ ```
301
+ // Set user ID as first_check_id for first event, to collect user's first activation event
302
+ TDAnalytics.trackFirst({
303
+ eventName: "account_activation",
304
+ firstCheckId: "TA",
305
+ properties: { key: "value" }
306
+ });
307
+ ```
308
+
309
+ Note: Since the verification of whether it's the first time is completed on the server side, first event will be delayed by 1 hour before entering the database by default.
310
+
311
+ #### 2.3 Updatable Event
312
+
313
+ You can use updatable event to achieve the requirement of modifying event data in specific scenarios. Updatable event needs to specify the ID that identifies the event and pass it when creating the updatable event object. TE will determine the data that needs to be updated based on event name and event ID.
314
+
315
+ ```
316
+ // Example: Report an updatable event, assume event name is UPDATABLE_EVENT
317
+ // After reporting, event property status is 3, price is 100
318
+ TDAnalytics.trackUpdate({
319
+ eventName: "UPDATABLE_EVENT",
320
+ properties: { status: 3, price: 100 },
321
+ eventId: "test_event_id"
322
+ });
323
+
324
+ // After reporting, event property status is updated to 5, price unchanged
325
+ TDAnalytics.trackUpdate({
326
+ eventName: "UPDATABLE_EVENT",
327
+ properties: { status: 5 },
328
+ eventId: "test_event_id"
329
+ });
330
+ ```
331
+
332
+ #### 2.4 Overwritable Event
333
+
334
+ Overwritable event is similar to updatable event, the difference is that overwritable event will completely overwrite historical data with the latest data, from the effect it's equivalent to deleting the previous data and storing the latest data in the database. TE will determine the data that needs to be updated based on event name and event ID.
335
+
336
+ ```
337
+ // Example: Report an overwritable event, assume event name is OVERWRITE_EVENT
338
+ // After reporting, event property status is 3, price is 100
339
+ TDAnalytics.trackOverwrite({
340
+ eventName: "OVERWRITE_EVENT",
341
+ properties: { status: 3, price: 100 },
342
+ eventId: "test_event_id"
343
+ });
344
+
345
+ // After reporting, event property status is updated to 5, price property is deleted
346
+ TDAnalytics.trackOverwrite({
347
+ eventName: "OVERWRITE_EVENT",
348
+ properties: { status: 5 },
349
+ eventId: "test_event_id"
350
+ });
351
+ ```
352
+
353
+ #### 2.5 Public Event Properties
354
+
355
+ For some important properties, such as user's 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 every event will have. We recommend you set public properties before sending events.
356
+
357
+ ##### 2.5.1 Static Public Event Properties
358
+
359
+ For some important properties, such as user's 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 be globally effective.
360
+
361
+ ```
362
+ // Set public event properties, all data events will have these properties
363
+ TDAnalytics.setSuperProperties({
364
+ channel: "Channel Name",
365
+ user_name: "Username"
366
+ });
367
+ ```
368
+
369
+ Besides property setting, we also provide other APIs to operate static public event properties to meet daily business needs.
370
+
371
+ ```
372
+ // Get static public event properties
373
+ let superProperties = TDAnalytics.getSuperProperties();
374
+ // Clear a static public event property, for example clear previously set 'channel' property, subsequent data will not have this property
375
+ TDAnalytics.unsetSuperProperty("channel");
376
+ // Clear all static public event properties
377
+ TDAnalytics.clearSuperProperties();
378
+ ```
379
+
380
+ ##### 2.5.2 Dynamic Public Event Properties
381
+
382
+ Set dynamic public property callback function through `setDynamicSuperProperties`, SDK will trigger callback function when reporting events and add the returned JSON object to event properties. `setDynamicSuperProperties` parameter is a function, the function needs to return a JSON object.
383
+
384
+ ```
385
+ // Set dynamic public properties, trigger callback function when reporting events and add returned JSON object to event properties
386
+ TDAnalytics.setDynamicSuperProperties(() => {
387
+ return {
388
+ dy_name: 'xxx',
389
+ dy_age: 18
390
+ }
391
+ })
392
+ ```
393
+
394
+ #### 2.6 Record Event Duration
395
+
396
+ 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, it will automatically add `#duration` property in your event properties to represent the recorded duration, unit is seconds. Note that the same event name can only have one timing task.
397
+
398
+ ```
399
+ //The following example completes the statistics of user's stay duration on a product page
400
+ TDAnalytics.timeEvent("stay_shop");
401
+ /**do something
402
+ .......
403
+ **/
404
+ //User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
405
+ TDAnalytics.track({
406
+ eventName: "stay_shop",
407
+ properties: {
408
+ product_name: "Product Name"
409
+ }
410
+ });
411
+ ```
412
+
413
+ ### 3. User Properties
414
+
415
+ TE platform supported user property setting APIs are: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`.
416
+
417
+ #### 3.1 userSet
418
+
419
+ For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite existing property values, if the user property did not exist before, it will create a new user property with the same type as the passed property type, here we use setting username as an example:
420
+
421
+ ```
422
+ // username is TA
423
+ TDAnalytics.userSet({
424
+ properties: {
425
+ username: "TA"
426
+ }
427
+ });
428
+ //username is TE
429
+ TDAnalytics.userSet({
430
+ properties: {
431
+ username: "TE"
432
+ }
433
+ });
434
+ ```
435
+
436
+ #### 3.2 userSetOnce
437
+
438
+ If the user property you want to upload only needs to be set once, you can call `userSetOnce` to set it, when the property already has a value before, this message will be ignored, here we use setting first payment time as an example:
439
+
440
+ ```
441
+ //first_payment_time is 2018-01-01 01:23:45.678
442
+ TDAnalytics.userSetOnce({
443
+ properties: {
444
+ first_payment_time: "2018-01-01 01:23:45.678"
445
+ }
446
+ });
447
+ //first_payment_time is still 2018-01-01 01:23:45.678
448
+ TDAnalytics.userSetOnce({
449
+ properties: {
450
+ first_payment_time: "2018-12-31 01:23:45.678"
451
+ }
452
+ });
453
+ ```
454
+
455
+ #### 3.3 userAdd
456
+
457
+ When you want to upload numeric properties, you can call `userAdd` to accumulate the property, if the property hasn't been set yet, it will assign 0 before calculation. If negative value is passed, it's equivalent to subtraction operation.
458
+
459
+ ```
460
+ //At this time total_revenue is 30
461
+ TDAnalytics.userAdd({
462
+ properties: {
463
+ total_revenue: 30
464
+ }
465
+ });
466
+ //At this time total_revenue is 678
467
+ TDAnalytics.userAdd({
468
+ properties: {
469
+ total_revenue: 648
470
+ }
471
+ });
472
+ ```
473
+
474
+ #### 3.4 userUnset
475
+
476
+ When you want to clear 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
477
+
478
+ ```
479
+ // Clear user property value with property name userPropertykey, i.e. set to NULL
480
+ TDAnalytics.userUnset({
481
+ property: "userPropertykey"
482
+ });
483
+ ```
484
+
485
+ #### 3.5 userDelete
486
+
487
+ If you want to delete a user, you can call `userDelete` to delete this user, you will no longer be able to query this user's user properties, but the events generated by this user can still be queried.
488
+
489
+ ```
490
+ TDAnalytics.userDelete();
491
+ ```
492
+
493
+ #### 3.6 userAppend
494
+
495
+ You can call `userAppend` to append elements to array type user data.
496
+
497
+ ```
498
+ TDAnalytics.userAppend({
499
+ properties: {
500
+ user_list: ["apple", "ball"]
501
+ }
502
+ });
503
+ ```
504
+
505
+ #### 3.7 userUniqAppend
506
+
507
+ You can call `userUniqAppend` to append unique elements to Array (List) type user data. Calling `userUniqAppend` interface will deduplicate the appended user properties, `userAppend` interface does not deduplicate, user properties can have duplicates.
508
+
509
+ ```
510
+ //At this time user_list property value is ["apple", "ball"]
511
+ TDAnalytics.userAppend({
512
+ properties: {
513
+ user_list: ["apple", "ball"]
514
+ }
515
+ });
516
+ //At this time user_list property value is ["apple", "apple", "ball", "cube"]
517
+ TDAnalytics.userAppend({
518
+ properties: {
519
+ user_list: ["apple", "cube"]
520
+ }
521
+ });
522
+ //At this time user_list property value is ["apple", "ball", "cube"]
523
+ TDAnalytics.userUniqAppend({
524
+ properties: {
525
+ user_list: ["apple", "cube"]
526
+ }
527
+ });
528
+ ```
529
+
530
+ ### 4. Encryption Feature
531
+
532
+ SDK supports using AES+RSA to encrypt data. Data encryption feature needs client and server to cooperate, please consult customer success personnel for specific usage method.
533
+
534
+ ```
535
+ let config = new TDConfig()
536
+ config.appId = 'app_id'
537
+ config.serverUrl = 'server_url'
538
+ //Enable encryption feature, set public key information
539
+ config.enableEncrypt(1,'publicKey')
540
+ TDAnalytics.initWithConfig(context, config)
541
+ ```
542
+
543
+ ### 5. Enable Integration with H5 Pages
544
+
545
+ If you need to integrate with JavaScript SDK that collects H5 page data, call the following interface when initializing `WebView`
546
+
547
+ ```
548
+ controller: webview.WebviewController = new webview.WebviewController();
549
+ TDAnalytics.setJsBridge(controller)
550
+ ```
551
+
552
+ ### 6. Other Features
553
+
554
+ #### 5.1 Get Device ID
555
+
556
+ You can call `getDeviceId()` to get device ID.
557
+
558
+ ```
559
+ let deviceId = TDAnalytics.getDeviceId();
560
+ ```
561
+
562
+ **Device ID will be saved in cache, if user clears cache, device ID will be reset.**
563
+
564
+ #### 5.2 Calibrate Time
565
+
566
+ SDK will use local time as event occurrence time by default, if user manually modifies device time it will affect your business analysis, you can ensure the accuracy of event occurrence time through time calibration operation. We provide `timestamp` and `automatic` two time calibration methods.
567
+
568
+ - You can use the current timestamp obtained from server to calibrate SDK time. After that, all calls without specified time, including event data and user property setting operations, will use calibrated time as occurrence time.
569
+
570
+ ```
571
+ // 1585633785954 is current unix timestamp, unit is milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
572
+ TDAnalytics.calibrateTime(1585633785954)
573
+ ```
574
+
575
+ - You can also set automatic time calibration, after that SDK will try to get current time from config interface and calibrate SDK time. If correct return result is not obtained, subsequent data will be reported using local time.
576
+
577
+ ```
578
+ let config = new TDConfig()
579
+ config.appId = 'appId'
580
+ config.serverUrl = 'serverUrl'
581
+ //Set to true to enable automatic time calibration
582
+ config.enableAutoCalibrated = true
583
+ TDAnalytics.initWithConfig(context, config)
584
+ ```
585
+
586
+ #### 5.3 Set Default Timezone
587
+
588
+ By default, SDK will use local time as event occurrence time. You can also set default timezone interface to specify timezone, so all events will align event time according to your set timezone:
589
+
590
+ ```
591
+ import I18n from '@ohos.i18n';
592
+ let config = new TDConfig()
593
+ config.appId = 'appId'
594
+ config.serverUrl = 'serverUrl'
595
+ config.defaultTimeZone = I18n.getTimeZone('Australia/Sydney')
596
+ TDAnalytics.initWithConfig(this.context, config)
597
+ ```
598
+
599
+ Aligning event time with specified timezone will lose device local timezone information. If you need to preserve device local timezone information, currently you need to add related properties to events yourself.
600
+
601
+ #### 5.4 Flush Data Immediately
602
+
603
+ In some business scenarios, if you expect data to be reported to TE server immediately, you can call `flush` interface to complete
604
+
605
+ ```
606
+ TDAnalytics.flush();
607
+ ```
608
+
609
+ ---
610
+
611
+ # Multi-Instance
612
+
613
+ ### 1. Feature Introduction
614
+
615
+ We support using multiple AppIds to create SDK instances, we call it multi-instance. Through multi-instance feature, you can report data to different projects.
616
+
617
+ ### 2. Create Multi-Instance
618
+
619
+ Pass different APP ID to complete SDK initialization, you can create multiple SDK instances:
620
+
621
+ ```
622
+ //Initialize config 1
623
+ var config_1 = {
624
+ appId: "app-id-1",
625
+ serverUrl: "https://youserverurl.1.com"
626
+ };
627
+ TDAnalytics.init(config_1);
628
+
629
+ //Initialize config 2
630
+ var config_2 = {
631
+ appId: "app-id-2",
632
+ serverUrl: "https://youserverurl.2.com"
633
+ };
634
+ TDAnalytics.init(config_2);
635
+
636
+ //Report event to config 1 (without app-id, default reports to config 1)
637
+ TDAnalytics.track({
638
+ eventName: 'event_from_appid_1'
639
+ });
640
+ //Report event to config 1 (specify app-id-1)
641
+ TDAnalytics.track({
642
+ eventName: 'event_from_appid_1'
643
+ }, 'app-id-1');
644
+ //Report event to config 2 (specify app-id-2)
645
+ TDAnalytics.track({
646
+ eventName: 'event_from_appid_2'
647
+ }, 'app-id-2');
648
+ ```
649
+
650
+ Please note that multiple SDK instances' APP IDs must be different, most data between multi-instances is not shared, details can be referred to Section 4 "Data and Settings Sharing between Multi-Instances".
651
+
652
+ ### 3. Data Sharing between Multi-Instances
653
+
654
+ Most interfaces are called by instance objects, so most data and settings are not shared between multi-APPID instances, parent instances and lightweight instances, but some data and settings will take effect for all instances, here is the detailed explanation of whether all data and settings are shared between multi-instances:
655
+
656
+ 1. Account related information
657
+
658
+ - System default generated visitor ID `#distinct_id`: Shared
659
+ - Visitor ID `#distinct_id` set by calling `identify`: Not shared
660
+ - Account ID `#account_id` set by calling `login`: Not shared
661
+
662
+ 1. Event reporting `track` and user property reporting `user_set`, `user_setOnce`, `user_add`, `user_delete`: Not shared
663
+ 1. Public properties `setSuperProperties` and dynamic public properties `setDynamicSuperPropertiesTracker`: Not shared
664
+ 1. Record event duration `timeEvent`: Not shared
665
+
666
+ ---
667
+
668
+ # Real-time Debugging
669
+
670
+ During SDK integration, you can perform real-time debugging by viewing SDK logs in IDE console or using TE's Debug feature.
671
+
672
+ ### 1. Print SDK Logs
673
+
674
+ ```
675
+ TDAnalytics.enableLog(true)
676
+ ```
677
+
678
+ After enabling logs, you can observe SDK data reporting in IDE.
679
+
680
+ ### 2. Enable Debug Mode
681
+
682
+ Enabling Debug mode requires the following two steps:
683
+
684
+ 1. Client enables Debug mode
685
+ Here is the client Debug mode enable example code:
686
+
687
+ ```
688
+ /*
689
+ Set running mode to Debug mode
690
+ TDMode.NORMAL: Data will be stored in cache and reported according to certain cache strategy, default is NORMAL mode; recommended for production environment
691
+ TDMode.DEBUG: Data is reported one by one. When problems occur, it will prompt users with logs and exceptions; not recommended for production environment
692
+ TDMode.DEBUG_ONLY: Only validates data, will not store in database; not recommended for production environment
693
+ */
694
+ let config = new TDConfig()
695
+ config.appId = 'appID'
696
+ config.serverUrl = 'serverUrl'
697
+ config.mode = TDMode.DEBUG
698
+ await TDAnalytics.initWithConfig(this.context, config)
699
+ ```
700
+
701
+ 1. TE backend adds Debug device
702
+ To avoid Debug mode going live in production environment, it is specified that only designated devices can enable Debug mode. Only when client has enabled Debug mode and device ID is configured in TE backend's "Tracking Management" page's "Debug Data" section can Debug mode be enabled.
703
+
704
+ Device ID can be obtained through the following three ways:
705
+
706
+ - #device_id property in event data on TE platform
707
+ - Client log: SDK will print device DeviceId after initialization is complete
708
+ - Call through instance interface: Get Device ID
709
+
710
+ Debug mode may affect data collection quality and App stability, only use for integration phase data validation, do not use in production environment.
711
+
712
+ ---
713
+
714
+ # Auto-tracking
715
+
716
+ OpenHarmony SDK supports auto-tracking of events including installation, start, end, etc.
717
+
718
+ ### 1. Introduction
719
+
720
+ TE system provides automated data collection interface, you can choose the data that needs to be automatically collected according to business needs.
721
+
722
+ Currently supported auto-tracking event types are:
723
+
724
+ 1. Install event: Records APP installation behavior
725
+ 1. Start event: Including opening APP and opening APP from background
726
+ 1. End event: Including closing APP and App entering background
727
+ 1. View event: User browsing page (Ability) in APP
728
+ 1. Click event: User clicking control in APP
729
+ 1. Crash event: APP records crash information when crash occurs (native layer crash is not supported temporarily)
730
+
731
+ Next we will introduce each data collection method in detail
732
+
733
+ ### 2. Enable Auto-tracking
734
+
735
+ You can call `enableAutoTrack` to enable auto-tracking feature:
736
+
737
+ ```
738
+ //APP install event TDAutoTrackEventType.APP_INSTALL
739
+ //APP start event TDAutoTrackEventType.APP_START
740
+ //APP end event TDAutoTrackEventType.APP_END
741
+ //APP page view event TDAutoTrackEventType.APP_VIEW_SCREEN
742
+ //APP control click event TDAnalytics.TDAutoTrackEventType.APP_CLICK
743
+ //APP crash event TDAutoTrackEventType.APP_CRASH
744
+ TDAnalytics.enableAutoTrack(context,TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_INSTALL | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_VIEW_SCREEN | TDAutoTrackEventType.APP_CLICK | TDAutoTrackEventType.APP_CRASH)
745
+ ```
746
+
747
+ Note: enableAutoTrack needs to be called in main thread. If you need to initialize SDK in work thread, you can refer to the following code
748
+
749
+ ```
750
+ const workerInstance = new worker.ThreadWorker("./workers/worker.ets");
751
+ TDAnalytics.enableAutoTrack(this.context,
752
+ TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_INSTALL | TDAutoTrackEventType.APP_END |
753
+ TDAutoTrackEventType.APP_VIEW_SCREEN | TDAutoTrackEventType.APP_CRASH |
754
+ TDAutoTrackEventType.APP_CLICK,
755
+ (command: string, params: Object, appId?: string) => {
756
+ //Here will callback the auto-tracking events that need to be triggered, need to send message to work thread to process
757
+ workerInstance.postMessage({
758
+ type: command,
759
+ params: params
760
+ })
761
+ })
762
+ ```
763
+
764
+ ```
765
+ const workerPort = worker.workerPort;
766
+
767
+ workerPort.onmessage = (d: MessageEvents): void => {
768
+ if (d.data.type === 'track') {
769
+ TDAnalytics.track(d.data.params);
770
+ } else if (d.data.type === 'timeEvent') {
771
+ TDAnalytics.timeEvent(d.data.params);
772
+ } else if (d.data.type === 'flush') {
773
+ TDAnalytics.flush()
774
+ }
775
+ }
776
+ ```
777
+
778
+ ### 3. Detailed Introduction
779
+
780
+ ##### 3.1 Install Event
781
+
782
+ APP install event will record the actual installation of APP, reported when APP starts, event trigger time is the time of first start after APP installation, APP upgrade will not trigger install event, but delete and reinstall will report install event.
783
+
784
+ - Event name: ta_app_install
785
+
786
+ ##### 3.2 Start Event
787
+
788
+ APP start event will be triggered when user opens APP or wakes APP from background, detailed event introduction:
789
+
790
+ - Event name: ta_app_start
791
+ - Preset property: `#resume_from_background`, boolean type, indicates whether APP is user opened or woke from background, value true means woke from background, false means directly opened.
792
+ - Triggered through onApplicationForeground callback in ApplicationStateChangeCallback
793
+
794
+ ##### 3.3 End Event
795
+
796
+ APP end event will be triggered when user closes APP or puts APP into background, detailed event introduction:
797
+
798
+ - Event name: ta_app_end
799
+ - Preset property: `#duration`, numeric type, indicates the duration of this APP visit (from start to end), unit is seconds.
800
+ - Triggered through onApplicationBackground callback in ApplicationStateChangeCallback
801
+
802
+ ##### 3.4 Page View Event
803
+
804
+ APP page view event will be triggered when user browses page (`Ability`), detailed event introduction:
805
+
806
+ - Event name: ta_app_view
807
+ - Preset properties:
808
+ `#screen_name`, string type, is `Ability`'s simple class name
809
+
810
+ ##### 3.5 Click Event
811
+
812
+ APP control click event will be triggered when user clicks control (view)
813
+
814
+ - Event name: ta_app_click
815
+ - Preset properties:
816
+ `#screen_name`, string type, is package name.class name of control's belonging `Activity`
817
+
818
+ `#element_type`, string type, is control's type
819
+
820
+ `#element_id`, string type, is control's ID
821
+
822
+ ##### 3.6 Crash Event
823
+
824
+ When APP encounters uncaught exception, APP crash event will be reported
825
+
826
+ - Event name: ta_app_crash
827
+ - Preset property: `#app_crashed_reason`, character type, records crash stack trace
828
+ - Monitored through ErrorObserver's onUnhandledException, native crash collection is not supported temporarily.
829
+
830
+ ---
831
+
832
+ # Preset Properties
833
+
834
+ ### 1. Preset Properties for All Events
835
+
836
+ The following preset properties are preset properties that all events (including auto-tracking events) in OpenHarmony SDK will have
837
+
838
+ **Property Name** | **Chinese Name** | **Property Type** | **Collection Time** | **Description**
839
+ #ip | IP Address | Text | Server collection | User's IP address, TE will use this to get user's geographic location information
840
+ #country | Country | Text | Server collection | User's country, generated based on IP address
841
+ #country_code | Country Code | Text | Server collection | User's country code (ISO 3166-1 alpha-2, i.e. two uppercase English letters), generated based on IP address
842
+ #province | Province | Text | Server collection | User's province, generated based on IP address
843
+ #city | City | Text | Server collection | User's city, generated based on IP address
844
+ #os_version | Operating System Version | Text | Collected once at initialization | iOS 11.2.2, Android 8.0.0, etc.
845
+ #manufacturer | Device Manufacturer | Text | Collected once at initialization | User device's manufacturer, such as Apple, vivo, etc.
846
+ #os | Operating System | Text | Collected once at initialization | Such as Android, iOS, HarmonyOS, etc.
847
+ #device_id | Device ID | Text | Collected once at initialization | User's device ID, iOS takes user's IDFV or UUID, Android takes androidID
848
+ #screen_height | Screen Height | Number | Collected once at initialization | User device's screen height, such as 1920
849
+ #screen_width | Screen Width | Number | Collected once at initialization | User device's screen height, such as 1080
850
+ #device_model | Device Model | Text | Collected once at initialization | User device's model, such as iPhone 8
851
+ #device_type | Device Type | Text | Collected once at initialization | Device type, such as "Tablet", "Phone"
852
+ #app_version | APP Version | Text | Collected once at initialization | Your APP's version
853
+ #bundle_id | Application Unique Identifier | Text | Collected once at initialization | Application package name or process name
854
+ #lib | SDK Type | Text | Collected once at initialization | SDK type you integrated, such as Android, iOS, etc.
855
+ #lib_version | SDK Version | Text | Collected once at initialization | SDK version you integrated
856
+ #network_type | Network Status | Text | Collected once at initialization, collected when network status changes | Network status when uploading event, such as WIFI, 3G, 4G, etc.
857
+ #carrier | Network Carrier | Text | Collected once at initialization | User device's network carrier, such as China Mobile, China Telecom, etc.
858
+ #zone_offset | Timezone Offset | Number | Collected when event occurs | Data time offset hours relative to UTC time
859
+ #install_time | Program Installation Time | Time | Collected once at initialization | User's application installation time, value comes from system
860
+ #system_language | System Language | Text | Collected once at initialization | User device's system language (ISO 639-1, i.e. two lowercase English letters), such as zh, en, etc.
861
+
862
+ ### 2. Get Preset Properties
863
+
864
+ You can call `getPresetProperties()` method to get preset properties.
865
+
866
+ When server tracking needs some preset properties from App side, you can get App side preset properties through this method, then pass to server.
867
+
868
+ ```
869
+ TDAnalytics.getPresetProperties()
870
+
871
+ /**
872
+ {
873
+ "#os": "HarmonyOS",
874
+ "#os_version": 10,
875
+ "#bundle_id": "com.example.tdharmonyosdemo",
876
+ "#install_time": "2023-10-19 18:46:00.105",
877
+ "#manufacturer": "HUAWEI",
878
+ "#device_model": "NOH-AN00",
879
+ "#device_type": "phone",
880
+ "#screen_width": 1344,
881
+ "#screen_height": 2772,
882
+ "#system_language": "zh-Hans",
883
+ "#carrier": "China Telecom",
884
+ "#app_version": "1.0.1",
885
+ "#device_id": "9811b90b-ee24-45c1-950a-77ee0ffc7a1c",
886
+ "#zone_offset": 8
887
+ }
888
+ */
889
+ ```
890
+
891
+ ### 3. Disable Preset Properties
892
+
893
+ In some scenarios,for compliance, actual business requirements, and other considerations, you may want to disable collection of certain preset properties. You can configure `disablePresetProperties` parameter during SDK initialization to configure the array of properties that need to be disabled. Example code:
894
+
895
+ ```
896
+ let config = new TDConfig()
897
+ config.appId = 'appId'
898
+ config.serverUrl = 'url'
899
+ config.disablePresetProperties =["#lib", "#lib_version", "#os", "#os_version", "#bundle_id", "#install_time", "#manufacturer", "#device_model",
900
+ "#device_type", "#screen_width", "#screen_height","#system_language","#carrier","#app_version","#device_id","#network_type","#ip"]
901
+ TDAnalytics.initWithConfig(context, config)
902
+ ```