@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,446 +0,0 @@
1
- ---
2
- code: golang_sdk_installation
3
- name: "Golang"
4
- wikiToken: LopRwvKpWiKdXdkB9YSck9ImnVf
5
- parentWikiToken: O3YxwgHGiiEnvYkHCcIcX51inkf
6
- updateTime: 1745310918000
7
- sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=golang_sdk_installation
8
- ---
9
-
10
- # Golang
11
-
12
- ::: tip Note
13
-
14
- Before integration, please read the Pre-Integration Guide first.
15
-
16
- :::
17
-
18
- **Latest Version**: v2.1.0
19
-
20
- **Update Date**: 2024-12-19
21
-
22
- **Download**: Source Code
23
-
24
- ::: warning Note
25
-
26
- This document applies to v2.0.0 and later versions. For historical versions, please refer to Go SDK Integration Guide (V1).
27
-
28
- :::
29
-
30
- ### 1. SDK Integration
31
-
32
- 1. We provide two options for SDK integration:
33
- Option 1: Run the following command to get the latest Golang SDK
34
-
35
- ```
36
- # Get SDK
37
- go get github.com/ThinkingDataAnalytics/go-sdk/v2
38
-
39
- # Update SDK
40
- go get -u github.com/ThinkingDataAnalytics/go-sdk/v2
41
- ```
42
-
43
- Option 2: Module Mode
44
-
45
- ```
46
- // Import thinkingdata at the beginning of code file
47
- import "github.com/ThinkingDataAnalytics/go-sdk/v2/src/thinkingdata"
48
-
49
- # Pull latest SDK module
50
- go mod tidy
51
- ```
52
-
53
- 2. Install LogBus
54
- We recommend using SDK + LogBus for server-side data collection and reporting. You can refer to the following documentation for LogBus installation: LogBus User Guide.
55
-
56
- ### 2. Initialization
57
-
58
- Here is sample code for SDK initialization:
59
-
60
- ```
61
- // Create LogConfig configuration file
62
- config := thinkingdata.TDLogConsumerConfig {
63
- FileNamePrefix: "test_prefix", // log file prefix
64
- Directory: "LOG_DIRECTORY", // Event collection file path
65
- }
66
- // Initialize logConsumer
67
- consumer, _ := thinkingdata.NewLogConsumerWithConfig(config)
68
- // Create te object
69
- te := thinkingdata.New(consumer)
70
- ```
71
-
72
- `LOG_DIRECTORY` is the local folder address for writing. You just need to set LogBus's monitoring folder address to this address to use LogBus for data monitoring and uploading.
73
-
74
- ### 3. Common Features
75
-
76
- To ensure successful binding of visitor ID and account ID, if your game uses both visitor ID and account ID, we strongly recommend uploading both IDs. Otherwise, account matching issues may occur, leading to duplicate user counts. For specific ID binding rules, please refer to the User Identification Rules chapter.
77
-
78
- #### 3.1 Track Events
79
-
80
- You can call `track` to upload events. We recommend setting event properties and sending conditions based on your previously documented requirements. Here is sample code for tracking events:
81
-
82
- ```
83
- accountId := "te_account_id"
84
- distinctId := "te_distinct_id"// accountId and distinctId cannot both be empty
85
- properties := map[string]interface{}{
86
- // Set user IP address, TE system will parse user geographic location based on IP
87
- "#ip": "123.123.123.123",
88
- "channel": "te", // String
89
- "age": 1, // Number
90
- "is_success": true, // Boolean
91
- "birthday": time.Now(), // Date
92
- // Object
93
- "object": map[string]interface{}{
94
- "key": "value",
95
- },
96
- // Object Array
97
- "objectArr": []interface{}{
98
- map[string]interface{}{
99
- "key": "value",
100
- },
101
- },
102
- "arr": []string{"value"}, // Array
103
- }
104
- // track event
105
- err := te.Track(accountId, distinctId, "payment", properties)
106
- ```
107
-
108
- - Event name must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters.
109
- - Key is the property name, must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters. Case-insensitive, TE will convert to lowercase.
110
- - Value is the property value, supporting strings, numbers, booleans, dates, objects, object arrays, and arrays.
111
-
112
- **User property requirements are consistent with event property requirements**
113
-
114
- #### 3.2 Set User Properties
115
-
116
- For general user properties, you can call `UserSet` to set them. Properties uploaded via this interface will overwrite existing property values. If the user property does not exist previously, a new user property will be created with the same type as the uploaded property. Here is an example of setting a username:
117
-
118
- ```
119
- // At this point, username is "TA"
120
- err := te.UserSet("accountId", "distinctId", map[string]interface{}{
121
- "user_name": "TA",
122
- })
123
- // At this point, username is "TE"
124
- err = te.UserSet("accountId", "distinctId", map[string]interface{}{
125
- "user_name": "TE",
126
- })
127
- ```
128
-
129
- #### 3.3 Data Reporting
130
-
131
- When using TDLogConsumer, SDK will write collected data to disk in real-time.
132
-
133
- The `Flush()` method of `TDAnalytics` object internally synchronizes the default memory cache in the file system to disk in real-time. Generally, you don't need to manually call the `Flush()` method.
134
-
135
- #### 3.4 Close SDK
136
-
137
- ```
138
- // Close and exit SDK
139
- te.Close()
140
- ```
141
-
142
- Close and exit the SDK. Please call this interface before shutting down the server to avoid data loss in the cache.
143
-
144
- ### 4. Best Practices
145
-
146
- The following sample code includes all the above operations. We recommend using it as follows:
147
-
148
- ```
149
- // Create LogConfig configuration file
150
- config := thinkingdata.TDLogConsumerConfig {
151
- Directory: "./log_directory", // Event collection file path
152
- }
153
- // Initialize logConsumer
154
- consumer, _ := thinkingdata.NewLogConsumerWithConfig(config)
155
- // Create te object
156
- te := thinkingdata.New(consumer)
157
-
158
- accountId := "te_account_id"
159
- distinctId := "te_distinct_id"// accountId and distinctId cannot both be empty
160
- properties := map[string]interface{}{
161
- // Set user IP address, TE system will parse user geographic location based on IP
162
- "#ip": "123.123.123.123",
163
- "channel": "te", // String
164
- "age": 1, // Number
165
- "isSuccess": true, // Boolean
166
- "birthday": time.Now(), // Date
167
- // Object
168
- "object": map[string]interface{}{
169
- "key": "value",
170
- },
171
- // Object Array
172
- "objectArr": []interface{}{
173
- map[string]interface{}{
174
- "key": "value",
175
- },
176
- },
177
- "arr": []string{"value"}, // Array
178
- }
179
- // Upload event
180
- err := te.Track(accountId, distinctId, "payment", properties)
181
- if err != nil {
182
- fmt.Println(err)
183
- }
184
- // Set user properties
185
- err = te.UserSet("accountId", "distinctId", map[string]interface{}{
186
- "user_name": "TE",
187
- })
188
- if err != nil {
189
- fmt.Println(err)
190
- }
191
- ```
192
-
193
- ---
194
-
195
- # Advanced Guide
196
-
197
- ### 1. Track Events
198
-
199
- After SDK initialization, you can perform data tracking to collect user behavior information. Generally, regular events can meet business scenario requirements. You can also use first-time events, updateable events, etc. based on your actual business scenarios.
200
-
201
- #### 1.1 Regular Events
202
-
203
- You can call `track` to upload events. We recommend setting event properties and sending conditions based on your previously documented requirements. Here is an example of a user purchasing a product:
204
-
205
- ```
206
- // Set event properties
207
- properties := map[string]interface{}{
208
- "product_name": "Product Name",
209
- }
210
- // Report event named product_buy. account_id and distinct_id cannot both be empty
211
- te.Track("account_id", "distinct_id", "product_buy", properties)
212
- ```
213
-
214
- #### 1.2 First-Time Events
215
-
216
- First-time events are events that are recorded only once for a specific device or other dimensional ID. For example, in some scenarios, you may want to record an activation event on a specific device, which can be reported using a first-time event.
217
-
218
- ```
219
- // Report first-time event, event name is device_activation, first_check_id value is first_event_flag
220
- properties := map[string]interface{}{
221
- "prop_string": "value",
222
- }
223
- err := te.TrackFirst("account_id", "distinct_id", "device_activation", "first_event_flag", properties)
224
- ```
225
-
226
- Note: Since first-time verification is completed on the server side, first-time events will be delayed by 1 hour before entering the database.
227
-
228
- #### 1.3 Updateable Events
229
-
230
- You can implement the need to modify event data in specific scenarios through updateable events. Updateable events need to specify an ID that identifies the event and pass it when creating the updateable event object. TE backend will determine the data to be updated based on the event name and event ID.
231
-
232
- ```
233
- // Report updateable event, assuming event name is UPDATABLE_EVENT
234
- // After reporting, event property status is 3, price is 100
235
- properties := make(map[string]interface{})
236
- properties["status"] = 3
237
- properties["price"] = 100
238
- err := te.TrackUpdate("account_id", "distinct_id", "UPDATABLE_EVENT", "test_event_id", properties)
239
- propertiesNew := make(map[string]interface{})
240
- propertiesNew["status"] = 5
241
-
242
- // After reporting, event property status is updated to 5, price unchanged
243
- err = te.TrackUpdate("account_id", "distinct_id", "UPDATABLE_EVENT", "test_event_id", propertiesNew)
244
- ```
245
-
246
- #### 1.4 Overwriteable Events
247
-
248
- Overwriteable events are similar to updateable events, except that overwriteable events will completely overwrite historical data with the latest data. Effectively, this is equivalent to deleting the previous data and inserting the latest data. TE backend will determine the data to be updated based on the event name and event ID.
249
-
250
- ```
251
- // Report overwriteable event, event name is OVERWRITE_EVENT
252
- // After reporting, event property status is 3, price is 100
253
- properties := make(map[string]interface{})
254
- properties["status"] = 3
255
- properties["price"] = 100
256
- err := te.TrackOverwrite("account_id", "distinct_id", "OVERWRITE_EVENT", "test_event_id", properties)
257
-
258
- // After reporting, event property status is updated to 5, price property is deleted
259
- propertiesNew := make(map[string]interface{})
260
- propertiesNew["status"] = 5
261
- err = te.TrackOverwrite("account_id", "distinct_id", "OVERWRITE_EVENT", "test_event_id", propertiesNew)
262
- ```
263
-
264
- ### 2. User Properties
265
-
266
- TE platform supports the following user property setting APIs: `UserSet`, `UserSetOnce`, `UserAdd`, `UserDelete`, `UserUnset`, `UserAppend`, `UserUniqAppend`.
267
-
268
- #### 2.1 UserSet
269
-
270
- For general user properties, you can call `UserSet` to set them. Properties uploaded via this interface will overwrite existing property values. If the user property does not exist previously, a new user property will be created with the same type as the uploaded property. Here is an example of setting a username:
271
-
272
- ```
273
- // At this point, userName is "TA"
274
- err := te.UserSet("account_id", "distinct_id", map[string]interface{}{
275
- "user_name": "TA",
276
- })
277
- // At this point, userName is "TE"
278
- err = te.UserSet("account_id", "distinct_id", map[string]interface{}{
279
- "user_name": "TE",
280
- })
281
- ```
282
-
283
- #### 2.2 UserSetOnce
284
-
285
- If you want to set a user property only once, you can call `UserSetOnce`. When the property already has a value, this information will be ignored. Here is another example of setting a username:
286
-
287
- ```
288
- // first_payment_time is 2018-01-01 01:23:45.678
289
- err := te.UserSetOnce("account_id", "distinct_id", map[string]interface{}{
290
- "first_payment_time":"2018-01-01 01:23:45.678",
291
- })
292
-
293
- // first_payment_time is still 2018-01-01 01:23:45.678
294
- err = te.UserSetOnce("account_id", "distinct_id", map[string]interface{}{
295
- "first_payment_time":"2018-12-31 01:23:45.678",
296
- })
297
- ```
298
-
299
- #### 2.3 UserAdd
300
-
301
- When you want to upload numeric properties, you can call `UserAdd` to accumulate the property. If the property has not been set, it will be assigned 0 before calculation. Negative values can be passed, equivalent to subtraction. Here is an example of accumulating total payment amount:
302
-
303
- ```
304
- // Upload user property, at this point "total_revenue" value is 30
305
- err := te.UserAdd("account_id", "distinct_id", map[string]interface{}{
306
- "total_revenue":30,
307
- })
308
- // Upload user property again, at this point "total_revenue" value accumulates to 678
309
- err = te.UserAdd("account_id", "distinct_id", map[string]interface{}{
310
- "total_revenue":648,
311
- })
312
- ```
313
-
314
- The property key must be a string, and Value only allows numeric values.
315
-
316
- #### 2.4 UserAppend
317
-
318
- You can call `UserAppend` to append array-type user properties.
319
-
320
- ```
321
- // At this point, user_list property value is ["apple", "ball"]
322
- err := te.UserAppend("account_id", "distinct_id", map[string]interface{}{
323
- "user_list": []string{"apple", "ball"},
324
- })
325
- ```
326
-
327
- #### 2.5 UserUniqAppend
328
-
329
- From v1.6.0 version onwards, you can call `UserUniqAppend` to append array-type user properties. The `UserUniqAppend` interface will deduplicate appended user properties, while `UserAppend` interface does not deduplicate, allowing duplicate user properties.
330
-
331
- ```
332
- // in this case, the property value of user_list is ["apple", "ball"]
333
- err := te.UserAppend("account_id", "distinct_id", map[string]interface{}{
334
- "user_list": []string{"apple", "ball"},
335
- })
336
- // in this case, the property value of user_list is ["apple","apple","ball","cube"]
337
- err = te.UserAppend("account_id", "distinct_id", map[string]interface{}{
338
- "user_list": []string{"apple", "cube"},
339
- })
340
- // in this case, the property value of user_list is ["apple", "ball","cube"]
341
- err = te.UserUniqAppend("account_id", "distinct_id", map[string]interface{}{
342
- "user_list": []string{"apple", "cube"},
343
- })
344
- ```
345
-
346
- #### 2.6 UserUnset
347
-
348
- When you want to clear user property values, you can call `UserUnset` to clear specified properties. If the property has not been created in the cluster, `UserUnset` will not create the property.
349
-
350
- ```
351
- // Clear specific user property of a user, pass property name in parameter
352
- err := te.UserUnset("account_id"," distinct_id", property_name)
353
- ```
354
-
355
- UserUnset: The parameter is the Key value of the property to be cleared.
356
-
357
- #### 2.7 UserDelete
358
-
359
- If you want to delete a user, you can call `UserDelete` to delete the user. You will no longer be able to query the user's properties, but events generated by the user can still be queried. This operation may have irreversible consequences, please use with caution.
360
-
361
- ```
362
- err := te.UserDelete("account_id", "distinct_id")
363
- ```
364
-
365
- ### 3. Other Features
366
-
367
- #### 3.1 BatchConsumer
368
-
369
- ::: warning Note
370
-
371
- When data volume is large or network is abnormal, there is a risk of data loss. Not recommended for production environments.
372
-
373
- :::
374
-
375
- Batch real-time data transmission to TE server without requiring transmission tools.
376
-
377
- ```
378
- consumer, err := thinkingdata.NewBatchConsumer("SERVER_URL", "APP_ID")
379
- te := thinkingdata.New(consumer)
380
- ```
381
-
382
- Parameter Description:
383
-
384
- - `APPID`: Your project's APPID, can be obtained from TE backend project management page
385
- - `SERVER_URL`: Data upload URL
386
- - If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
387
- - If you use private deployment version, please bind domain for data collection address and configure HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
388
-
389
- ---
390
-
391
- # Real-time Debugging
392
-
393
- ::: warning Note
394
-
395
- SDK Debug mode is only for integration debugging. Do not use in production environment.
396
-
397
- :::
398
-
399
- During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
400
-
401
- ### 1. Print SDK Logs
402
-
403
- ```
404
- // enable log
405
- thinkingdata.SetLogLevel(thinkingdata.TDLogLevelDebug)
406
- ```
407
-
408
- ### 2. Enable Debug Mode
409
-
410
- Enabling Debug mode requires two steps:
411
-
412
- 1. Use TDDebugConsumer
413
- Here is sample code using TDDebugConsumer:
414
-
415
- ```
416
- // Create Debug Consumer
417
- consumer, _ := thinkingdata.NewDebugConsumerWithDeviceId("url", "appid", false, "deviceId")
418
- te := thinkingdata.New(consumer)
419
- ```
420
-
421
- 2. Add Debug Device in TE Backend
422
- To prevent Debug mode from going live in production environment, only specified devices can enable Debug mode. Debug mode can only be enabled when Debug mode is turned on in the client and the device ID is configured in TE backend's "Tracking Management" page under "Debug Data" section.
423
-
424
- Debug mode may affect data collection quality and App stability. Only use for integration stage data verification, not for online environment.
425
-
426
- ---
427
-
428
- # Preset Properties
429
-
430
- The following preset properties are included in all events for Golang SDK.
431
-
432
- **Property Name** | **Chinese Name** | **Property Type** | **Description**
433
-
434
- #ip | IP Address | Text | User's IP address, needs to be set manually. TE will use this to obtain user's geographic location information.
435
-
436
- #country | Country | Text | User's country, generated based on IP address.
437
-
438
- #country_code | Country Code | Text | User's country code (ISO 3166-1 alpha-2, i.e., two uppercase English letters), generated based on IP address.
439
-
440
- #province | Province | Text | User's province, generated based on IP address.
441
-
442
- #city | City | Text | User's city, generated based on IP address.
443
-
444
- #lib | SDK Type | Text | Type of SDK you integrated, such as Java, etc.
445
-
446
- #lib_version | SDK Version | Text | Version of SDK you integrated.