@thinkingai/ae-cli 6.0.60 → 6.0.62

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 (221) hide show
  1. package/README.md +6 -1
  2. package/README.zh.md +8 -1
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-X5GL44JT.js} +10 -9
  5. package/dist/ai-monitor.js +14 -13
  6. package/dist/{auth-ATK2SLEV.js → auth-SPQ46XQ3.js} +18 -10
  7. package/dist/{automation-FLCPFMN4.js → automation-7XC3VBZI.js} +87 -12
  8. package/dist/{capability-6KTSOI7L.js → capability-JZP4KXZC.js} +10 -9
  9. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  10. package/dist/{chunk-VRMGHQKE.js → chunk-2VKMHNUU.js} +11 -11
  11. package/dist/{chunk-2ETRY2CU.js → chunk-6HOM2FOJ.js} +19 -9
  12. package/dist/{chunk-KTJXD27G.js → chunk-AAN6KBUK.js} +3 -3
  13. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  14. package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
  15. package/dist/{chunk-BEYLCUZX.js → chunk-E457FREE.js} +3 -3
  16. package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
  17. package/dist/{chunk-5M5LBRR3.js → chunk-ETQXIZFP.js} +15 -8
  18. package/dist/{chunk-72NJKS7O.js → chunk-F36ORPI6.js} +7 -32
  19. package/dist/{chunk-5E7MTTFN.js → chunk-F7TCQPQX.js} +23 -9
  20. package/dist/{chunk-AXTO4FTM.js → chunk-FGGEF7MI.js} +3 -3
  21. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  22. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  23. package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
  24. package/dist/chunk-N2MAYIRU.js +32 -0
  25. package/dist/chunk-NNK3JBH4.js +60 -0
  26. package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
  27. package/dist/{chunk-HSZAIPUX.js → chunk-PRCHMOWT.js} +7 -5
  28. package/dist/chunk-PUSFEC6B.js +29 -0
  29. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  30. package/dist/{chunk-SDKW6LYE.js → chunk-RYY5NJK3.js} +3 -3
  31. package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
  32. package/dist/{chunk-VJUXKVRE.js → chunk-VR2D54AA.js} +2 -2
  33. package/dist/{chunk-HVMCPKOZ.js → chunk-YIG3L4RC.js} +1 -1
  34. package/dist/{chunk-LOR4IA26.js → chunk-YJYC5PLL.js} +166 -188
  35. package/dist/{chunk-F2VFZUGG.js → chunk-ZVUXAHEV.js} +2 -2
  36. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  37. package/dist/{compat-check-XD2U7PZ2.js → compat-check-JD5D77ET.js} +5 -4
  38. package/dist/{config-U3GDWU6E.js → config-IIMRATTP.js} +7 -6
  39. package/dist/{context-YAQG6YQC.js → context-BXHIPIIX.js} +8 -6
  40. package/dist/{data-integration-QE37EQ3A.js → data-integration-VRJQ3HVK.js} +7 -6
  41. package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
  42. package/dist/index.js +49 -43
  43. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  44. package/dist/{memory-WEB27VI6.js → memory-B44LY27L.js} +6 -7
  45. package/dist/{metadata-7FYE4234.js → metadata-ZVPG2MIA.js} +10 -9
  46. package/dist/{model-T7H7Q6BG.js → model-ANZBYVST.js} +4 -5
  47. package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-YNCV4QG3.js} +45 -14
  48. package/dist/{project-semantic-2GGFJWW6.js → project-semantic-E7ZAQL5S.js} +9 -8
  49. package/dist/{sync-ULBB7WO5.js → sync-Y4OZRQAY.js} +9 -9
  50. package/dist/{te-agent-6RMF7LUV.js → te-agent-RKAUTYJZ.js} +303 -17
  51. package/dist/{te-analysis-HSYC7GNV.js → te-analysis-7N5VC4JB.js} +25 -20
  52. package/dist/{te-community-FLKZGQKB.js → te-community-SIA2UHTS.js} +13 -11
  53. package/dist/{te-dataops-OQQGTCUA.js → te-dataops-5MJQCODU.js} +13 -11
  54. package/dist/{te-engage-RIEBHL5T.js → te-engage-ZTLOMKO3.js} +73 -20
  55. package/dist/{te-kb-4HG2FMHJ.js → te-kb-LDL3MF2Y.js} +107 -25
  56. package/dist/{te-system-AL4B4XZL.js → te-system-473I5O53.js} +6 -7
  57. package/dist/{te-team-5O4UVUWE.js → te-team-JOWHCMZA.js} +92 -10
  58. package/dist/{things-TSJ64GBT.js → things-DOQ2L3O2.js} +9 -8
  59. package/dist/{update-Q5LURAWV.js → update-KUS6TCPB.js} +8 -6
  60. package/dist/{workspace-FF2HXJGR.js → workspace-MJFPIV7C.js} +6 -7
  61. package/package.json +6 -3
  62. package/skills/ae-agent/SKILL.md +19 -5
  63. package/skills/ae-agent/references/a2a.md +103 -0
  64. package/skills/ae-agent/references/command_index.md +11 -0
  65. package/skills/ae-analysis/SKILL.md +35 -23
  66. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  67. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  68. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  69. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  70. package/skills/ae-analysis/references/command_index.md +7 -7
  71. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  72. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  73. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  75. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  76. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  77. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  78. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  79. package/skills/ae-analysis/references/scenario_list.md +5 -6
  80. package/skills/ae-automation/SKILL.md +6 -2
  81. package/skills/ae-automation/references/cli.md +9 -3
  82. package/skills/ae-capability/SKILL.md +8 -4
  83. package/skills/ae-engage/SKILL.md +6 -1
  84. package/skills/ae-engage/references/common-metric.md +47 -1
  85. package/skills/ae-engage/references/flow-metric-update.md +1 -1
  86. package/skills/ae-engage/references/task-metric-update.md +1 -1
  87. package/skills/ae-kb/SKILL.md +11 -7
  88. package/skills/ae-kb/references/publication.md +45 -0
  89. package/skills/ae-kb/references/query-workflow.md +5 -1
  90. package/skills/ae-team/SKILL.md +7 -3
  91. package/skills/ae-team/references/copy-to-personal.md +7 -0
  92. package/skills/ae-team/references/promote.md +7 -0
  93. package/skills/ae-team/references/update.md +3 -3
  94. package/dist/chunk-Y74WTIKJ.js +0 -10
  95. package/skills/ae-tracking-matrix/SKILL.md +0 -170
  96. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  97. package/skills/ae-tracking-matrix/i18n.yaml +0 -12
  98. package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
  99. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
  100. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
  101. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
  102. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
  103. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
  104. package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
  105. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
  106. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
  107. package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
  108. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
  109. package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
  110. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
  111. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
  112. package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
  113. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
  114. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
  115. package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
  116. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
  117. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
  118. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
  119. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
  120. package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
  121. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
  122. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
  123. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
  124. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
  125. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
  126. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
  127. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
  128. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
  129. package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
  130. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
  131. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
  132. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
  133. package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
  134. package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
  135. package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
  136. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
  137. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
  138. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
  139. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
  140. package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
  141. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
  142. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
  143. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
  144. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
  145. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
  146. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
  147. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
  148. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
  149. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
  150. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
  151. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
  152. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
  153. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
  154. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
  155. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
  156. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
  157. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
  158. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
  159. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
  160. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
  161. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
  162. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
  163. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
  164. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
  165. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
  166. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
  167. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
  168. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
  169. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
  170. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
  171. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
  172. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
  173. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
  174. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
  175. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
  176. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
  177. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
  178. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
  179. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
  180. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
  181. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
  182. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
  183. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
  184. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
  185. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
  186. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
  187. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
  188. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
  189. package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
  190. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
  191. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
  192. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
  193. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
  194. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
  195. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
  196. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
  197. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
  198. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
  199. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
  200. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
  201. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
  202. package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
  203. package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
  204. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
  205. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
  206. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
  207. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
  208. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
  209. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
  210. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
  211. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
  212. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
  213. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
  214. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
  215. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
  216. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
  217. package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
  218. package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
  219. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
  220. package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
  221. package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
@@ -1,1532 +0,0 @@
1
- ---
2
- code: unity_sdk_installation
3
- name: "Unity"
4
- wikiToken: Vlbrwj9vYijvVIkwaCtcIABFnMf
5
- parentWikiToken: BAU2w0eipiqGnckeUsIc0mYQnZc
6
- updateTime: 1773313260000
7
- sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=unity_sdk_installation
8
- ---
9
-
10
- # Unity
11
-
12
- ::: tip Tip
13
-
14
- Before integration, please read the pre-installation preparation first.
15
-
16
- Unity SDK: Supports iOS, Android, HarmonyOS, Unity Editor, Windows, Mac, WebGL, Switch, Xbox, PS4/5 game terminals. Supports WeChat Mini Game, Douyin Mini Game, OPPO and other mini game platforms.
17
-
18
- Minimum compatible Unity 5.4.0 version, size approximately 320 KB
19
-
20
- :::
21
-
22
- **Latest Version:** v3.4.6
23
-
24
- **Update Time:** 2026-03-12
25
-
26
- **Resource Download: **Source code, SDK Download
27
-
28
- ::: warning Note
29
-
30
- This document applies to v3.0.0 and later versions. For historical versions, please refer to Unity Integration Guide (V2), SDK Download (v2.6.1)
31
-
32
- :::
33
-
34
- ### 1. SDK Integration
35
-
36
- #### 1.1 Manual Integration
37
-
38
- 1. Download Unity SDK resource files
39
- 1. Double click `ta_unity_sdk.unitypackage` file or import via `Assets > Import Package > Custom Package`, import `ta_unity_sdk.unitypackage`
40
- <!-- unsupported block: 19 -->
41
-
42
- When upgrading unitypackage from 3.3.0 to 3.4+.x, need to delete original SDK before importing
43
-
44
- Purpose: Unity/Tuanjie engine export to HarmonyOS platform occasionally has .ts file loss issue. Currently all ts files renamed to .tslib. If not deleting original files, file name duplication issue will occur.
45
-
46
- #### 1.2 Package Manager Integration
47
-
48
- From v2.4.1, supports `Package Manager` automatic SDK integration.
49
-
50
- 1. Open `Window` - `Package Manager` menu
51
- 1. Click `+`, then select `Add package from git URL...`
52
- 1. Enter `https://github.com/ThinkingDataAnalytics/unity-sdk.git`, then click `Add`, wait for loading to complete
53
-
54
- ### 2. Initialization
55
-
56
- Recommend using manual SDK initialization. We also provide prefab automatic initialization method.
57
-
58
- #### 2.1 Manual Initialization
59
-
60
- ```
61
- using ThinkingData.Analytics;
62
- //Initialization method 1
63
- TDAnalytics.Init("APPID","SERVER");
64
- //Initialization method 2
65
- TDConfig config = new TDConfig("APPID","SERVER");
66
- TDAnalytics.Init(config);
67
- ```
68
-
69
- #### 2.2 Automatic Initialization
70
-
71
- ::: tip Tip
72
-
73
- SDK integrated via Package Manager only supports partial configuration. Please refer to actual configuration.
74
-
75
- :::
76
-
77
- 1. Add `TDAnalytics` prefab and set SDK configuration
78
- Configuration in above figure:
79
-
80
- **Configuration**
81
-
82
- - **Start Manually**: Whether to enable manual initialization
83
-
84
- 1. If enabled, need to manually call `TDAnalytics.Init()` to initialize SDK.
85
- 1. If not enabled, SDK will be automatically initialized when `TDAnalytics` prefab loads.
86
-
87
- - **Enable Log**: Whether to enable logs. If enabled, will print reporting status for debugging convenience. You can also verify event reporting correctness in Editor mode. For properties that don't meet requirements, will be displayed as `warning` log in console.
88
-
89
- **Configs**
90
-
91
- Each Config identifies an instance. To report data to multiple projects, click "+" button at bottom right to add project configuration. You can add multiple Token configurations with different APP IDs.
92
-
93
- - **APP ID**: Needs configuration. Your project's APP_ID, given when applying for project, please enter here.
94
- - **SERVER URL**: Needs configuration. Data receiver URL:
95
- - If you are using cloud service, please enter: https://global-receiver-ta.thinkingdata.cn
96
- - If you are using private deployment version, please enter: https://DATA_COLLECTION_ADDRESS
97
- - **MODE**: SDK instance running mode. Production environment must use NORMAL mode.
98
- <!-- unsupported block: 34 -->
99
-
100
- Note: Since some devices disable plaintext transmission by default, strongly recommend using HTTPS format receiver address
101
-
102
- ### 3. Common Features
103
-
104
- 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 reinstalls App or changes device.
105
-
106
- #### 3.1 Setting Account ID
107
-
108
- 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.
109
-
110
- ```
111
- // User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TA
112
- TDAnalytics.Login("TA");
113
- ```
114
-
115
- <!-- unsupported block: 34 -->
116
-
117
- **This method will not upload login event**
118
-
119
- #### 3.2 Setting Common Event Properties
120
-
121
- 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.
122
-
123
- ```
124
- Dictionary<string, object> superProperties = new Dictionary<string, object>();
125
- superProperties["channel"] = "ta";//string
126
- superProperties["age"] = 1;//number
127
- superProperties["isSuccess"] = true;//boolean
128
- superProperties["birthday"] = DateTime.Now;//time
129
- superProperties["object"] = new Dictionary<string, object>(){{ "key", "value"}};//object
130
- superProperties["object_arr"] = new List<object>() {new Dictionary<string, object>(){{ "key", "value" }}};//object array
131
- superProperties["arr"] = new List<object>() { "value" };//array
132
- TDAnalytics.SetSuperProperties(superProperties);//set common event properties
133
- ```
134
-
135
- Common event properties will be saved to cache and don't need to be called every time App starts. If `setSuperProperties:` is called to set a previously set common event property, it will overwrite the previous property.
136
-
137
- - Event property is `Dictionary<string, object>` type, where each element represents a property
138
- - 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
139
- - Value is the property value, supports string, number, boolean, time, object, object array, array
140
- <!-- unsupported block: 34 -->
141
-
142
- **Event property and user property requirements are consistent with common event properties**
143
-
144
- #### 3.3 Enabling Auto-tracking
145
-
146
- Below is sample code to enable install, start, close events. If you want to learn more about SDK auto-tracking capabilities, you can view auto-tracking feature detailed introduction
147
-
148
- <!-- unsupported block: 19 -->
149
-
150
- HarmonyOS platform this feature is temporarily disabled
151
-
152
- ```
153
- //Enable auto-tracking for install, start, close events
154
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
155
- ```
156
-
157
- #### 3.4 Sending Events
158
-
159
- 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
160
-
161
- ```
162
- Dictionary<string, object> properties = new Dictionary<string, object>(){{"product_name", "product name"}};
163
- TDAnalytics.Track("product_buy", properties);
164
- ```
165
-
166
- Event name is string type, must start with a letter, can contain numbers, letters and underscore "\_", maximum 50 characters.
167
-
168
- #### 3.5 Setting User Properties
169
-
170
- 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.
171
-
172
- ```
173
- //username is TA
174
- TDAnalytics.UserSet(new Dictionary<string, object>(){{"user_name", "TA"}});
175
- //username is TE
176
- TDAnalytics.UserSet(new Dictionary<string, object>(){{"user_name", "TE"}});
177
- ```
178
-
179
- ### 4. Best Practices
180
-
181
- The following sample code includes all the above operations. We recommend using the following steps:
182
-
183
- ```
184
- using ThinkingData.Analytics;
185
- if (privacy policy authorized)
186
- { // Initialize SDK
187
- TDAnalytics.Init("APPID", "SERVER");
188
- //Enable auto-tracking events
189
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
190
- //If user is logged in, you can set user's account ID as unique identity
191
- TDAnalytics.Login("TA");
192
- //After setting common event properties, every event will have common event properties
193
- Dictionary<string, object> superProperties = new Dictionary<string, object>();
194
- superProperties["channel"] = "ta";//string
195
- superProperties["age"] = 1;//number
196
- superProperties["isSuccess"] = true;//boolean
197
- superProperties["birthday"] = DateTime.Now;//time
198
- superProperties["object"] = new Dictionary<string, object>(){{ "key", "value"}};//object
199
- superProperties["object_arr"] = new List<object>() {new Dictionary<string, object>(){{ "key", "value" }}};//object array
200
- superProperties["arr"] = new List<object>() { "value" };//array
201
- TDAnalytics.SetSuperProperties(superProperties);//set common event properties
202
- //Send event
203
- Dictionary<string, object> properties = new Dictionary<string, object>(){{"product_name", "product name"}};
204
- TDAnalytics.Track("product_buy", properties);
205
- //Set user properties
206
- TDAnalytics.UserSet(new Dictionary<string, object>(){{"user_name", "TA"}});
207
- }
208
- ```
209
-
210
- ---
211
-
212
- # Advanced Guide
213
-
214
- ### 1. Setting User ID
215
-
216
- SDK instance will use random UUID 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 reinstalls App or changes device.
217
-
218
- #### 1.1 Setting Visitor ID
219
-
220
- ::: tip Tip
221
-
222
- Generally, you don't need to customize visitor ID. Please make sure you understand the user identification rules before setting visitor ID.
223
-
224
- If you need to replace visitor ID, you should call it immediately after SDK initialization is completed. Do not call it multiple times to avoid generating useless accounts
225
-
226
- :::
227
-
228
- If your App has its own visitor ID management system for each user, you can call `SetDistinctId` to set visitor ID:
229
-
230
- ```
231
- // Set visitor ID to Thinker
232
- TDAnalytics.SetDistinctId("Thinker");
233
- ```
234
-
235
- If you need to get the current visitor ID, you can call `GetDistinctId`:
236
-
237
- ```
238
- //Return visitor ID
239
- String distinctId = TDAnalytics.GetDistinctId();
240
- ```
241
-
242
- #### 1.2 Setting Account ID
243
-
244
- 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.
245
-
246
- ```
247
- // User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TA
248
- TDAnalytics.Login("TA");
249
- ```
250
-
251
- <!-- unsupported block: 34 -->
252
-
253
- **This method will not upload login event**
254
-
255
- #### 1.3 Clearing Account ID
256
-
257
- 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.
258
-
259
- ```
260
- TDAnalytics.Logout();
261
- ```
262
-
263
- We recommend you call `Logout` at explicit logout events, such as when user performs account deregistration action, rather than when closing App.
264
-
265
- <!-- unsupported block: 34 -->
266
-
267
- **This method will not upload logout event**
268
-
269
- ### 2. Sending Events
270
-
271
- 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.
272
-
273
- #### 2.1 Regular Events
274
-
275
- 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:
276
-
277
- ```
278
- Dictionary<string, object> properties = new Dictionary<string, object>{
279
- {"product_name", "product name"}
280
- };
281
- TDAnalytics.Track("product_buy", properties);
282
- ```
283
-
284
- #### 2.2 First-time Events
285
-
286
- 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 event that happens first time on a certain device, you can use first-time events to report data.
287
-
288
- ```
289
- Dictionary<string, object> properties = new Dictionary<string, object>() {
290
- { "status", 1}
291
- };
292
- TDFirstEventModel firstEvent = new TDFirstEventModel("first_event");
293
- firstEvent.Properties = properties;
294
- TDAnalytics.Track(firstEvent);
295
- ```
296
-
297
- 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:
298
-
299
- ```
300
- // Set user ID as first_check_id for first-time event, to collect user first-time activation event
301
- Dictionary<string, object> properties = new Dictionary<string, object>() {
302
- { "status", 1}
303
- };
304
- TDFirstEventModel firstEvent = new TDFirstEventModel("first_event", "any-user-id");
305
- firstEvent.Properties = properties;
306
- TDAnalytics.Track(firstEvent);
307
- ```
308
-
309
- <!-- unsupported block: 34 -->
310
-
311
- 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.
312
-
313
- #### 2.3 Updatable Events
314
-
315
- 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.
316
-
317
- ```
318
- // Example: report updatable event, assuming event name is UPDATABLE_EVENT
319
- // After reporting, event property status is 3, price is 100
320
- TDUpdatableEventModel updatableEvent = new TDUpdatableEventModel("UPDATABLE_EVENT", "test_event_id");
321
- updatableEvent.Properties = new Dictionary<string, object>{
322
- {"status", 3},
323
- {"price", 100}
324
- };
325
- TDAnalytics.Track(updatableEvent);
326
-
327
- // After reporting, event property status is updated to 5, price remains unchanged
328
- TDUpdatableEventModel updatableEvent_new = new TDUpdatableEventModel("UPDATABLE_EVENT", "test_event_id");
329
- updatableEvent_new.Properties = new Dictionary<string, object>{
330
- {"status", 5}
331
- };
332
- TDAnalytics.Track(updatableEvent_new);
333
- ```
334
-
335
- #### 2.4 Overwritable Events
336
-
337
- 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.
338
-
339
- ```
340
- // Example: report overwritable event, assuming event name is OVERWRITABLE_EVENT
341
- // After reporting, event property status is 3, price is 100
342
- TDOverwritableEventModel overWritableEvent = new TDOverwritableEventModel("OVERWRITABLE_EVENT", "test_event_id");
343
- overWritableEvent.Properties = new Dictionary<string, object>{
344
- {"status", 3},
345
- {"price", 100}
346
- };
347
- TDAnalytics.Track(overWritableEvent);
348
-
349
- // After reporting, event property status is updated to 5, price property is deleted
350
- TDOverwritableEventModel overWritableEvent_new = new TDOverwritableEventModel("OVERWRITABLE_EVENT", "test_event_id");
351
- overWritableEvent_new.Properties = new Dictionary<string, object>{
352
- {"status", 5}
353
- };
354
- TDAnalytics.Track(overWritableEvent_new);
355
- ```
356
-
357
- #### 2.5 Common Event Properties
358
-
359
- Common event properties refer to properties that every event will upload. Based on property update frequency, common event properties are divided into `static common event properties` and `dynamic common event properties`. You can choose different common event property setting methods according to your specific business scenario requirements; we recommend you set common event properties before sending events. For the same event, when common event property, event custom property, preset property have the same Key, we will assign values according to the following priority: `custom property>dynamic common event property>static common event property>preset property`.
360
-
361
- ##### 2.5.1 Static Common Event Properties
362
-
363
- Static common event properties are low-frequency changing properties that every event will have, such as user membership level. After setting static common event properties via `setSuperProperties`, SDK will get the set common event properties as event properties when collecting events.
364
-
365
- ```
366
- Dictionary<string, object> superProperties = new Dictionary<string, object>() {
367
- {"vip_level", 2}
368
- };
369
- TDAnalytics.SetSuperProperties(superProperties);
370
- ```
371
-
372
- Static common event properties will be saved to cache and don't need to be called every time App starts. If the property already exists, the newly set property will overwrite the original property value; if the property did not exist before, it will create a new property. Besides property setting, we also provide other APIs to operate static common event properties to meet daily business needs.
373
-
374
- ```
375
- // Clear property named CHANNEL common property
376
- TDAnalytics.UnsetSuperProperty("CHANNEL");
377
- // Clear all common properties
378
- TDAnalytics.ClearSuperProperties();
379
- // Get all common properties
380
- TDAnalytics.GetSuperProperties();
381
- ```
382
-
383
- ##### 2.5.2 Dynamic Common Event Properties
384
-
385
- Dynamic common event properties are high-frequency changing properties that every event will have, such as user's coin count. To set dynamic common properties, need to first create dynamic common property class and implement `TDDynamicSuperPropertiesHandler` interface, override `public Dictionary<string, object> GetDynamicSuperProperties()` method. The method's return value is the dynamic common properties to set. Then call `SetDynamicSuperProperties` passing dynamic common property object. Sample as follows:
386
-
387
- ```
388
- // 1.Define dynamic common property implementation, this example sets coin dynamic change
389
- public class DynamicProp : TDDynamicSuperPropertiesHandler
390
- {
391
- int coin = 0;
392
- public Dictionary<string, object> GetDynamicSuperProperties()
393
- {
394
- coin++;
395
- return new Dictionary<string, object>() {
396
- {"coin",coin}
397
- };
398
- }
399
- }
400
- // 2.Set dynamic common properties
401
- TDAnalytics.SetDynamicSuperProperties(new DynamicProp());
402
- ```
403
-
404
- #### 2.6 Recording Event Duration
405
-
406
- 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.
407
-
408
- ```
409
- //The following example completes the statistics of user staying time on a product page
410
- //User enters product page, start timing
411
- TDAnalytics.TimeEvent("stay_shop");
412
- /**do someting
413
- .......
414
- **/
415
- //User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
416
- TDAnalytics.Track("stay_shop");
417
- ```
418
-
419
- ### 3. User Properties
420
-
421
- TE platform supports the following user property setting APIs: `UserSet`, `UserSetOnce`, `UserAdd`, `UserUnset`, `UserDelete`, `UserAppend`, `UserUniqAppend`.
422
-
423
- #### 3.1 UserSet
424
-
425
- 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.
426
-
427
- ```
428
- //username is TA
429
- TDAnalytics.UserSet(new Dictionary<string, object(){
430
- {"user_name", "TA"}
431
- });
432
- //username is TE
433
- TDAnalytics.UserSet(new Dictionary<string, object(){
434
- {"user_name", "TE"}
435
- });
436
- ```
437
-
438
- #### 3.2 UserSetOnce
439
-
440
- 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:
441
-
442
- ```
443
- //first_payment_time is 2018-01-01 01:23:45.678
444
- TDAnalytics.UserSetOnce(new Dictionary<string, object(){
445
- {"first_payment_time","2018-01-01 01:23:45.678"}
446
- });
447
- //first_payment_time remains 2018-01-01 01:23:45.678
448
- TDAnalytics.UserSetOnce(new Dictionary<string, object(){
449
- {"first_payment_time","2018-12-31 01:23:45.678"}
450
- });
451
- ```
452
-
453
- #### 3.3 UserAdd
454
-
455
- 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.
456
-
457
- ```
458
- //total_revenue is 30
459
- TDAnalytics.UserAdd(new Dictionary<string, object(){
460
- {"total_revenue",30}
461
- });
462
- //total_revenue is 678
463
- TDAnalytics.UserAdd(new Dictionary<string, object(){
464
- {"total_revenue",648}
465
- })
466
- ```
467
-
468
- <!-- unsupported block: 34 -->
469
-
470
- The property key must be a string, and Value must be a number.
471
-
472
- #### 3.4 UserUnset
473
-
474
- If you need to reset a user's property, you can call `UserUnset` to clear the specified user property value. This interface supports passing string or list type parameters:
475
-
476
- ```
477
- // Delete single user property
478
- TDAnalytics.UserUnset("userPropertyName");
479
- // Delete multiple user properties
480
- List<string> listProps = new List<string>();
481
- listProps.Add("aaa");
482
- listProps.Add("bbb");
483
- listProps.Add("ccc");
484
-
485
- TDAnalytics.UserUnset(listProps);
486
- ```
487
-
488
- <!-- unsupported block: 34 -->
489
-
490
- UserUnset: The passed value is the Key of the property to be cleared.
491
-
492
- #### 3.5 UserDelete
493
-
494
- 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.
495
-
496
- ```
497
- TDAnalytics.UserDelete();
498
- ```
499
-
500
- #### 3.6 UserAppend
501
-
502
- From v1.4.0, you can call `UserAppend` to append elements to `List` type user properties:
503
-
504
- ```
505
- List<string> stringList = new List<string>();
506
- stringList.Add("apple");
507
- stringList.Add("ball");
508
- // Append 3 elements to user property named user_list
509
- TDAnalytics.UserAppend(new Dictionary<string, object{
510
- {"user_list", stringList }
511
- });
512
- ```
513
-
514
- #### 3.7 UserUniqAppend
515
-
516
- From v2.4.0, you can call `UserUniqAppend` to **deduplicate and append** elements to `List` type user properties. Calling `UserUniqAppend` interface will deduplicate the appended user properties, `UserAppend` interface does not deduplicate, user properties can have duplicates.
517
-
518
- ```
519
- //user_list property value is ["apple", "ball"]
520
- List<string> stringList = new List<string>();
521
- stringList.Add("apple");
522
- stringList.Add("ball");
523
- TDAnalytics.UserAppend(new Dictionary<string, object{
524
- {"user_list", stringList}
525
- });
526
-
527
- List<string> stringList1 = new List<string>();
528
- stringList1.Add("apple");
529
- stringList1.Add("cube");
530
- //user_list property value is ["apple","apple","ball","cube"]
531
- TDAnalytics.UserAppend(new Dictionary<string, object{
532
- {"user_list", stringList1}
533
- });
534
- //user_list property value is ["apple","ball","cube"]
535
- TDAnalytics.UserUniqAppend(new Dictionary<string, object{
536
- {"user_list", stringList1}
537
- });
538
- ```
539
-
540
- ### 4. Encryption Feature
541
-
542
- From v2.4.0, SDK supports AES+RSA data encryption. Data encryption feature needs to be coordinated between client and server. Please consult customer success personnel for specific usage methods.
543
-
544
- Set `TDConfig` object's `enableEncrypt` property to `true` respectively, and set default version number and public key.
545
-
546
- ```
547
- TDConfig tdConfig = new TDConfig(appId, serverUrl);
548
- // Enable encryption transmission (only supports iOS/Android), set default version number, public key
549
- tdConfig.EnableEncrypt("YOUR_ENCRYPT_PUBLIC_KEY", 1);
550
- TDAnalytics.Init(tdConfig);
551
- ```
552
-
553
- ### 5. Other Features
554
-
555
- #### 5.1 Getting Device ID
556
-
557
- You can call `GetDeviceId` to get device ID:
558
-
559
- ```
560
- TDAnalytics.GetDeviceId();
561
- // Use device ID as visitor ID
562
- // TDAnalytics.SetDistinctId(TDAnalytics.GetDeviceId());
563
- ```
564
-
565
- #### 5.2 Setting Default Timezone
566
-
567
- By default, SDK will use local time when interface is called as event occurrence time for reporting. You can also set default timezone interface to specify default timezone, so all events will align event time according to your set timezone:
568
-
569
- ```
570
- TDConfig tdConfig = new TDConfig(appId, serverUrl);
571
- tdConfig.timezone = TDTimeZone.UTC;
572
- TDAnalytics.Init(tdConfig);
573
- ```
574
-
575
- <!-- unsupported block: 34 -->
576
-
577
- Aligning event time with specified timezone will lose device local timezone information. If you need to preserve device local timezone information, you currently need to add related properties to events yourself.
578
-
579
- #### 5.3 Time Calibration
580
-
581
- SDK will use local time as event occurrence time by default. If user manually modifies device time, it will affect your business analysis. In this case, you can use time calibration operation to ensure the accuracy of event occurrence time. We provide `timestamp, NTP` two time calibration methods.
582
-
583
- - 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 the calibrated time as occurrence time.
584
-
585
- ```
586
- // 1585633785954 is current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
587
- TDAnalytics.CalibrateTime(1585633785954);
588
- ```
589
-
590
- - You can also set NTP server address, then SDK will try to get current time from the passed NTP service address and calibrate SDK time. If correct result is not obtained within default timeout (3 seconds), local time will be used for data reporting.
591
-
592
- ```
593
- // Use Apple's NTP service for time calibration
594
- TDAnalytics.CalibrateTimeWithNtp("time.apple.com");
595
- ```
596
-
597
- <!-- unsupported block: 34 -->
598
-
599
- 1. Using NTP service for time calibration has some uncertainty, we recommend you prefer using timestamp calibration method
600
-
601
- 2. You need to carefully choose your NTP server address to ensure that user devices can quickly get server time under good network conditions
602
-
603
- #### 5.4 Immediately Upload Data
604
-
605
- In certain business scenarios, if you expect data to be immediately uploaded to TE server, you can call `Flush` interface
606
-
607
- ```
608
- TDAnalytics.Flush();
609
- ```
610
-
611
- #### 5.5 Getting Country/Region Code
612
-
613
- In certain business scenarios, if you need to know user device's country/region code, you can get it via `GetLocalRegion`
614
-
615
- ```
616
- TDAnalytics.GetLocalRegion();
617
- ```
618
-
619
- #### 5.6 Lua Call Support
620
-
621
- If you need to call directly in Lua files, you can use encapsulated Lua API. Click to download
622
-
623
- After downloading, import `TDAnalytics.lua` and `TDAnalyticsProxy.cs` into project.
624
-
625
- Usage example:
626
-
627
- ```
628
- local config = {
629
- appId = "AppId",
630
- serverUrl = "ServerUrl",
631
- enableLog = true, --whether to enable log, default false--
632
- mode = 'debug' --default normal--
633
- }
634
- --SDK initialization--
635
- TDAnalytics.init(config);
636
-
637
- --If user is logged in, you can set user's account ID as unique identity
638
- TDAnalytics.login("TA")
639
-
640
- --After setting common event properties, every event will have common event properties
641
- local superProperties = {}
642
- superProperties["channel"] = "ta" -- string
643
- superProperties["age"] = 1 -- number
644
- superProperties["isSuccess"] = true -- boolean
645
- superProperties["birthday"] = os.date("%Y-%m-%d %H:%M:%S") -- time
646
- superProperties["object"] = { key="value" } -- object
647
- superProperties["object_arr"] = { { key="value" } } -- object array
648
- superProperties["arr"] = { "value" } -- array
649
- TDAnalytics.setSuperProperties(superProperties) -- set common event properties
650
-
651
- --Send event
652
- TDAnalytics.track("product_buy", {
653
- product_name="product name"
654
- });
655
-
656
- --Set user properties
657
- TDAnalytics.userSet({
658
- user_name = "TE"
659
- })
660
- ```
661
-
662
- #### 5.7 WeChat Auto Data Collection
663
-
664
- For WeChat mini game platform, currently supports show event, hide event, launch event auto-tracking. Integration method:
665
-
666
- - Download WeChat mini game plugin
667
- Window->Package Manager-> + -> Add package from git url
668
-
669
- PackageManager(git install URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git
670
-
671
- - Custom macro
672
- Edit -> Project Settings -> Scripting Define Symbols
673
-
674
- Add global macro parameter TD_WEIXIN_GAME_MODE
675
-
676
- Click Apply button to complete setting
677
-
678
- - Assembly add dependency
679
- Project window layout ThinkingAnalytics folder -> TDAnalytics(Assembly Definition) -> Assembly Definition References -> + -> WxWasmSDKRuntime
680
-
681
- Usage example:
682
-
683
- ```
684
- // Enable auto-tracking events, supports show, hide, launch events
685
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd | TDAutoTrackEventType.AppInstall);
686
- ```
687
-
688
- ### 6. Channel SDK Compatibility
689
-
690
- #### 6.1 Tencent Ads
691
-
692
- ##### 6.1.1 Solution Overview
693
-
694
- After integrating TDAnalytics SDK, you don't need to additionally integrate Tencent Ads SDK. Once you complete TDAnalytics initialization method, the system will automatically trigger Tencent Ads SDK initialization. When you report registration, payment and other key events, the system will automatically report these event information to Tencent Ads according to your configuration.
695
-
696
- ##### 6.1.2 Integration Process
697
-
698
- 1. Download Tencent Ads SDK, currently using 1.5.4 version. Other versions also work.
699
- 1. Initialize
700
- <!-- unsupported block: 19 -->
701
-
702
- TDAnalytics SDK version needs >= 3.1.1
703
-
704
- ```
705
- TDConfig config = new TDConfig("APPID","SERVER");
706
- config.reportingToTencentSdk = 2; //1 report only to Tencent 2 report to Tencent and TE 3 report only to TE
707
- TDAnalytics.Init(config);
708
- ```
709
-
710
- If you need to report data to Tencent, need to do following:
711
-
712
- After exporting WeChat mini game project, import dn-sdk-minigame.js file into project, modify game.js to import dn-sdk and complete initialization
713
-
714
- ```
715
- import { SDK } from "./dn-sdk-minigame.js";
716
- try {
717
- // Initialize
718
- GameGlobal.dnSDK = new SDK({
719
- user_action_set_id: 123xxxxxx,
720
- secret_key: 'xxxxxxxxxxxxxxxxxxx',
721
- appid: 'xxxxxxxxxxxxx',
722
- });
723
- // Report startup
724
- GameGlobal.dnSDK.onAppStart();
725
- } catch {
726
-
727
- }
728
- ```
729
-
730
- 1. Set User ID
731
-
732
- - setOpenId
733
- openid is generally obtained asynchronously via backend interface call (get openid method). Please call _sdk.setOpenId()_ method after getting openid. openid and unionid can only set one, prefer openid.
734
-
735
- After getting openid, call
736
-
737
- ```
738
- TDAnalytics.login(openid);
739
- ```
740
-
741
- - setUnionId
742
- unionid is generally obtained asynchronously via backend interface call (get unionid method). Please call _sdk.setUnionId()_ method after getting unionid. Use this method to set unionid only when openid is not available.
743
-
744
- After getting openid, call
745
-
746
- ```
747
- TDAnalytics.setDistinctId(unionid);
748
- ```
749
-
750
- 1. Report behavior
751
-
752
- ```
753
- Dictionary<string, object> properties = new Dictionary<string, object>(){{"product_name", "product name"}};
754
- TDAnalytics.Track("product_buy", properties);
755
- ```
756
-
757
- For specific events below, need to report specified event names
758
-
759
- Event
760
-
761
- Event Name
762
-
763
- Event Properties (need to include keys)
764
-
765
- ##### Mini Game Startup
766
-
767
- ##### START_APP
768
-
769
- None
770
-
771
- ##### Payment
772
-
773
- ##### PURCHASE
774
-
775
- {
776
-
777
- value: 600
778
-
779
- }
780
-
781
- ##### Registration
782
-
783
- ##### REGISTER
784
-
785
- ##### Silent Wake Up
786
-
787
- ##### RE_ACTIVE
788
-
789
- {
790
-
791
- backFlowDay: 30
792
-
793
- }
794
-
795
- ##### Add Mini Game to Wishlist
796
-
797
- ##### ADD_TO_WISHLIST
798
-
799
- {
800
-
801
- type: 'default',
802
-
803
- }
804
-
805
- ##### Share Mini Game
806
-
807
- ##### SHARE
808
-
809
- {
810
-
811
- target: 'APP_MESSAGE'
812
-
813
- }
814
-
815
- ##### Create Role
816
-
817
- ##### CREATE_ROL
818
-
819
- {
820
-
821
- name: 'SuperMan'
822
-
823
- }
824
-
825
- ##### Complete New User Guide
826
-
827
- ##### TUTORIAL_FINISH
828
-
829
- None
830
-
831
- ##### Game Level Up
832
-
833
- ##### UPDATE_LEVEL
834
-
835
- {
836
-
837
- level: 2,
838
-
839
- power: 85,
840
-
841
- }
842
-
843
- ##### View Mall Page
844
-
845
- ##### VIEW_CONTENT
846
-
847
- {
848
-
849
- // Key scene visit: Mall
850
-
851
- item: 'Mall',
852
-
853
- }
854
-
855
- ##### View Game Activity
856
-
857
- ##### VIEW_CONTENT
858
-
859
- {
860
-
861
- // Key scene visit: Activity
862
-
863
- item: 'Activity',
864
-
865
- }
866
-
867
- For example, report game level up event
868
-
869
- ```
870
- Dictionary<string, object> properties = new Dictionary<string, object>();
871
- properties["level"] = 2;
872
- properties["power"] = 85;
873
- TDAnalytics.Track("product_buy", properties);
874
- ```
875
-
876
- ---
877
-
878
- # Third Party Data
879
-
880
- From v2.4.0 supports third party data integration feature. Below is sample code to sync data from multiple platforms:
881
-
882
- ```
883
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.APPSFLYER | TDThirdPartyType.ADJUST | TDThirdPartyType.TRADPLUS | TDThirdPartyType.TRACKING | TDThirdPartyType.TOPON | TDThirdPartyType.BRANCH | TDThirdPartyType.IRONSOURCE);
884
- ```
885
-
886
- ### 1.Appsflyer
887
-
888
- Call API before AppsFlyer SDK calls start method.
889
-
890
- ```
891
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.APPSFLYER);
892
- ```
893
-
894
- After creating role (optional).
895
-
896
- ```
897
- TDAnalytics.Login("account_id");
898
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.APPSFLYER);
899
- ```
900
-
901
- If TE's Login method is called (will modify account_id) or SetDistinctId method is called (will modify distinct_id), need to call EnableThirdPartySharing again to sync data.
902
-
903
- ### 2.Adjust
904
-
905
- Call before Adjust SDK initialization.
906
-
907
- ```
908
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.ADJUST);
909
- ```
910
-
911
- After creating role (optional).
912
-
913
- ```
914
- TDAnalytics.Login("account_id");
915
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.ADJUST);
916
- ```
917
-
918
- ### 3.Branch
919
-
920
- Call before Branch initialize the session.
921
-
922
- ```
923
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.BRANCH);
924
- ```
925
-
926
- After creating role (optional).
927
-
928
- ```
929
- TDAnalytics.Login("account_id");
930
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.BRANCH);
931
- ```
932
-
933
- ### 4.TopOn
934
-
935
- Call before ATSDK._init._
936
-
937
- ```
938
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.TOPON);
939
- ```
940
-
941
- ### 5.Tradplus
942
-
943
- Call before TradPlusSdk._initSdk._
944
-
945
- ```
946
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.TRADPLUS);
947
- ```
948
-
949
- ### 6.IronSource
950
-
951
- Call after IronSourceSdk initialization.
952
-
953
- ```
954
- TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.IRONSOURCE);
955
- ```
956
-
957
- ---
958
-
959
- # Native SDK Pluggable
960
-
961
- ::: tip Tip
962
-
963
- From v2.6.0 supports dynamic switching of iOS/Android native platform execution code logic. Default executes Objective-C/Java logic. After switching, executes C# code logic.
964
-
965
- For iOS/Android apps already online, after users update to "execute C# code logic" version, will lose persistent data, including device ID, account ID, visitor ID, event common properties, etc. May be judged as new user. Please choose carefully.
966
-
967
- :::
968
-
969
- ## 1. Pluggable Process
970
-
971
- ### 1.1 iOS Platform
972
-
973
- <!-- unsupported block: 34 -->
974
-
975
- Default executes Objective-C code logic. After switching executes C# code logic.
976
-
977
- - After downloading Unity SDK, unzip to `ta_unity_sdk.unitypackage` file. Double click to select import SDK. In import interface, uncheck `Plugins/iOS` directory, then import
978
- <!-- unsupported block: 34 -->
979
-
980
- Note: If Unity SDK has already been imported, need to check Plugins/iOS directory files. If there are no files or directories other than "ThinkingSDK", "TAThirdParty", "ThinkingAnalytics.m", directly delete Plugins/iOS. Otherwise delete above files and directories.
981
-
982
- - Open `Project Settings` interface, switch to `iOS` tab, find `Scripting Define Symbols`, add new line input `TE_DISABLE_IOS_OC` then click `Apply` button to complete setting. Finally after development is completed, normally export Xcode project
983
-
984
- ### 1.2 Android Platform
985
-
986
- <!-- unsupported block: 34 -->
987
-
988
- Default executes Java code logic. After switching executes C# code logic.
989
-
990
- - After downloading Unity SDK, unzip to `ta_unity_sdk.unitypackage` file. Double click to select import SDK. In import interface, uncheck `Plugins/Android` directory, then import
991
- <!-- unsupported block: 34 -->
992
-
993
- Note: If Unity SDK has already been imported, need to check Plugins/Android directory files. If there are no files or directories other than "ThinkingSDK.aar", "ThinkingSDK-gameengine.aar", "ThinkingSDK-thirdparty.aar", directly delete Plugins/Android. Otherwise delete above files.
994
-
995
- - Open `Project Settings` interface, switch to `Android` tab, find `Scripting Define Symbols`, add new line input `TE_DISABLE_ANDROID_JAVA` then click `Apply` button to complete setting. Finally after development is completed, normally export Android project
996
-
997
- ---
998
-
999
- # Multi-instance
1000
-
1001
- ### 1. Creating Multi-instance
1002
-
1003
- In actual business, if you expect to send data to multiple projects, you can use our provided multi-instance feature.
1004
-
1005
- Pass different project information to complete SDK initialization, can create multiple SDK instances.
1006
-
1007
- ```
1008
- //Multi-instance initialization
1009
- TDConfig tdConfig_1 = new TDConfig(appId_1, serverUrl_2);
1010
- TDConfig tdConfig_2 = new TDConfig(appId_2, serverUrl_2);
1011
- //Initialize first instance
1012
- TDAnalytics.Init(tdConfig_1);
1013
- //Initialize second instance
1014
- TDAnalytics.Init(tdConfig_2);
1015
- //Use multi-instance for data tracking
1016
- Dictionary<string, object> properties = new Dictionary<string, object(){
1017
- {"product_name", "product name"}
1018
- };
1019
- //Use first instance to report data
1020
- TDAnalytics.Track("product_buy", properties, appId_1);
1021
- //Use second instance to report data
1022
- TDAnalytics.Track("product_buy", properties, appId_2);
1023
- //If not passing project ID, will default use first instance to report data
1024
- TDAnalytics.Track("product_buy", properties);
1025
- ```
1026
-
1027
- <!-- unsupported block: 34 -->
1028
-
1029
- Visitor ID, account ID, common properties, etc. are not shared across multiple projects. Need to set separately for each APP ID instance.
1030
-
1031
- ### 2. Creating Light Instance
1032
-
1033
- ```
1034
- //First create an SDK instance
1035
- TDAnalytics.Init("APPID", "SERVER");
1036
- //Then call createLightInstance to generate light instance
1037
- string lightKey = TDAnalytics.LightInstance();
1038
- //Then set login information, report events according to lightKey
1039
- TDAnalytics.Login("123ABCabc@thinkingdata.cn", lightKey);
1040
- TDAnalytics.Track("some_event", lightKey);
1041
- ```
1042
-
1043
- <!-- unsupported block: 34 -->
1044
-
1045
- Light instance and parent instance have same APPID, reporting address and some settings, but other information is not shared.
1046
-
1047
- ---
1048
-
1049
- # Real-time Debugging
1050
-
1051
- During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
1052
-
1053
- ### 1. Printing SDK Logs
1054
-
1055
- ```
1056
- // Enable printing data Log
1057
- TDAnalytics.EnableLog(true);
1058
- ```
1059
-
1060
- <!-- unsupported block: 34 -->
1061
-
1062
- After enabling logs, you can filter TDAnalytics related logs in IDE to observe SDK data reporting.
1063
-
1064
- ### 2. Enabling Debug Mode
1065
-
1066
- Enabling Debug mode requires two steps:
1067
-
1068
- 1. Enable Debug mode on client
1069
- Here is sample code for enabling Debug mode on client:
1070
-
1071
- ```
1072
- /*
1073
- Set running mode to Debug mode
1074
- NORMAL mode: data will be cached and uploaded according to certain caching strategy, default is NORMAL mode; recommended for production environment
1075
- Debug mode: data is uploaded one by one. When problems occur, it will alert users via logs and exceptions; not recommended for production environment
1076
- DebugOnly mode: only validate data, will not store; not recommended for production environment
1077
- */
1078
- TDConfig tdConfig = new TDConfig(appId, serverUrl);
1079
- tdConfig.mode = TDMode.Debug;
1080
- TDAnalytics.Init(tdConfig);
1081
- ```
1082
-
1083
- 2. Add Debug device in TE backend
1084
- 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.
1085
-
1086
- Device ID can be obtained through three ways:
1087
-
1088
- - #device_id property in event data on TE platform
1089
- - Client log: Device DeviceId will be printed after SDK initialization completes
1090
- - Instance interface call: Get Device ID
1091
- <!-- unsupported block: 34 -->
1092
-
1093
- Debug mode may affect data collection quality and App stability, only use for integration stage data verification, do not use in production environment.
1094
-
1095
- ---
1096
-
1097
- # Auto-tracking
1098
-
1099
- ### 1. Enable Auto-tracking Events
1100
-
1101
- <!-- unsupported block: 19 -->
1102
-
1103
- HarmonyOS platform this feature is temporarily disabled
1104
-
1105
- You can call `EnableAutoTrack` passing `TDAutoTrackEventType` to enable specified event auto-tracking.
1106
-
1107
- ```
1108
- public enum TDAutoTrackEventType
1109
- {
1110
- None = 0,
1111
- AppStart = 1 << 0,
1112
- AppEnd = 1 << 1,
1113
- AppCrash = 1 << 4,
1114
- AppInstall = 1 << 5,
1115
- AppSceneLoad = 1 << 6,
1116
- AppSceneUnload = 1 << 7,
1117
- All = AppStart | AppEnd | AppInstall | AppCrash | AppSceneLoad | AppSceneUnload
1118
- }
1119
- ```
1120
-
1121
- Auto-tracking event description:
1122
-
1123
- - **AppStart**: When game enters foreground, will trigger `ta_app_start` report. Preset property `#resume_from_background` indicates whether this startup is from restart.
1124
- <!-- unsupported block: 19 -->
1125
-
1126
- Note: WeChat mini game AppStart event becomes show event, event name: _`ta_mg_show`_, adds property _`start_reason`_
1127
-
1128
- - **AppEnd**: When game enters background, will trigger `ta_app_end` report. Preset property `#duration` field indicates this game's foreground duration, in seconds.
1129
- <!-- unsupported block: 19 -->
1130
-
1131
- Note: WeChat mini game AppEnd event becomes hide event, event name: _`ta_mg_hide`_
1132
-
1133
- - **AppCrash**: When uncaught exception occurs, will trigger `ta_app_crash` report. Currently Android platform handles virtual machine uncaught exceptions. iOS platform handles Unix signal exceptions and NSException exceptions.
1134
- - **AppInstall**: When app is first opened after installation, triggers `ta_app_install` report. Does not distinguish between reinstall after uninstall. This time is only reported once after installation, subsequent updates will not report.
1135
- <!-- unsupported block: 19 -->
1136
-
1137
- Note: WeChat mini game AppInstall event becomes launch event, event name: _`ta_mg_launch`_, adds property _`start_reason`_
1138
-
1139
- - **AppSceneLoad**: When game scene (Scene) loads, triggers `ta_scene_loaded` report
1140
- - **AppSceneUnload**: When game scene (Scene) unloads, triggers `ta_scene_unloaded` report
1141
- You can pass `TDAutoTrackEventType.All` to enable all currently supported auto-tracking events, or enable partial auto-tracking events according to your project needs.
1142
-
1143
- ```
1144
- // Enable all auto-tracking events
1145
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.All);
1146
-
1147
- // Enable auto-tracking for start and close events
1148
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
1149
- ```
1150
-
1151
- <!-- unsupported block: 34 -->
1152
-
1153
- Note: If you need to set custom visitor ID or common event properties, need to complete before enabling auto-tracking events. Auto-tracking events currently do not support dynamic common properties.
1154
-
1155
- About `AppCrash`, if on `iOS` and `Android` platforms you only want to collect `Objective-C` and `Java` exceptions, not collect `C#` exceptions. In v2.3.1 and above versions, you can configure switch by adding `ta_public_config.xml` in `Resources` directory:
1156
-
1157
- ```
1158
- <?xml version="1.0" encoding="utf-8"?>
1159
- <resources>
1160
- <!-- ThinkingAnalytics disable C# Exception -->
1161
- <bool name="DisableCSharpException">true</bool>
1162
- </resources>
1163
- ```
1164
-
1165
- ### 2. Setting Auto-tracking Event Custom Properties
1166
-
1167
- From v2.2.4, you can pass custom properties to be collected when calling `EnableAutoTrack` to enable auto-tracking.
1168
-
1169
- ```
1170
- // Enable auto-tracking events and set custom properties
1171
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.All, new Dictionary<string, object>() {
1172
- {"custom_key", "custom_value"}
1173
- });
1174
- ```
1175
-
1176
- You can also call `SetAutoTrackProperties` to specify custom properties for specific auto-tracking events.
1177
-
1178
- <!-- unsupported block: 34 -->
1179
-
1180
- Note: `SetAutoTrackProperties` will not enable auto-tracking event collection. Need to use with `EnableAutoTrack` method.
1181
-
1182
- ```
1183
- // Set custom properties for single auto-tracking event
1184
- TDAnalytics.SetAutoTrackProperties(TDAutoTrackEventType.AppStart, new Dictionary<string, object>()
1185
- {
1186
- {"start_key", "start_value"}
1187
- });
1188
-
1189
- // Set custom properties for multiple auto-tracking events
1190
- TDAnalytics.SetAutoTrackProperties(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart, new Dictionary<string, object>()
1191
- {
1192
- {"install_crash_key", "install_crash_value"}
1193
- });
1194
-
1195
- // Enable all auto-tracking events
1196
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.All);
1197
- ```
1198
-
1199
- ### 3. Setting Auto-tracking Event Callback
1200
-
1201
- From v2.4.0, supports setting auto-tracking event callback to dynamically set custom properties, or execute custom code at corresponding event trigger time. To set auto-tracking event callback, need to first create class and implement `TDAutoTrackEventHandler` interface, override `public Dictionary<string, object> GetAutoTrackEventProperties(int type, Dictionary<string, object>properties)` method. The method's return value is the auto-tracking event properties to set. Then call `EnableAutoTrack` passing auto-tracking event callback object:
1202
-
1203
- ```
1204
- // 1.Auto-tracking event callback implementation
1205
- public class AutoTrackECB : TDAutoTrackEventHandler
1206
- {
1207
- public Dictionary<string, object> GetAutoTrackEventProperties(int type, Dictionary<string, object>properties)
1208
- {
1209
- return new Dictionary<string, object>()
1210
- {
1211
- {"AutoTrackEventProperty", DateTime.Today}
1212
- };
1213
- }
1214
- }
1215
- // 2.Enable auto-tracking and set event callback
1216
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.All, new AutoTrackECB());
1217
- ```
1218
-
1219
- ### 4. Enable Scene Auto-tracking Events
1220
-
1221
- From v2.4.1, supports auto-tracking scene load and unload events.
1222
-
1223
- By registering scene load, unload delegate events, to enable scene auto-tracking events.
1224
-
1225
- Recommend calling in `MonoBehaviour` script's `OnEnable` method.
1226
-
1227
- ```
1228
- private void OnEnable()
1229
- {
1230
- // Listen to scene load, unload events
1231
- SceneManager.sceneLoaded += TDAnalytics.OnSceneLoaded;
1232
- SceneManager.sceneUnloaded += TDAnalytics.OnSceneUnloaded;
1233
- }
1234
- ```
1235
-
1236
- From v2.5.1, you can call `EnableAutoTrack` method to enable scene auto-tracking events
1237
-
1238
- ```
1239
- // Enable all auto-tracking events
1240
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.All);
1241
-
1242
- // Enable auto-tracking for start and close events
1243
- TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppSceneLoad | TDAutoTrackEventType.AppSceneUnload);
1244
- ```
1245
-
1246
- ---
1247
-
1248
- # Preset Properties
1249
-
1250
- ### 1. Preset Properties Description
1251
-
1252
- <!-- unsupported block: 34 -->
1253
-
1254
- Preset properties collected by each platform will have some differences. Please refer to the following documents: Android Platform, iOS Platform
1255
-
1256
- **Non-Native platform (such as PC, Switch etc. terminals) preset properties:**
1257
-
1258
- **Property Name**
1259
-
1260
- **Chinese Name**
1261
-
1262
- **Property Type**
1263
-
1264
- **Description**
1265
-
1266
- #ip
1267
-
1268
- IP Address
1269
-
1270
- Text
1271
-
1272
- User's IP address, TE will use this to get user's geographic location information
1273
-
1274
- #country
1275
-
1276
- Country
1277
-
1278
- Text
1279
-
1280
- User's country, generated from IP address
1281
-
1282
- #country_code
1283
-
1284
- Country Code
1285
-
1286
- Text
1287
-
1288
- User's country code (ISO 3166-1 alpha-2, i.e. two uppercase English letters), generated from IP address
1289
-
1290
- #province
1291
-
1292
- Province
1293
-
1294
- Text
1295
-
1296
- User's province, generated from IP address
1297
-
1298
- #city
1299
-
1300
- City
1301
-
1302
- Text
1303
-
1304
- User's city, generated from IP address
1305
-
1306
- #os_version
1307
-
1308
- OS Version
1309
-
1310
- Text
1311
-
1312
- Such as windows10
1313
-
1314
- #manufacturer
1315
-
1316
- Device Manufacturer
1317
-
1318
- Text
1319
-
1320
- Graphics card manufacturer name
1321
-
1322
- #os
1323
-
1324
- OS
1325
-
1326
- Text
1327
-
1328
- Such as MacOS, Windows etc.
1329
-
1330
- #device_id
1331
-
1332
- Device ID
1333
-
1334
- Text
1335
-
1336
- User's device ID
1337
-
1338
- #screen_height
1339
-
1340
- Screen Height
1341
-
1342
- Number
1343
-
1344
- User's device screen height, such as 1920 etc.
1345
-
1346
- #screen_width
1347
-
1348
- Screen Width
1349
-
1350
- Number
1351
-
1352
- User's device screen height, such as 1080 etc.
1353
-
1354
- #device_model
1355
-
1356
- Device Model
1357
-
1358
- Text
1359
-
1360
- User's device model, such as iPhone 8 etc.
1361
-
1362
- #app_version
1363
-
1364
- APP Version
1365
-
1366
- Text
1367
-
1368
- Your APP version
1369
-
1370
- #bundle_id
1371
-
1372
- App Unique Identifier
1373
-
1374
- Text
1375
-
1376
- App package name
1377
-
1378
- #lib
1379
-
1380
- SDK Type
1381
-
1382
- Text
1383
-
1384
- SDK type you integrated, such as Android, iOS etc.
1385
-
1386
- #lib_version
1387
-
1388
- SDK Version
1389
-
1390
- Text
1391
-
1392
- SDK version you integrated
1393
-
1394
- #network_type
1395
-
1396
- Network Status
1397
-
1398
- Text
1399
-
1400
- Network status when uploading event, such as Mobile, LAN
1401
-
1402
- #carrier
1403
-
1404
- Network Carrier
1405
-
1406
- Text
1407
-
1408
- User's device network carrier, such as China Mobile, China Telecom etc.
1409
-
1410
- #zone_offset
1411
-
1412
- Timezone Offset
1413
-
1414
- Number
1415
-
1416
- Data time offset hours relative to UTC time
1417
-
1418
- #system_language
1419
-
1420
- System Language
1421
-
1422
- Text
1423
-
1424
- User's device system language (ISO 639-1, i.e. two lowercase English letters), such as zh, en etc.
1425
-
1426
- #start_reson
1427
-
1428
- Startup Reason
1429
-
1430
- Text
1431
-
1432
- App open or enter foreground page startup reason
1433
-
1434
- ### 2. Getting Preset Properties
1435
-
1436
- v2.2.0 and later versions can call `TDAnalytics.GetPresetProperties()` method to get preset properties. When server-side tracking needs some preset properties from App side, you can use this method to get App side preset properties and then pass to server.
1437
-
1438
- ```
1439
- //Get property object
1440
- TDPresetProperties presetProperties = TDAnalytics.GetPresetProperties();
1441
-
1442
- //Generate event preset properties
1443
- Dictionary<string, object> eventPresetProperties = presetProperties.ToDictionary();
1444
- /*
1445
- {
1446
- "#carrier": "China Telecom",
1447
- "#os": "iOS",
1448
- "#device_id": "A8B1C00B-A6AC-4856-8538-0FBC642C1BAD",
1449
- "#screen_height": 2264,
1450
- "#bundle_id": "com.sw.thinkingdatademo",
1451
- "#app_version": "0.1",
1452
- "#manufacturer": "Apple",
1453
- "#device_model": "iPhone7",
1454
- "#screen_width": 1080,
1455
- "#system_language": "zh",
1456
- "#os_version": "10",
1457
- "#network_type": "WIFI",
1458
- "#zone_offset": 8,
1459
- "#app_version":"1.0.0"
1460
- }
1461
- */
1462
-
1463
- //Get a specific preset property
1464
- string bundleId = presetProperties.BundleId;//package name
1465
- string appVersion = presetProperties.AppVersion;//App version number
1466
- string os = presetProperties.OS;//os type, such as Android, iOS
1467
- string systemLanguage = presetProperties.SystemLanguage;//phone system language type
1468
- int screenWidth = presetProperties.ScreenWidth;//screen width
1469
- int screenHeight = presetProperties.ScreenHeight;//screen height
1470
- string deviceModel = presetProperties.DeviceModel;//device model
1471
- string deviceId = presetProperties.DeviceId;//device unique identifier
1472
- string carrier = presetProperties.Carrier;//phone SIM card carrier info, dual SIM dual standby, takes primary card's carrier info
1473
- string manufacture = presetProperties.Manufacturer;//phone manufacturer such as HuaWei, Apple
1474
- string networkType = presetProperties.NetworkType;//network type
1475
- string osVersion = presetProperties.OSVersion;//system version number
1476
- double zoneOffset = presetProperties.ZoneOffset;//timezone offset value
1477
- string appVersion = presetProperties.appVersion;//App version number
1478
- ```
1479
-
1480
- <!-- unsupported block: 34 -->
1481
-
1482
- IP, country and city information are generated from server-side parsing, client does not provide interface to get these properties
1483
-
1484
- ### 3. Disable Preset Property Collection
1485
-
1486
- In v2.3.1 and above versions, supports disabling specified preset property reporting. Configure switch by adding `ta_public_config.xml` in `Resources` directory. Configured field corresponding preset property will not upload. As follows:
1487
-
1488
- ```
1489
- <?xml version="1.0" encoding="utf-8"?>
1490
- <resources>
1491
- <!-- ThinkingAnalytics DisablePresetProperties start -->
1492
- <string-array name="TDDisPresetProperties">
1493
- <item>#disk</item>
1494
- <item>#fps</item>
1495
- <item>#ram</item>
1496
- <!-- <item>#app_version</item> -->
1497
- <!-- <item>#os_version</item> -->
1498
- <!-- <item>#manufacturer</item> -->
1499
- <!-- <item>#device_model</item> -->
1500
- <!-- <item>#screen_height</item> -->
1501
- <!-- <item>#screen_width</item> -->
1502
- <!-- <item>#carrier</item> -->
1503
- <!-- <item>#device_id</item> -->
1504
- <!-- <item>#system_language</item> -->
1505
- <!-- <item>#lib</item> -->
1506
- <!-- <item>#lib_version</item> -->
1507
- <!-- <item>#os</item> -->
1508
- <!-- <item>#bundle_id</item> -->
1509
- <!-- <item>#install_time</item> -->
1510
- <!-- <item>#start_reason</item> -->
1511
- <!-- <item>#simulator</item> -->
1512
- <!-- <item>#network_type</item> -->
1513
- <!-- <item>#start_reason</item> -->
1514
- <!-- <item>#resume_from_background</item> -->
1515
- <!-- <item>#title</item> -->
1516
- <!-- <item>#screen_name</item> -->
1517
- <!-- <item>#url</item> -->
1518
- <!-- <item>#referrer</item> -->
1519
- <!-- <item>#element_type</item> -->
1520
- <!-- <item>#element_id</item> -->
1521
- <!-- <item>#element_position</item> -->
1522
- <!-- <item>#element_content</item> -->
1523
- <!-- <item>#element_selector</item> -->
1524
- <!-- <item>#app_crashed_reason</item> -->
1525
- </string-array>
1526
- <!-- ThinkingAnalytics DisablePresetProperties end -->
1527
- </resources>
1528
- ```
1529
-
1530
- <!-- unsupported block: 34 -->
1531
-
1532
- If you disable device ID and need to use first-time events, please make sure to fill in first_check_id property