@thinkingai/ae-cli 6.0.57 → 6.0.60

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 (257) hide show
  1. package/README.md +10 -5
  2. package/README.zh.md +10 -5
  3. package/bin/ai-monitor.js +2 -0
  4. package/dist/ai-monitor-FCXSLHAP.js +32 -0
  5. package/dist/ai-monitor.js +135 -0
  6. package/dist/{auth-YEIJLBFY.js → auth-ATK2SLEV.js} +12 -11
  7. package/dist/{automation-NAR5DDGL.js → automation-FLCPFMN4.js} +5 -5
  8. package/dist/{capability-P7DD4Q73.js → capability-6KTSOI7L.js} +32 -36
  9. package/dist/{chunk-JCWM2TYP.js → chunk-2ETRY2CU.js} +16 -16
  10. package/dist/{chunk-IN7KKL6K.js → chunk-2F64AZYH.js} +1 -1
  11. package/dist/{chunk-JNVVJ273.js → chunk-4PSTYEG5.js} +5 -10
  12. package/dist/{chunk-QEMQKVHW.js → chunk-5E7MTTFN.js} +3 -3
  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-AXTO4FTM.js +1285 -0
  17. package/dist/{chunk-TKVVACEJ.js → chunk-BEYLCUZX.js} +17 -12
  18. package/dist/chunk-CF6JTT2U.js +64 -0
  19. package/dist/{chunk-N6XBLRB7.js → chunk-F2VFZUGG.js} +2 -2
  20. package/dist/{chunk-ZGIYG473.js → chunk-HSZAIPUX.js} +48 -13
  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-7JAVT5TK.js → chunk-KTJXD27G.js} +2 -2
  24. package/dist/{chunk-TULINOLS.js → chunk-LOR4IA26.js} +565 -315
  25. package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
  26. package/dist/{chunk-7ABK2PEJ.js → chunk-SDKW6LYE.js} +88 -36
  27. package/dist/{chunk-752BSLZC.js → chunk-VJUXKVRE.js} +1 -1
  28. package/dist/chunk-VRMGHQKE.js +556 -0
  29. package/dist/{compat-check-PMEGUPZU.js → compat-check-XD2U7PZ2.js} +3 -3
  30. package/dist/{config-VWVPR4WW.js → config-U3GDWU6E.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 +87 -582
  35. package/dist/{memory-HHPX3NF2.js → memory-WEB27VI6.js} +8 -8
  36. package/dist/{metadata-HEQQEEG3.js → metadata-7FYE4234.js} +8 -8
  37. package/dist/{model-7UHGWYVR.js → model-T7H7Q6BG.js} +3 -3
  38. package/dist/{personal-semantic-preference-V4L6ZWR2.js → personal-semantic-preference-O6VXM74A.js} +7 -7
  39. package/dist/{project-semantic-NKHKJX6M.js → project-semantic-2GGFJWW6.js} +16 -14
  40. package/dist/{sync-ZJMXCRIN.js → sync-ULBB7WO5.js} +5 -5
  41. package/dist/{te-agent-WBKIFEQD.js → te-agent-6RMF7LUV.js} +6 -6
  42. package/dist/{te-analysis-ADX7RKO4.js → te-analysis-HSYC7GNV.js} +383 -194
  43. package/dist/{te-community-PREDRXG3.js → te-community-FLKZGQKB.js} +10 -10
  44. package/dist/{te-dataops-ITWJHO2U.js → te-dataops-OQQGTCUA.js} +5 -5
  45. package/dist/{te-engage-VE2NUH5V.js → te-engage-RIEBHL5T.js} +10 -10
  46. package/dist/{te-kb-WSMOW7WS.js → te-kb-4HG2FMHJ.js} +19 -10
  47. package/dist/{te-system-YM657FKO.js → te-system-AL4B4XZL.js} +3 -3
  48. package/dist/{te-team-T2WRLOOD.js → te-team-5O4UVUWE.js} +6 -6
  49. package/dist/{things-6QOMFXOG.js → things-TSJ64GBT.js} +6 -6
  50. package/dist/{update-I4MOUYOX.js → update-Q5LURAWV.js} +4 -4
  51. package/dist/{workspace-LYDAP647.js → workspace-FF2HXJGR.js} +5 -5
  52. package/package.json +8 -6
  53. package/skills/ae-ai-monitor/SKILL.md +179 -0
  54. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  55. package/skills/ae-analysis/SKILL.md +10 -4
  56. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  57. package/skills/ae-analysis/references/ai_models.md +1 -0
  58. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  59. package/skills/ae-analysis/references/asset_search.md +1 -1
  60. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  61. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  62. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  63. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  64. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  65. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  66. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  67. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  68. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  69. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  70. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  71. package/skills/ae-analysis/references/catalog_list.md +2 -0
  72. package/skills/ae-analysis/references/command_index.md +38 -29
  73. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  74. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  75. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  76. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  77. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  78. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  79. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  80. package/skills/ae-analysis/references/folder_share.md +8 -2
  81. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  82. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  83. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  84. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  85. package/skills/ae-analysis/references/project_member_add.md +3 -1
  86. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  87. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  88. package/skills/ae-analysis/references/project_member_update.md +3 -1
  89. package/skills/ae-analysis/references/project_owner_update.md +3 -1
  90. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  91. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  92. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  93. package/skills/ae-analysis/references/project_space_share.md +8 -2
  94. package/skills/ae-analysis/references/property_get.md +2 -0
  95. package/skills/ae-analysis/references/public_link_list.md +3 -1
  96. package/skills/ae-analysis/references/query_cancel.md +4 -1
  97. package/skills/ae-analysis/references/report_data_run.md +1 -1
  98. package/skills/ae-analysis/references/report_list.md +3 -3
  99. package/skills/ae-analysis/references/scenario_append.md +2 -2
  100. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  101. package/skills/ae-analysis/references/scenario_list.md +2 -1
  102. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  103. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  104. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  105. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  106. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  107. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  108. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  109. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  110. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  111. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  112. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  113. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  114. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  115. package/skills/ae-automation/SKILL.md +4 -2
  116. package/skills/ae-capability/SKILL.md +9 -5
  117. package/skills/ae-community/SKILL.md +1 -0
  118. package/skills/ae-dataops/SKILL.md +1 -0
  119. package/skills/ae-engage/SKILL.md +1 -0
  120. package/skills/ae-evaluation/SKILL.md +17 -2
  121. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  122. package/skills/ae-kb/SKILL.md +9 -5
  123. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  124. package/skills/ae-kb/references/query-workflow.md +9 -6
  125. package/skills/ae-kb/references/versions.md +1 -1
  126. package/skills/ae-kb-discovery/SKILL.md +15 -6
  127. package/skills/ae-metadata/SKILL.md +1 -0
  128. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  129. package/skills/ae-team/SKILL.md +1 -1
  130. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  131. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  132. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  133. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  134. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  135. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  136. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  137. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  138. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  139. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  140. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  141. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  142. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  143. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  144. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  145. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  146. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  147. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  148. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  149. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  150. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  151. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  152. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  153. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  154. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  155. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  156. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  157. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  158. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  159. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  160. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  161. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  162. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  163. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  164. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  165. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  166. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  167. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  168. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  169. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  170. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  171. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  172. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  173. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  174. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  175. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  176. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  177. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  178. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  179. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  180. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  181. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  182. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  183. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  184. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  185. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  186. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  187. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  188. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  189. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  190. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  191. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  192. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  193. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  194. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  195. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  196. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  197. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  198. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  199. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  200. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  201. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  202. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  203. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  204. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  205. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  206. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  207. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  208. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  209. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  210. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  211. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  212. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  213. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  214. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  215. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  216. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  217. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  218. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  219. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  220. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  221. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  222. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  223. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  224. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  225. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  226. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  227. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  228. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  229. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  230. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  231. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  232. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  233. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  234. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  235. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  236. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  237. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  238. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  239. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  240. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  241. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  242. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  243. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  244. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  245. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  246. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  247. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  248. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  249. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  250. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  251. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  252. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  253. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  254. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  255. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  256. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  257. package/dist/chunk-AMBFK2K3.js +0 -28
@@ -0,0 +1,1107 @@
1
+ ---
2
+ code: uniapp_sdk_installation
3
+ name: "uni-app"
4
+ wikiToken: GbYiwd3aTiL4m3k73D6cVoSknAb
5
+ parentWikiToken: EaDPwgIujiz2GKk0rWxct8ZNn4g
6
+ updateTime: 1764068108000
7
+ sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=uniapp_sdk_installation
8
+ ---
9
+
10
+ # uni-app
11
+
12
+ ::: tip Tip
13
+
14
+ Before integration, please read the pre-installation preparation first.
15
+
16
+ uni-app SDK supports platforms: iOS, Android, Web, WeChat Mini Program, Baidu Mini Program, ByteDance Mini Program, Alipay Mini Program, DingTalk Mini Program, Kuaishou Mini Program, QQ Mini Program, JD Mini Program, 360 Mini Program.
17
+
18
+ :::
19
+
20
+ **Latest Version:** 3.0.0 Download
21
+
22
+ **Update Time:** 2023-11-10
23
+
24
+ **Resource Download:** Source code
25
+
26
+ ::: warning Note
27
+
28
+ This document applies to v3.0.0 and later versions. For historical versions, please refer to uni-app Integration Guide (V1), SDK Download (V1)
29
+
30
+ :::
31
+
32
+ ### 1. SDK Integration
33
+
34
+ Download and unzip uni-app SDK
35
+
36
+ You can directly put `tdanalytics.uniapp.js` into your project and reference it in source code:
37
+
38
+ ```
39
+ import TDAnalytics from './tdanalytics.uniapp.js'
40
+ ```
41
+
42
+ ### 2. Initialization
43
+
44
+ After importing TE SDK, you can use TDAnalytics in code:
45
+
46
+ ```
47
+ var config = {
48
+ appId: "YOUR_APPID",
49
+ serverUrl: "YOUR_SERVER_URL",
50
+ autoTrack: {
51
+ appLaunch: true, // Auto-track ta_mp_launch
52
+ appShow: true, // Auto-track ta_mp_show
53
+ appHide: true, // Auto-track ta_mp_hide
54
+ }
55
+ };
56
+ // Initialize
57
+ TDAnalytics.init(config)
58
+ ```
59
+
60
+ TE configuration object parameter description:
61
+
62
+ - `appId`: Your project's APP ID, required, can be viewed on TE backend project management page
63
+ - `serverUrl`: Data reporting URL, required
64
+ - If you are using cloud service, enter: https://global-receiver-ta.thinkingdata.cn
65
+ - If you are using private deployment version, please confirm the reporting address with operations team
66
+ - `autoTrack`: Optional, indicates whether to enable auto-tracking feature. Each element represents the following auto-tracking events, all disabled by default:
67
+ - `appLaunch`: Auto-track mini program initialization
68
+ - `appShow`: Auto-track mini program start, or from background to foreground
69
+ - `appHide`: Auto-track mini program from foreground to background
70
+ ::: warning Note
71
+
72
+ Before reporting data, please add the data transmission URL to the server domain's request list in the development settings of WeChat Public Platform or other platforms.
73
+
74
+ :::
75
+
76
+ ### 3. Common Features
77
+
78
+ Before using common features, we recommend you first understand the user identification rules. SDK will generate random number as visitor ID by default and persistently store it locally. Before user login, visitor ID will be used as identity identification ID. Note: Visitor ID will change when user clears cache or changes device.
79
+
80
+ #### 3.1 Setting Account ID
81
+
82
+ 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. Multiple calls to `login` will overwrite the previous account ID.
83
+
84
+ ```
85
+ // User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TA
86
+ TDAnalytics.login("TA");
87
+ ```
88
+
89
+ <!-- unsupported block: 34 -->
90
+
91
+ **This method will not upload login event**
92
+
93
+ #### 3.2 Setting Common Event Properties
94
+
95
+ Common event properties refer to properties that every event will have. You can call `setSuperProperties` to set common event properties. We recommend you set common 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. In this case, you can set these properties as common event properties.
96
+
97
+ ```
98
+ var superProperties = {
99
+ channel : "ta", //string
100
+ age : 1,//number
101
+ isSuccess : true,//boolean
102
+ birthday : new Date(),//object
103
+ object : { key : "value" },//object
104
+ object_arr : [ { key : "value" } ],//object array
105
+ arr : [ "value" ]//array
106
+ };
107
+ TDAnalytics.setSuperProperties(superProperties);//set common event properties
108
+ ```
109
+
110
+ Common event properties will be saved to cache and don't need to be called every time on startup. If `setSuperProperties` is called to upload a previously set common event property, it will overwrite the previous property.
111
+
112
+ - Key is the property name, string type, must start with a letter, contain numbers, letters and underscore "\_", maximum 50 characters, case insensitive, TE will convert to lowercase
113
+ - Value is the property value, supports string, number, boolean, time, object, object array, array
114
+ <!-- unsupported block: 34 -->
115
+
116
+ **Event property, user property requirements are consistent with common event properties**
117
+
118
+ #### 3.3 Sending Events
119
+
120
+ You can call `track` to upload events. We recommend you set event properties and sending conditions according to your previously prepared tracking document. Here is an example of user purchasing a product:
121
+
122
+ ```
123
+ TDAnalytics.track({
124
+ eventName: "product_buy", // Event name
125
+ properties: {
126
+ product_name: "product name"
127
+ } //Event properties
128
+ });
129
+ ```
130
+
131
+ Event name is string type, must start with a letter, can contain numbers, letters and underscore "\_", maximum 50 characters.
132
+
133
+ #### 3.4 Setting User Properties
134
+
135
+ For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
136
+
137
+ ```
138
+ //username is TA
139
+ TDAnalytics.userSet({
140
+ properties: {
141
+ username: "TA"
142
+ }
143
+ });
144
+ //userName is TE
145
+ TDAnalytics.userSet({
146
+ properties: {
147
+ username: "TE"
148
+ }
149
+ });
150
+ ```
151
+
152
+ ### 4. Best Practices
153
+
154
+ The following sample code includes all the above operations. We recommend using the following steps:
155
+
156
+ ```
157
+ var config = {
158
+ appId: "YOUR_APPID", // Project APP ID
159
+ serverUrl: "YOUR_SERVER_URL", // Reporting address
160
+ autoTrack: {
161
+ appLaunch: true, // Auto-track ta_mp_launch
162
+ appShow: true, // Auto-track ta_mg_show
163
+ appHide: true, // Auto-track ta_mp_hide
164
+ }
165
+ };
166
+ // Create TE instance
167
+ TDAnalytics.init(config);
168
+ // User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TA
169
+ TDAnalytics.login("TA");
170
+ //Set common event properties
171
+ var superProperties = {
172
+ channel : "ta", //string
173
+ age : 1,//number
174
+ isSuccess : true,//boolean
175
+ birthday : new Date(),//object
176
+ object : { key : "value" },//object
177
+ object_arr : [ { key : "value" } ],//object array
178
+ arr : [ "value" ]//array
179
+ };
180
+ TDAnalytics.setSuperProperties(superProperties);
181
+ //Send event
182
+ TDAnalytics.track({
183
+ eventName: "product_buy", // Event name
184
+ properties: {
185
+ product_name: "product name"
186
+ } //Event properties
187
+ );
188
+ //Set user properties
189
+ TDAnalytics.userSet({
190
+ properties: {
191
+ username: "TE"
192
+ }
193
+ });
194
+ ```
195
+
196
+ ---
197
+
198
+ # Advanced Guide
199
+
200
+ ### 1. Setting User ID
201
+
202
+ SDK instance will use random number as the default visitor ID for each user by default. This ID will be used as the identity identification ID when user is not logged in. Note that visitor ID will change when user clears cache or changes device.
203
+
204
+ #### 1.1 Setting Visitor ID
205
+
206
+ ::: tip Tip
207
+
208
+ Generally, you don't need to customize visitor ID. Please make sure you understand the user identification rules before setting visitor ID.
209
+
210
+ :::
211
+
212
+ If your App has its own visitor ID management system for each user, you can call `identify` to set visitor ID:
213
+
214
+ ```
215
+ // Set visitor ID to Thinker
216
+ TDAnalytics.setDistinctId("Thinker");
217
+ ```
218
+
219
+ If you need to get the current visitor ID, you can call `getDistinctId`:
220
+
221
+ ```
222
+ //Return visitor ID
223
+ let distinctId = TDAnalytics.getDistinctId();
224
+ ```
225
+
226
+ <!-- unsupported block: 34 -->
227
+
228
+ If you need to set it, you must call this interface before initialization
229
+
230
+ #### 1.2 Setting Account ID
231
+
232
+ 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. Multiple calls to `login` will overwrite the previous account ID.
233
+
234
+ ```
235
+ //User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TA
236
+ TDAnalytics.login("TA");
237
+ ```
238
+
239
+ <!-- unsupported block: 34 -->
240
+
241
+ **This method will not upload login event**
242
+
243
+ #### 1.3 Clearing Account ID
244
+
245
+ After user logs out, you can call `logout` to clear account ID. Before the next `login` call, visitor ID will be used as identity identification ID.
246
+
247
+ ```
248
+ // Remove "#account_id" from reported data, subsequent data will not have "#account_id"
249
+ TDAnalytics.logout();
250
+ ```
251
+
252
+ We recommend you call `logout` at explicit logout events, such as when user performs account deregistration action, rather than when closing App.
253
+
254
+ <!-- unsupported block: 34 -->
255
+
256
+ **This method will not upload logout event**
257
+
258
+ ### 2. Sending Events
259
+
260
+ After SDK initialization is completed, you can perform data tracking and collect user behavior information. Regular events can generally meet business scenario requirements. You can also use first-time, updatable events according to your actual business scenarios.
261
+
262
+ #### 2.1 Regular Events
263
+
264
+ You can call `track` to upload events. We recommend you set event properties and sending conditions according to your previously prepared document. Here is an example of user purchasing a product
265
+
266
+ ```
267
+ TDAnalytics.track(
268
+ eventName: "product_buy", // Event name
269
+ properties: {
270
+ product_name: "product name"
271
+ } //Event properties
272
+ );
273
+ ```
274
+
275
+ #### 2.2 First-time Events
276
+
277
+ First-time events refer 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 an activation event on a certain device, you can use first-time events to report data.
278
+
279
+ ```
280
+ TDAnalytics.trackFirst({
281
+ eventName: "device_activation",
282
+ properties: { key: "value" }
283
+ });
284
+ ```
285
+
286
+ If you want to use other dimensions other than device to judge whether it's first-time, you can customize first_check_id for first-time events:
287
+
288
+ ```
289
+ // Set user ID as first_check_id for first-time event, to collect user first-time activation event
290
+ TDAnalytics.trackFirst({
291
+ eventName: "account_activation",
292
+ firstCheckId: "TA",
293
+ properties: { key: "value" }
294
+ });
295
+ ```
296
+
297
+ <!-- unsupported block: 34 -->
298
+
299
+ Note: Since the verification of whether it's first-time is completed on the server side, first-time events will be delayed by 1 hour before being stored in database.
300
+
301
+ #### 2.3 Updatable Events
302
+
303
+ You can use updatable events to implement the need to modify event data in specific scenarios. Updatable events need to specify an ID that identifies the event, and pass it when creating the updatable event object. TE backend will determine the data to be updated based on event name and event ID.
304
+
305
+ ```
306
+ // Example: report updatable event, assuming event name is UPDATABLE_EVENT
307
+ // After reporting, event property status is 3, price is 100
308
+ TDAnalytics.trackUpdate({
309
+ eventName: "UPDATABLE_EVENT",
310
+ properties: { status: 3, price: 100 },
311
+ eventId: "test_event_id"
312
+ });
313
+
314
+ // After reporting, event property status is updated to 5, price remains unchanged
315
+ TDAnalytics.trackUpdate({
316
+ eventName: "UPDATABLE_EVENT",
317
+ properties: { status: 5 },
318
+ eventId: "test_event_id"
319
+ });
320
+ ```
321
+
322
+ #### 2.4 Overwritable Events
323
+
324
+ Overwritable events are similar to updatable events, the difference is that overwritable events will completely overwrite previous data with the latest data. From the effect, it's equivalent to deleting the previous data and storing the latest data. TE backend will determine the data to be updated based on event name and event ID.
325
+
326
+ ```
327
+ // Example: report overwritable event, assuming event name is OVERWRITE_EVENT
328
+ // After reporting, event property status is 3, price is 100
329
+ TDAnalytics.trackOverwrite({
330
+ eventName: "OVERWRITE_EVENT",
331
+ properties: { status: 3, price: 100 },
332
+ eventId: "test_event_id"
333
+ });
334
+
335
+ // After reporting, event property status is updated to 5, price property is deleted
336
+ TDAnalytics.trackOverwrite({
337
+ eventName: "OVERWRITE_EVENT",
338
+ properties: { status: 5 },
339
+ eventId: "test_event_id"
340
+ });
341
+ ```
342
+
343
+ #### 2.5 Common Event Properties
344
+
345
+ For some important properties, such as user's device ID, source channel, user status, etc., these properties need to be set in every event. In this case, you can set these properties as common properties, i.e. properties that every event will have. We recommend you set common properties before sending events.
346
+
347
+ Common properties include two types: event common properties and dynamic common properties. When event is reported, common properties will be inserted into data's properties. If common property conflicts with custom property set in event with same key value, property will be judged according to the following priority: `custom property>dynamic common event property>static common event property>preset property`.
348
+
349
+ ##### 2.5.1 Static Common Event Properties
350
+
351
+ 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 common event properties. Static common event properties will take effect globally. When caching is enabled (default enabled), static common properties will be cached and will still take effect on next startup.
352
+
353
+ Static common property parameter is a JSON object, its format requirements are consistent with event properties.
354
+
355
+ ```
356
+ // Set common event properties, all data events will have these properties
357
+ TDAnalytics.setSuperProperties({
358
+ channel: "Channel Name",
359
+ user_name: "Username"
360
+ });
361
+ ```
362
+
363
+ Besides property setting, we also provide other APIs to operate static common event properties to meet daily business needs.
364
+
365
+ ```
366
+ // Get static common event properties
367
+ var superProperties = TDAnalytics.getSuperProperties();
368
+ // Clear a static common event property, for example clear previously set 'channel' property, subsequent data will not have this property
369
+ TDAnalytics.unsetSuperProperty("channel");
370
+ // Clear all static common event properties
371
+ TDAnalytics.clearSuperProperties();
372
+ ```
373
+
374
+ ##### 2.5.2 Dynamic Common Event Properties
375
+
376
+ Set dynamic common property callback function via `setDynamicSuperProperties`, SDK will trigger callback function when event is reported and add returned JSON object to event properties. `setDynamicSuperProperties` parameter is a function, the function needs to return a JSON object.
377
+
378
+ ```
379
+ // Set dynamic common properties, trigger callback function when event is reported, and add returned JSON object to event properties
380
+ TDAnalytics.setDynamicSuperProperties(function() {
381
+ var d = new Date();
382
+ d.setHours(10);
383
+ return { date: d };
384
+ });
385
+ ```
386
+
387
+ #### 2.6 Recording Event Duration
388
+
389
+ 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 the event, `#duration` property will be automatically added to your event properties to represent the recorded duration, in seconds. Note that the same event name can only have one timing task.
390
+
391
+ ```
392
+ //The following example completes the statistics of user staying time on a product page
393
+ TDAnalytics.timeEvent({
394
+ eventName: "stay_shop"
395
+ });
396
+ /**do someting
397
+ .......
398
+ **/
399
+ //User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
400
+ TDAnalytics.track("stay_shop",{product_name:"product name"});
401
+ ```
402
+
403
+ ### 3. User Properties
404
+
405
+ TE platform supports the following user property setting APIs: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDel`, `userAppend`, `userUniqAppend`.
406
+
407
+ #### 3.1 userSet
408
+
409
+ For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
410
+
411
+ ```
412
+ // username is TA
413
+ TDAnalytics.userSet({
414
+ properties: {
415
+ username: "TA"
416
+ }
417
+ });
418
+ //username is TE
419
+ TDAnalytics.userSet({
420
+ properties: {
421
+ username: "TE"
422
+ }
423
+ });
424
+ ```
425
+
426
+ #### 3.2 userSetOnce
427
+
428
+ If you want to upload a user property that only needs to be set once, you can call `userSetOnce` to set it. When the property already has a value, this information will be ignored. Here is an example of setting first payment time:
429
+
430
+ ```
431
+ //first_payment_time is 2018-01-01 01:23:45.678
432
+ TDAnalytics.userSetOnce({
433
+ properties: {
434
+ first_payment_time: "2018-01-01 01:23:45.678"
435
+ }
436
+ });
437
+ //first_payment_time remains 2018-01-01 01:23:45.678
438
+ TDAnalytics.userSetOnce({
439
+ properties: {
440
+ first_payment_time: "2018-12-31 01:23:45.678"
441
+ }
442
+ });
443
+ ```
444
+
445
+ #### 3.3 userAdd
446
+
447
+ When you want to upload numeric properties, you can call `userAdd` to perform cumulative operations on the property. If the property has not been set, it will be assigned 0 before calculation. Negative values can be passed, equivalent to subtraction operation.
448
+
449
+ ```
450
+ //total_revenue is 30
451
+ TDAnalytics.userAdd({
452
+ properties: {
453
+ total_revenue: 30
454
+ }
455
+ });
456
+ //total_revenue is 678
457
+ TDAnalytics.userAdd({
458
+ properties: {
459
+ total_revenue: 648
460
+ }
461
+ });
462
+ ```
463
+
464
+ #### 3.4 userUnset
465
+
466
+ When you want to clear a user's user property value, you can call `userUnset` to clear the specified property. If the property has not been created in the cluster, `userUnset` will **not** create the property.
467
+
468
+ ```
469
+ // Clear the user's user property value named userPropertykey, i.e. set to NULL
470
+ TDAnalytics.userUnset({
471
+ property: "userPropertykey"
472
+ });
473
+ ```
474
+
475
+ #### 3.5 userDelete
476
+
477
+ If you want to delete a user, you can call `userDelete` to delete the 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.
478
+
479
+ ```
480
+ TDAnalytics.userDelete();
481
+ ```
482
+
483
+ #### 3.6 userAppend
484
+
485
+ You can call `userAppend` to append elements to Array type user data.
486
+
487
+ ```
488
+ TDAnalytics.userAppend({
489
+ properties: {
490
+ user_list: ["apple", "ball"]
491
+ }
492
+ });
493
+ ```
494
+
495
+ #### 3.7 userUniqAppend
496
+
497
+ 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.
498
+
499
+ ```
500
+ //user_list property value is ["apple", "ball"]
501
+ TDAnalytics.userAppend({
502
+ properties: {
503
+ user_list: ["apple", "ball"]
504
+ }
505
+ });
506
+ //user_list property value is ["apple","apple","ball","cube"]
507
+ TDAnalytics.userAppend({
508
+ properties: {
509
+ user_list: ["apple", "cube"]
510
+ }
511
+ });
512
+ //user_list property value is ["apple", "ball","cube"]
513
+ TDAnalytics.userUniqAppend({
514
+ properties: {
515
+ user_list: ["apple", "cube"]
516
+ }
517
+ });
518
+ ```
519
+
520
+ ### 4. Encryption Feature
521
+
522
+ SDK supports encryption feature. Client supports AES + RSA to encrypt data, then server decrypts the data. Encryption and decryption capabilities need to be coordinated between client and server. Please consult customer success personnel for details.
523
+
524
+ Set `enableEncrypt` property to true, and set default version number and public key.
525
+
526
+ ```
527
+ var config = {
528
+ appId: "YOUR_APP_ID", // Project APP ID
529
+ serverUrl: "YOUR_SERVER_URL", // Reporting address
530
+ enableEncrypt: true, // Enable data transmission encryption
531
+ secretKey: {
532
+ publicKey:'YOUR_PUBLIC_KEY', // Encryption public key
533
+ version:0 // Key version number
534
+ }
535
+ };
536
+ // Initialize
537
+ TDAnalytics.init(config);
538
+ ```
539
+
540
+ ### 5. Other Features
541
+
542
+ #### 5.1 Getting Device ID
543
+
544
+ You can call `getDeviceId()` to get device ID.
545
+
546
+ ```
547
+ var deviceId = TDAnalytics.getDeviceId();
548
+ ```
549
+
550
+ <!-- unsupported block: 34 -->
551
+
552
+ **Device ID will be saved in cache, user clears cache, device ID will be reset.**
553
+
554
+ #### 5.2 onCompelete Callback Function
555
+
556
+ ::: tip Tip
557
+
558
+ This callback function is invalid for Android and iOS platforms.
559
+
560
+ :::
561
+
562
+ For `track, userSet, userSetOnce, userAdd, userDel` etc. interfaces, supports passing onComplete callback. Can directly pass onComplete after original parameter list, or use parameter object way. If using parameter object, parameter object must include onComplete, otherwise parameter error will occur. Using uploading event as example:
563
+
564
+ ```
565
+ TDAnalytics.track({
566
+ eventName: "test", // Required
567
+ properties: { testkey: 123 }, // Optional
568
+ time: new Date(),
569
+ onComplete: res => {
570
+ console.log(res);
571
+ }
572
+ });
573
+ ```
574
+
575
+ onComplete's parameter res is object type, has two properties code and msg.
576
+
577
+ res.code is int type, defined as:
578
+
579
+ - 0: Success
580
+ - -1: Data format incorrect
581
+ - -2: APP ID invalid
582
+ - -3: Network or server exception
583
+ Debug mode defined as:
584
+
585
+ - 0: Success
586
+ - -1: Parameter or permission verification issue
587
+ - 1: Indicates field basic error, will give detailed error field and reason
588
+ - 2: Indicates entire error
589
+ - -3: Network or server exception
590
+ res.msg is text explanation of res.code.
591
+
592
+ #### 5.3 Setting Event Cache Reporting
593
+
594
+ You can configure to enable event cache reporting when initializing.
595
+
596
+ ```
597
+ // TE SDK configuration object
598
+ var config = {
599
+ appId: "YOU-APP-ID", // Project APP ID
600
+ serverUrl: "https://youserverurl.com", // Data reporting address
601
+ enableBatch: true, // Whether to enable event cache batch reporting, true=enable, false=disable
602
+ batchConfig: {
603
+ size: 5, // Event cache reporting count
604
+ interval: 5000 // Event cache reporting interval (milliseconds)
605
+ }
606
+ };
607
+ // Initialize
608
+ TDAnalytics.init(config);
609
+ ```
610
+
611
+ ---
612
+
613
+ # Native Support
614
+
615
+ ### 1. iOS Native Support
616
+
617
+ #### 1.1 Build iOS Project
618
+
619
+ - Create new iOS project
620
+ - Open `HBuilderX` - `Publish` - `Generate App Package Resources`
621
+ - Copy local package App resources to project directory's `Pandora -> apps` path
622
+
623
+ #### **1.2 Configure iOS Project**
624
+
625
+ - Add iOS project dependency files
626
+ Use CocoaPods to install SDK
627
+
628
+ Create and edit Podfile content (if exists, edit directly):
629
+
630
+ Create Podfile, execute command in command line under project (.xcodeproj) file directory:
631
+
632
+ ```
633
+ pod init
634
+ ```
635
+
636
+ Edit Podfile content as follows:
637
+
638
+ ```
639
+ pod 'TAGameEngine'
640
+ ```
641
+
642
+ Execute installation command
643
+
644
+ ```
645
+ pod install
646
+ ```
647
+
648
+ ### 2. Android Native Support
649
+
650
+ #### 1.1 Build Android Project
651
+
652
+ - Create new Android project
653
+ - Open `HBuilderX` - `Publish` - `Generate App Package Resources`
654
+ - Copy app resources to project assets->apps
655
+
656
+ #### **2.2 Configure Android Project**
657
+
658
+ - Add the following configuration dependencies in `Project` level `build.gradle` file
659
+
660
+ ```
661
+ buildscript {
662
+ repositories {
663
+ jcenter()
664
+ mavenCentral()
665
+ }
666
+ }
667
+ ```
668
+
669
+ - Add dependencies in `Module` project directory's `build.gradle` file:
670
+
671
+ ```
672
+ implementation 'cn.thinkingdata.android:TAGameEngine:1.2.0'
673
+ implementation 'cn.thinkingdata.android:ThinkingAnalyticsSDK:3.0.0.1'
674
+ ```
675
+
676
+ ### 3. Enable Native Support
677
+
678
+ When initializing SDK, add `enableNative: true` in `config` to enable Native support.
679
+
680
+ ```
681
+ // TA SDK configuration object
682
+ var config = {
683
+ appId: "YOUR_APPID", // Project APP ID
684
+ serverUrl: "YOUR_SERVER_URL", // Reporting address
685
+ enableNative: true, // Allow calling Native code
686
+ autoTrack: {
687
+ appLaunch: true, // Auto-track ta_mp_launch
688
+ appShow: true, // Auto-track ta_mp_show
689
+ appHide: true, // Auto-track ta_mp_hide
690
+ appInstall:true,//Auto-track install event (only valid for native)
691
+ appCrash: true, // Auto-track crash event (only valid for native)
692
+ }
693
+ };
694
+ // Initialize
695
+ TDAnalytics.init(config);
696
+ // Report a simple event, event name is test_event
697
+ //Send event
698
+ TDAnalytics.track({
699
+ eventName: "product_buy", // Event name
700
+ properties: {
701
+ product_name: "product name"
702
+ } //Event properties
703
+ );
704
+ ```
705
+
706
+ ---
707
+
708
+ # Multi-instance
709
+
710
+ This SDK supports multi-instance. We call the instance initialized through the method described above as main instance, and instance created through the method described in this section as sub-instance.
711
+
712
+ Multiple instances share device-related preset properties (including device ID), other properties are not shared, including:
713
+
714
+ - `#distinct_id` visitor ID
715
+ - `#account_id` account ID
716
+ - Common event properties, dynamic common properties
717
+ - `timeEvent` monitored events
718
+ You can create sub-instance to report data to another project, or report data with another set of user ID.
719
+
720
+ ```
721
+ //Initialization configuration 1
722
+ var config_1 = {
723
+ appId: "app-id-1",
724
+ serverUrl: "https://youserverurl.1.com"
725
+ };
726
+ TDAnalytics.init(config_1);
727
+
728
+ //Initialization configuration 2
729
+ var config_2 = {
730
+ appId: "app-id-2",
731
+ serverUrl: "https://youserverurl.2.com"
732
+ };
733
+ TDAnalytics.init(config_2);
734
+
735
+ //Report event to configuration 1 (no app-id, default report to configuration 1)
736
+ TDAnalytics.track({
737
+ eventName: 'event_from_appid_1'
738
+ });
739
+ //Report event to configuration 1 (specify app-id-1)
740
+ TDAnalytics.track({
741
+ eventName: 'event_from_appid_1'
742
+ }, 'app-id-1');
743
+ //Report event to configuration 2 (specify app-id-2)
744
+ TDAnalytics.track({
745
+ eventName: 'event_from_appid_2'
746
+ }, 'app-id-2');
747
+ ```
748
+
749
+ ---
750
+
751
+ # Real-time Debugging
752
+
753
+ During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
754
+
755
+ ### 1. Printing SDK Logs
756
+
757
+ You can set enableLog to true during SDK initialization to enable SDK log switch. After enabling, reported data will be printed in browser console.
758
+
759
+ ```
760
+ var config = {
761
+ appId: "xxx",
762
+ serverUrl: "xxx",
763
+ enableLog:true
764
+ };
765
+ ```
766
+
767
+ ### 2. Enabling Debug Mode
768
+
769
+ Enabling Debug mode requires two steps:
770
+
771
+ 1. Enable Debug mode on client
772
+ Here is sample code for enabling Debug mode on client:
773
+
774
+ ```
775
+ /*
776
+ Set running mode to Debug mode
777
+ none: data will be cached and uploaded according to certain caching strategy, default is NORMAL mode; recommended for production environment
778
+ debug: data is uploaded one by one. When problems occur, it will alert users via logs and exceptions; not recommended for production environment
779
+ debugOnly: only validate data, will not store; not recommended for production environment
780
+ */
781
+ var config = {
782
+ appid: "YOUR_APPID",
783
+ server_url: "YOUR_SERVER_URL",
784
+ debugMode: "debug"
785
+ };
786
+ TDAnalytics.init(config);
787
+ ```
788
+
789
+ 2. Add Debug device in TE backend
790
+ To avoid Debug mode going live in production environment, only specified devices can enable Debug mode. Debug mode can only be enabled when Debug mode is enabled on client and device ID is configured in TE backend's "Tracking Management" page's "Debug Data" section.
791
+
792
+ Device ID can be obtained through three ways:
793
+
794
+ - #device_id property in event data on TE platform
795
+ - Client log: Device DeviceId will be printed after SDK initialization completes
796
+ - Instance interface call: Get Device ID
797
+ <!-- unsupported block: 34 -->
798
+
799
+ Debug mode may affect data collection quality and App stability, only use for integration stage data verification, do not use in production environment.
800
+
801
+ ---
802
+
803
+ # Auto-tracking
804
+
805
+ We provide auto-tracking feature. Just enable the events you need to auto-track in config when creating instance, SDK will automatically track mini program's behaviors. Currently the following events support auto-tracking:
806
+
807
+ Currently supported auto-tracking data:
808
+
809
+ 1. Mini program initialization, user session only triggers once
810
+ 1. Mini program start, including start and from background to foreground
811
+ 1. Mini program enters background, and records this session's time (from start to entering background)
812
+ Next will introduce each data collection method in detail
813
+
814
+ ### 1. Enable Auto-tracking Events
815
+
816
+ In config, parameter `autoTrack` elements represent each auto-tracking event switch. Set to `true` to enable auto-tracking:
817
+
818
+ ```
819
+ var config = {
820
+ appid: "YOU-APP-ID",
821
+ server_url: "https://youserverurl.com",
822
+ autoTrack: {
823
+ appLaunch: true, // Auto-track ta_mp_launch
824
+ appShow: true, // Auto-track ta_mp_show
825
+ appHide: true, // Auto-track ta_mp_hide
826
+ }
827
+ };
828
+ ```
829
+
830
+ - `appLaunch`: Auto-track mini program initialization
831
+ - `appShow`: Auto-track mini program start, or from background to foreground
832
+ - `appHide`: Auto-track mini program from foreground to background
833
+
834
+ ### 2. Auto-tracking Events Details
835
+
836
+ #### 2.1 Mini Program Initialization
837
+
838
+ Mini program initialization will be triggered when mini program is first opened, or user kills process and reopens. Within process lifecycle, only triggers once. Detailed event introduction:
839
+
840
+ - Event name: ta_mp_launch
841
+ - Auto-tracking properties:
842
+ - `#scene`, scene value, taken from WeChat provided scene value
843
+ Through mini program initialization event, you can calculate daily user usage count, average usage count per user, including grouping by scene value, viewing different scene values' user usage.
844
+
845
+ #### 2.2 Mini Program Start
846
+
847
+ Mini program start will be triggered when mini program is started, or mini program is brought back from background to foreground. Detailed event introduction:
848
+
849
+ - Event name: ta_mp_show
850
+ - Auto-tracking properties:
851
+ - `#scene`, scene value, taken from WeChat provided scene value
852
+ - `#url_path`, page path, mini program start displayed page path
853
+ Mini program start is affected by foreground/background switching (more records), so it's not suitable for direct analysis. But can mark user's session in behavior path, can be used as user behavior path's initial behavior
854
+
855
+ #### 2.3 Mini Program Hide
856
+
857
+ Mini program hide will be triggered when mini program enters background, and records this session's duration. Detailed event introduction:
858
+
859
+ - Event name: ta_mp_hide
860
+ - Auto-tracking properties:
861
+ - `#scene`, scene value, taken from WeChat provided scene value
862
+ - `#duration`, numeric type, indicates this session's (ta_mp_show) duration until hide
863
+ Mini program hide event records usage duration (in seconds), so you can directly calculate user total usage time and average time, can also divide by initialization count to calculate single usage duration.
864
+
865
+ ---
866
+
867
+ # Preset Properties
868
+
869
+ ### 1. Preset Properties for All Events
870
+
871
+ The following preset properties are preset properties that all events in uni-app mini program platform will have (including auto-tracking events)
872
+
873
+ **Property Name**
874
+
875
+ **Chinese Name**
876
+
877
+ **Property Type**
878
+
879
+ **Description**
880
+
881
+ #ip
882
+
883
+ IP Address
884
+
885
+ Text
886
+
887
+ User's IP address, TE will use this to get user's geographic location information
888
+
889
+ #country
890
+
891
+ Country
892
+
893
+ Text
894
+
895
+ User's country, generated from IP address
896
+
897
+ #country_code
898
+
899
+ Country Code
900
+
901
+ Text
902
+
903
+ User's country code (ISO 3166-1 alpha-2, i.e. two uppercase English letters), generated from IP address
904
+
905
+ #province
906
+
907
+ Province
908
+
909
+ Text
910
+
911
+ User's province, generated from IP address
912
+
913
+ #city
914
+
915
+ City
916
+
917
+ Text
918
+
919
+ User's city, generated from IP address
920
+
921
+ #device_model
922
+
923
+ Device Model
924
+
925
+ Text
926
+
927
+ User's device model, such as iPhone 8 etc.
928
+
929
+ #device_id
930
+
931
+ Device ID
932
+
933
+ Text
934
+
935
+ User's device ID, taken from UUID generated at initialization
936
+
937
+ #screen_height
938
+
939
+ Screen Height
940
+
941
+ Number
942
+
943
+ User's device screen height, such as 1920 etc.
944
+
945
+ #screen_width
946
+
947
+ Screen Width
948
+
949
+ Number
950
+
951
+ User's device screen height, such as 1080 etc.
952
+
953
+ #manufacturer
954
+
955
+ Device Manufacturer
956
+
957
+ Text
958
+
959
+ User's device manufacturer, such as Apple, vivo etc.
960
+
961
+ #os_version
962
+
963
+ OS Version
964
+
965
+ Text
966
+
967
+ iOS 11.2.2, Android 8.0.0 etc.
968
+
969
+ #os
970
+
971
+ OS
972
+
973
+ Text
974
+
975
+ Such as Android, iOS etc.
976
+
977
+ #network_type
978
+
979
+ Network Status
980
+
981
+ Text
982
+
983
+ Network status when uploading event, such as WIFI, 3G, 4G etc.
984
+
985
+ #lib
986
+
987
+ SDK Type
988
+
989
+ Text
990
+
991
+ SDK type you integrated, such as MP (Mini Program), MG (Mini Game) etc.
992
+
993
+ #lib_version
994
+
995
+ SDK Version
996
+
997
+ Text
998
+
999
+ SDK version you integrated
1000
+
1001
+ #scene
1002
+
1003
+ Scene Value
1004
+
1005
+ Number
1006
+
1007
+ Scene value passed when WeChat mini program starts
1008
+
1009
+ #mp_platform
1010
+
1011
+ Mini Program Platform
1012
+
1013
+ Text
1014
+
1015
+ Identifies application's platform
1016
+
1017
+ #zone_offset
1018
+
1019
+ Timezone Offset
1020
+
1021
+ Number
1022
+
1023
+ Data time offset hours relative to UTC time
1024
+
1025
+ #system_language
1026
+
1027
+ System Language
1028
+
1029
+ Text
1030
+
1031
+ User's device system language (ISO 639-1, i.e. two lowercase English letters), such as zh, en etc.
1032
+
1033
+ ### 2. Preset Properties for Auto-tracking Events
1034
+
1035
+ The following preset properties are unique preset properties in each auto-tracking event
1036
+
1037
+ - Mini program start (ta_mp_show) preset properties
1038
+ **Property Name**
1039
+
1040
+ **Chinese Name**
1041
+
1042
+ **Property Type**
1043
+
1044
+ **Description**
1045
+
1046
+ #url_path
1047
+
1048
+ Page Path
1049
+
1050
+ Text
1051
+
1052
+ Mini program start displayed page path
1053
+
1054
+ - Mini program hide (ta_mp_hide) preset properties
1055
+ **Property Name**
1056
+
1057
+ **Chinese Name**
1058
+
1059
+ **Property Type**
1060
+
1061
+ **Description**
1062
+
1063
+ #duration
1064
+
1065
+ Event Duration
1066
+
1067
+ Number
1068
+
1069
+ Indicates this session `ta_mp_show` to hide `ta_mp_hide` duration, unit is seconds
1070
+
1071
+ ### 3. Getting Preset Properties
1072
+
1073
+ When server-side tracking needs some preset properties from App side, you can use this method to get client side preset properties and then pass to server.
1074
+
1075
+ ```
1076
+ //Get property object
1077
+ var presetProperties=TDAnalytics.getPresetProperties();
1078
+ //Generate event preset properties
1079
+ var properties=presetProperties.toEventPresetProperties();
1080
+ /*
1081
+ {
1082
+ "#device_model":"iPhone 5",
1083
+ "#device_id":"3204487163-1624513721217",
1084
+ "#screen_width":320,
1085
+ "#screen_height":568,
1086
+ "#os":"iOS",
1087
+ "#os_version":"10.0.1",
1088
+ "#network_type":"wifi",
1089
+ "#zone_offset":8,
1090
+ "#manufacturer":"Apple"
1091
+ }
1092
+ */
1093
+ //Get a specific preset property
1094
+ var os=presetProperties.os;//os type, such as Android
1095
+ var osVersion=presetProperties.osVersion;//system version number
1096
+ var networkType=presetProperties.networkType;//network type
1097
+ var manufacture=presetProperties.manufacture;//device manufacturer
1098
+ var deviceModel=presetProperties.deviceModel;//device model
1099
+ var screenWidth=presetProperties.screenWidth;//screen width
1100
+ var screenHeight=presetProperties.screenHeight;//screen height
1101
+ var deviceId=presetProperties.deviceId;//device ID
1102
+ var zoneOffset=presetProperties.zoneOffset;//timezone offset value
1103
+ ```
1104
+
1105
+ <!-- unsupported block: 34 -->
1106
+
1107
+ IP, country and city information are generated from server-side parsing, client does not provide interface to get these properties