@thinkingai/ae-cli 6.1.38 → 6.1.40

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 (191) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +2 -0
  3. package/dist/{ai-monitor-UL2O7J4X.js → ai-monitor-DST4NDOK.js} +5 -5
  4. package/dist/ai-monitor.js +7 -7
  5. package/dist/{auth-ERWVKQDG.js → auth-BD3NIY3T.js} +3 -3
  6. package/dist/{automation-OQ647CSW.js → automation-IMDCJUML.js} +85 -9
  7. package/dist/{capability-HPP6E3ZX.js → capability-3NJOQHZQ.js} +3 -3
  8. package/dist/{chunk-DKOGWIYQ.js → chunk-24DCOJBJ.js} +2 -2
  9. package/dist/{chunk-SHB7A2JE.js → chunk-2RORKIF6.js} +2 -2
  10. package/dist/{chunk-HBI7IQH3.js → chunk-6NJZSWUT.js} +3 -28
  11. package/dist/{chunk-QPUPWGZ3.js → chunk-DTODOQ6T.js} +1 -1
  12. package/dist/{chunk-PCQTBRPT.js → chunk-FRJUB66C.js} +1 -1
  13. package/dist/{chunk-ZLJZPPPV.js → chunk-IY5G42YY.js} +2 -2
  14. package/dist/{chunk-JRXSLFCA.js → chunk-KBJHBVO7.js} +1 -1
  15. package/dist/{chunk-CYZV5AXW.js → chunk-KE5WGBXS.js} +2 -1
  16. package/dist/chunk-N2MAYIRU.js +32 -0
  17. package/dist/{chunk-BWEQIKA3.js → chunk-RW6Z2NN3.js} +5 -5
  18. package/dist/{chunk-DULCIC67.js → chunk-SQEK6S4X.js} +2 -3
  19. package/dist/{chunk-VPLRZSMY.js → chunk-STHIGWWC.js} +10 -1
  20. package/dist/{chunk-LXRALNNA.js → chunk-UK7HQ4IL.js} +1 -1
  21. package/dist/{chunk-NDX4VJO7.js → chunk-VXKKTUU2.js} +2 -2
  22. package/dist/{chunk-E5CJI7L3.js → chunk-WRYXVIJP.js} +1 -1
  23. package/dist/{compat-check-WRPEFB5N.js → compat-check-7VBBE7KO.js} +1 -1
  24. package/dist/{config-IS33K45R.js → config-LFRZBPH5.js} +3 -3
  25. package/dist/{context-Y2A6QIS3.js → context-WJQGJD6F.js} +1 -1
  26. package/dist/{data-integration-EIF5QHYF.js → data-integration-KMJWYAKK.js} +2 -1
  27. package/dist/index.js +35 -33
  28. package/dist/{memory-6QMZS4HF.js → memory-VPOPSU52.js} +3 -3
  29. package/dist/{metadata-TMAXVLOL.js → metadata-AR64J76Z.js} +5 -5
  30. package/dist/{model-LEYRQKOS.js → model-2F2354QP.js} +1 -1
  31. package/dist/{personal-semantic-preference-RMZEDRCJ.js → personal-semantic-preference-BCOSI4DO.js} +4 -4
  32. package/dist/{project-semantic-UD3OAZ6K.js → project-semantic-DJLXAXLD.js} +4 -4
  33. package/dist/{sync-GVF3OI2U.js → sync-4TUIQ2PZ.js} +3 -3
  34. package/dist/{te-agent-S7UH657Z.js → te-agent-EMDWA3M6.js} +4 -4
  35. package/dist/{te-analysis-SJIE5OZY.js → te-analysis-NJHSEKGW.js} +8 -6
  36. package/dist/{te-community-VNHJDEID.js → te-community-JSUSZEYH.js} +4 -4
  37. package/dist/{te-dataops-AO4OQBQV.js → te-dataops-I264BUTI.js} +2 -2
  38. package/dist/{te-engage-EZJRFG3Q.js → te-engage-XNMQYO5N.js} +68 -16
  39. package/dist/{te-experiment-R2MNSAKV.js → te-experiment-5SCHMYVO.js} +4 -4
  40. package/dist/{te-kb-C44A4BHM.js → te-kb-QQ53TNRZ.js} +44 -13
  41. package/dist/{te-system-DB5Z3LLF.js → te-system-Z4VEB6PL.js} +1 -1
  42. package/dist/{te-team-J52STTEZ.js → te-team-V6BBI52R.js} +87 -6
  43. package/dist/{things-G2QFXDK7.js → things-THHGDSEC.js} +4 -4
  44. package/dist/{update-GEKOZMHU.js → update-53ZUXWV5.js} +2 -2
  45. package/dist/{web-runtime-5M7PRY7R.js → web-runtime-HIXOSNJ6.js} +89 -9
  46. package/dist/{workspace-RZESYB6T.js → workspace-W5ZPVWJS.js} +3 -3
  47. package/package.json +3 -3
  48. package/skills/ae-automation/SKILL.md +6 -2
  49. package/skills/ae-automation/references/cli.md +9 -3
  50. package/skills/ae-engage/SKILL.md +6 -1
  51. package/skills/ae-engage/references/common-metric.md +47 -1
  52. package/skills/ae-engage/references/flow-metric-update.md +1 -1
  53. package/skills/ae-engage/references/task-metric-update.md +1 -1
  54. package/skills/ae-experiment/SKILL.md +1 -1
  55. package/skills/ae-experiment/references/save_experiment.md +1 -1
  56. package/skills/ae-kb/SKILL.md +8 -6
  57. package/skills/ae-kb/references/query-workflow.md +5 -1
  58. package/skills/ae-onboarding/SKILL.md +2 -2
  59. package/skills/ae-onboarding/references/demo-operations.md +3 -2
  60. package/skills/ae-onboarding/references/onboarding_experiment_launch.md +4 -2
  61. package/skills/ae-team/SKILL.md +7 -3
  62. package/skills/ae-team/references/copy-to-personal.md +7 -0
  63. package/skills/ae-team/references/promote.md +7 -0
  64. package/skills/ae-team/references/update.md +3 -3
  65. package/skills/ae-tracking-matrix/SKILL.md +0 -170
  66. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  67. package/skills/ae-tracking-matrix/i18n.yaml +0 -12
  68. package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
  69. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
  70. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
  71. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
  72. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
  73. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
  74. package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
  75. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
  76. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
  77. package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
  78. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
  79. package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
  80. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
  81. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
  82. package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
  83. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
  84. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
  85. package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
  86. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
  87. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
  88. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
  89. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
  90. package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
  91. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
  92. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
  93. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
  94. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
  95. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
  96. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
  97. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
  98. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
  99. package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
  100. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
  101. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
  102. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
  103. package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
  104. package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
  105. package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
  106. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
  107. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
  108. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
  109. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
  110. package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
  111. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
  112. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
  113. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
  114. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
  115. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
  116. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
  117. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
  118. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
  119. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
  120. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
  121. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
  122. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
  123. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
  124. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
  125. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
  126. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
  127. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
  128. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
  129. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
  130. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
  131. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
  132. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
  133. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
  134. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
  135. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
  136. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
  137. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
  138. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
  139. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
  140. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
  141. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
  142. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
  143. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
  144. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
  145. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
  146. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
  147. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
  148. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
  149. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
  150. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
  151. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
  152. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
  153. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
  154. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
  155. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
  156. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
  157. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
  158. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
  159. package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
  160. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
  161. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
  162. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
  163. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
  164. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
  165. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
  166. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
  167. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
  168. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
  169. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
  170. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
  171. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
  172. package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
  173. package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
  174. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
  175. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
  176. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
  177. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
  178. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
  179. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
  180. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
  181. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
  182. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
  183. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
  184. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
  185. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
  186. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
  187. package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
  188. package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
  189. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
  190. package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
  191. package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
@@ -1,149 +0,0 @@
1
- ---
2
- title: "Mini Game SDK FAQ"
3
- code: "minigame_sdk_faq"
4
- source: "Feishu MCP"
5
- doc_id: "wikcnvfJGsMHmKJIsEIhx0T2lyj"
6
- fetched_at: "2026-04-20T17:29:39Z"
7
- ---
8
-
9
- # Integrate SDK
10
-
11
- ## SDK Integration Methods
12
-
13
- - Currently only supports local integration, NPM is not supported yet
14
-
15
- ## SDK Compatibility Notes
16
-
17
- - Supported platforms: WeChat Mini Game, Alipay Mini Game, ByteDance Mini Game, Baidu Mini Game, etc.
18
- - Supported engines: CocosCreator, Egret White Egret Engine, Laya Engine
19
-
20
- # Initialize SDK
21
-
22
- ## Recommended SDK Initialization Location
23
-
24
- - Initialize in mini game startup script, such as game.js for WeChat Mini Game
25
-
26
- ## Common Issues
27
-
28
- ### Delayed initialization causes auto-tracking event time delay
29
-
30
- ### Device without network SDK initialization will not fail
31
-
32
- # SDK Data Upload Strategy
33
-
34
- ## Real-time Upload
35
-
36
- - Default immediate upload after collection, retry 3 times on failure
37
-
38
- ## Scheduled Batch Upload
39
-
40
- ```javascript
41
- var config = {
42
- appId: "APP_ID",
43
- serverUrl: "SERVER_URL",
44
- enableBatch: true,
45
- batchConfig: {
46
- size: 5,
47
- interval: 5000,
48
- storageLimit: 200,
49
- },
50
- };
51
- TDAnalytics.init(config);
52
- ```
53
-
54
- ## Data Upload Failure Reasons
55
-
56
- - Need to configure serverUrl as mini game access domain whitelist
57
-
58
- # SDK Cache Mechanism
59
-
60
- ## Storage Content
61
-
62
- - Visitor ID, Device ID, event data, etc.
63
- - Uses mini game native setStorage interface for storage
64
-
65
- ## Cache Count Limit
66
-
67
- - Default maximum cache of 200 records
68
-
69
- # Visitor ID (#distinct_id)
70
-
71
- ## Default Format
72
-
73
- - Random number-current timestamp, such as 2267955649-1679397798804
74
-
75
- ## Length Limit
76
-
77
- - Maximum length 128 characters
78
-
79
- # Debug Mode
80
-
81
- ## debugMode Three Values
82
-
83
- - none: Normal mode
84
- - debug: Data visible in TE Debug mode, participates in analysis
85
- - debugOnly: Only validation, not stored in database
86
-
87
- ## Reasons for Not Seeing Data in Debug Mode
88
-
89
- - Confirm mode is correctly enabled
90
- - Confirm Device ID is configured in TE backend
91
- - Confirm appId, serverUrl are correct
92
-
93
- # Auto-tracking
94
-
95
- ## ta_mg_show
96
-
97
- - Triggered when mini game starts, background returns to foreground
98
- - Monitors onShow event
99
-
100
- ## ta_mg_hide
101
-
102
- - Triggered when foreground switches to background
103
- - Monitors onHide event
104
- - #duration is time difference from onShow to onHide
105
-
106
- # Common Event Properties
107
-
108
- ## Static Common Event Properties
109
-
110
- ```javascript
111
- ta.setSuperProperties({ channel: "Channel Name", user_name: "User Name" });
112
- ```
113
-
114
- ## Dynamic Common Event Properties
115
-
116
- ```javascript
117
- ta.setDynamicSuperProperties(function () {
118
- return { gold_coin: getGold() };
119
- });
120
- ```
121
-
122
- ## Property Priority
123
-
124
- - User-defined > Dynamic common > Static common
125
-
126
- # Preset Properties
127
-
128
- ## Device ID (#device_id)
129
-
130
- - Default same as Visitor ID
131
-
132
- ## IP Address (#ip)
133
-
134
- - Server resolves from request header
135
- - Can manually upload #ip
136
-
137
- # Known Issues
138
-
139
- ## Taobao Mini Game
140
-
141
- - 3.4.4 version Batch mode loop sending issue
142
-
143
- ## OPPO Mini Game
144
-
145
- - module is not defined error
146
-
147
- ## TikTok
148
-
149
- - #scene property type invalid
@@ -1,153 +0,0 @@
1
- ---
2
- title: "Mini Program SDK FAQ"
3
- code: "miniprogram_sdk_faq"
4
- source: "Feishu MCP"
5
- doc_id: "wikcnFKi1tU3gBHjbIqVy4M6GGe"
6
- fetched_at: "2026-04-20T17:29:39Z"
7
- ---
8
-
9
- # Integrate SDK
10
-
11
- ## SDK Integration Methods
12
-
13
- - Currently only supports local integration, NPM is not supported yet
14
-
15
- ## SDK Compatibility Notes
16
-
17
- - Supported platforms: WeChat Mini Program, Alipay Mini Program, ByteDance Mini Program, Baidu Mini Program, etc.
18
-
19
- # Initialize SDK
20
-
21
- ## Recommended SDK Initialization Location
22
-
23
- - Initialize in mini program startup script, such as app.js for WeChat Mini Program
24
-
25
- ## Common Issues
26
-
27
- ### Delayed initialization causes first auto-tracking event after initialization to fail upload
28
-
29
- ### Device without network SDK initialization will not fail
30
-
31
- # SDK Data Upload Strategy
32
-
33
- ## Real-time Upload
34
-
35
- - Default immediate upload after collection, retry 3 times on failure
36
-
37
- ## Scheduled Batch Upload
38
-
39
- ```javascript
40
- var config = {
41
- appId: "APP_ID",
42
- serverUrl: "SERVER_URL",
43
- enableBatch: true,
44
- batchConfig: {
45
- size: 20,
46
- interval: 10000,
47
- storageLimit: 100,
48
- },
49
- };
50
- TDAnalytics.init(config);
51
- ```
52
-
53
- ## Data Upload Failure Reasons
54
-
55
- - Need to configure serverUrl as mini program access domain whitelist
56
-
57
- # SDK Cache Mechanism
58
-
59
- ## Storage Content
60
-
61
- - Visitor ID, Device ID, event data, etc.
62
- - Uses mini program native setStorage interface for storage
63
-
64
- ## Cache Count Limit
65
-
66
- - Default maximum cache of 200 records
67
-
68
- # Visitor ID (#distinct_id)
69
-
70
- ## Default Format
71
-
72
- - Random number-current timestamp, such as 2267955649-1679397798804
73
-
74
- ## Length Limit
75
-
76
- - Maximum length 128 characters
77
-
78
- # Debug Mode
79
-
80
- ## debugMode Three Values
81
-
82
- - none: Normal mode
83
- - debug: Data visible in TE Debug mode, participates in analysis
84
- - debugOnly: Only validation, not stored in database
85
-
86
- # Auto-tracking Events
87
-
88
- ## ta_mp_launch
89
-
90
- - Triggered when mini program cold start initialization completes
91
- - Monitors onLaunch callback
92
-
93
- ## ta_mp_view
94
-
95
- - Triggered when mini program starts, background returns to foreground, page switches
96
- - Monitors Page onShow event
97
-
98
- ## ta_mp_share
99
-
100
- - Triggered after clicking mini program page share button
101
- - Requires onShareAppMessage configuration
102
-
103
- ## ta_mp_show
104
-
105
- - Triggered when mini program starts, background returns to foreground
106
- - Monitors onShow event
107
-
108
- ## ta_mp_hide
109
-
110
- - Triggered when foreground switches to background
111
- - Monitors onHide event
112
- - #duration is time difference from onShow to onHide
113
-
114
- # Common Event Properties
115
-
116
- ## Static Common Event Properties
117
-
118
- ```javascript
119
- ta.setSuperProperties({ channel: "Channel Name", user_name: "User Name" });
120
- ```
121
-
122
- ## Dynamic Common Event Properties
123
-
124
- ```javascript
125
- ta.setDynamicSuperProperties(function () {
126
- return { gold_coin: getGold() };
127
- });
128
- ```
129
-
130
- ## Property Priority
131
-
132
- - User-defined > Dynamic common > Static common
133
-
134
- # Preset Properties
135
-
136
- ## Device ID (#device_id)
137
-
138
- - Default same as Visitor ID
139
-
140
- ## IP Address (#ip)
141
-
142
- - Server resolves from request header
143
- - Can manually upload #ip
144
-
145
- # Known Issues
146
-
147
- ## WeChat Mini Program
148
-
149
- - login method error TypeError: e.trim is not a function, needs to pass string
150
-
151
- ## Taobao Mini Program
152
-
153
- - 3.3.4 Uncaught TypeError, need to upgrade SDK to 3.5.1
@@ -1,232 +0,0 @@
1
- # I. Environment Configuration
2
-
3
- ```shell
4
- # Download
5
- pip(3) install ThinkingDataSdk
6
- # Update
7
- pip(3) install --upgrade ThinkingDataSdk
8
- ```
9
-
10
- Python SDK minimum compatible with Python 2.7.5, recommended to use version 2.7.9 or above. The following is based on SDK version 2.1.3.
11
-
12
- #### demo
13
-
14
- ```python
15
- from tgasdk.sdk import *
16
-
17
- # Runtime log switch, default False
18
- TGAnalytics.enableLog(True)
19
- # Initialize
20
- consumer = LoggingConsumer(log_directory="/Users/blank/Downloads/pytest")
21
- # consumer = BatchConsumer(server_uri="Upload Address", appid="Project appid")
22
- # consumer = AsyncBatchConsumer(server_uri="Upload Address", appid="Project appid")
23
- # consumer = DebugConsumer(server_uri="Upload Address", appid="Project appid", device_id="123456789")
24
- te = TGAnalytics(consumer)
25
- # Data upload
26
- account_id = "11111" # Account id
27
- distinct_id = "ABD" # Visitor id
28
- testProperties = {
29
- "#time": datetime.datetime.now(), # Set event time, defaults to current time if not filled
30
- "#ip": "123.123.123.123", # Set ip, default not uploaded
31
- "#zone_offset": 8, # Set timezone
32
- "a": "123", # Text
33
- "b": 123, # Number
34
- "c": False, # Boolean
35
- "e": datetime.datetime.now(), # Time
36
- "f": ["123", "123"], # List
37
- "g": { # Object
38
- "g1": "123", # Object only recognizes normal properties, if nested object/object group corresponding property ends up stored as text
39
- },
40
- "h": [ # Object Group
41
- {
42
- "h1": "123", # Each object in object group only recognizes normal properties, if nested object/object group corresponding property ends up stored as text
43
- },
44
- {
45
- "h1": "321",
46
- }
47
- ],
48
- }
49
-
50
- try:
51
- # Upload user properties
52
- te.user_set(account_id=account_id, distinct_id=distinct_id, properties=testProperties)
53
- # Upload event named test
54
- te.track(account_id=account_id, distinct_id=distinct_id, event_name="test", properties=testProperties)
55
- except Exception as e:
56
- raise TGAIllegalDataException(e)
57
-
58
- te.flush()
59
- # te.close() # Automatically calls flush() before closing sdk
60
- ```
61
-
62
- # II. Working Principles
63
-
64
- #### **What working modes does Python SDK support? What scenarios are they suitable for?**
65
-
66
- Python SDK supports the following four working modes:
67
-
68
- 1. **LoggingConsumer** Batch writes data to local files in real-time, files can be split by day, hour or specified file size, needs to be combined with LogBus for data upload. Advantage is data storage and upload are decoupled, data is persistently stored and not easily lost; disadvantage is need to additionally deploy LogBus for upload, LogBus will occupy some system resources.
69
- 2. **BatchConsumer** Batch uploads data to TA server in real-time, doesn't need to be combined with upload tool. Advantage is simple use without upload tool; disadvantage is data not persistently stored, only cached in memory, if network unstable and cached data exceeds cache limit will lose data.
70
- 3. **AsyncBatchConsumer** Asynchronously batch uploads data to TA server in real-time, same as BatchConsumer otherwise
71
- 4. **DebugConsumer** Sends data one by one, server performs strict validation on data, when some property doesn't comply with specification whole record won't be stored, when data format error will print detailed error message. DebugConsumer recommended for development debugging phase, forbidden for production environment.
72
-
73
- #### **How to get upload address and APP_ID?**
74
-
75
- Project manager can on ThinkingData WEB interface, after selecting specific project, enter Project Management - Project Configuration - Integration Configuration interface to get project appid. Upload address is divided into public network address and private network address, among which public network address suitable for client data upload, and server-side data integration in public network environment; if upload domain is configured in public network, consult the operations engineer who did that configuration; private network address suitable for data integration and testing in internal network environment, internal network upload address is port 8991 of each cluster node.
76
-
77
- #### **What is LoggingConsumer's working principle? What configuration parameters does it have?**
78
-
79
- Principle: Upload operation first writes to cache, writes to disk when exceeding buffer_size (default 5 records), if not meeting write condition and want to write data to file need to call flush method yourself. Can be executed in multi-threading but itself is synchronous method, multi-threading also has to wait for lock executionwhich instead wastes performance. When writing to file will add file lock so cannot have multiple processes write same file.
80
-
81
- LoggingConsumer common configuration parameters:
82
-
83
- | Parameter | Description | Default | Parameter Type | Required | Note |
84
- | ------------- | ------------------- | ------- | -------------- | -------- | --------------------------------------------------------------------------- |
85
- | log_directory | Log file path | - | String | Yes | Multi-level directory auto-created |
86
- | rotate_mode | Log split by time | DAILY | Enum | No | Enum('ROTATE_MODE', ('DAILY', 'HOURLY')) |
87
- | file_prefix | Log filename prefix | Empty | String | No | Fill when multiple instances to prevent multi-process write same file error |
88
- | log_size | Log split by size | 0 | Integer | No | Unit is MB, value 0 means no split, not recommended to use |
89
- | buffer_size | Cache size | 5 | Integer | No | Unit is records, writes to log from memory when exceeding |
90
-
91
- #### **What is BatchConsumer's working principle? What configuration parameters does it have?**
92
-
93
- Principle: Upload operation writes to cache, when upload data count exceeds batch (default 20) or due to network communication failure etc. causing unuploaded data making cache_buffer not empty, calls flush, if not meeting condition need to call flush method yourself. If communication failure will store in cache_buffer, long communication failure causing unsent total count / batch greater than max_cache_size will discard earliest batch records.
94
-
95
- BatchConsumer common configuration parameters:
96
-
97
- | Parameter | Description | Default | Parameter Type | Required | Note |
98
- | -------------- | -------------------------------------------------------- | ------- | -------------- | -------- | ----------------- |
99
- | server_uri | Upload address | - | String | Yes | |
100
- | appid | Project appid | - | String | Yes | |
101
- | batch | Batch size, triggers data upload when reaching threshold | 20 | Integer | No | Max 200 |
102
- | timeout | HTTP request timeout | 30000 | Integer | No | Unit milliseconds |
103
- | compress | Whether compress data | True | Boolean | No | |
104
- | max_cache_size | Memory retained data batch count | 50 | Integer | No | |
105
-
106
- #### **What is AsyncBatchConsumer's working principle? What configuration parameters does it have?**
107
-
108
- Principle: Upload operation writes to cache, calls flush when upload data count exceeds flush_size or every interval seconds. If communication failure during flush will retry 3 times, still fails will put back to queue waiting for next upload, long communication failure causing exceeding queue_size will discard earliest flush_size records.
109
-
110
- AsyncBatchConsumer common configuration parameters:
111
-
112
- | Parameter | Description | Default | Parameter Type | Required | Note |
113
- | ---------- | -------------------------------------------------------- | ------- | -------------- | -------- | ------------ |
114
- | server_uri | Upload address | - | String | Yes | |
115
- | appid | Project appid | - | String | Yes | |
116
- | interval | Data upload interval | 3 | Integer | No | Unit seconds |
117
- | flush_size | Batch size, triggers data upload when reaching threshold | 20 | Integer | No | |
118
- | queue_size | Send thread queue size | 100000 | Integer | No | Unit records |
119
-
120
- #### **What is DebugConsumer's working principle? What configuration parameters does it have?**
121
-
122
- Principle: Each record directly goes HTTP request to upload data, doesn't need to call flush. Data format will be strictly validated.
123
-
124
- DebugConsumer common configuration parameters:
125
-
126
- | Parameter | Description | Default | Parameter Type | Required | Note |
127
- | ---------- | ---------------------------------- | ------- | -------------- | -------- | ------- |
128
- | server_uri | Upload address | - | String | Yes | |
129
- | appid | Project appid | - | String | Yes | |
130
- | timeout | HTTP request timeout | 30000 | Integer | No | Unit ms |
131
- | write_data | Whether data is stored in database | True | Boolean | No | |
132
- | device_id | Device ID | Empty | String | No | |
133
-
134
- # III. Common Issues
135
-
136
- #### **What are the precautions for using LoggingConsumer?**
137
-
138
- - **Combine with LogBus upload**
139
- - LoggingConsumer + LogBus is ThinkingData standard data upload solution, LoggingConsumer makes data persistent, data gets loss-free guarantee; LogBus provides data transmission guarantee, also decouples data persistence and upload.
140
- - **File write permission**
141
- - Writing to log directory needs write and read permission, usually Windows environment has write permission issues.
142
- - **Disk space**
143
- - Ensure disk space is sufficient, and can reasonably configure deletion strategy in LogBus.
144
- - **Disk performance NFS situation**
145
- - **UUID**
146
- - Recommended to add UUID, prevent data duplication from network jitter and extreme cases, but will slightly consume efficiency, can also enable on LogBus side.
147
- - **Multi-process write different files**
148
- - Supports multi-process write different files, but need to ensure different processes' processing logic has no dependency relationship (e.g. user behavior from different servers written to different logs)
149
- - **Container environment**
150
- - Map data write path to external disk, prevent data file loss when container closes
151
-
152
- #### **Does LoggingConsumer support multi-threading? Does it support multi-process?**
153
-
154
- Supports multi-threading, doesn't support multi-process writing same file.
155
-
156
- #### **What are LoggingConsumer performance metrics?**
157
-
158
- 20k/s under 4C16G, varies up and down on different platforms and Python versions
159
-
160
- #### **Does LoggingConsumer have data loss risk? How to avoid?**
161
-
162
- If disk is full or server crash may cause data loss, recommendations:
163
-
164
- 1. Regularly check log write path disk remaining capacity
165
- 2. Lower buffer_size parameter value, increase memory flush frequency, but will cause frequent IO, need to comprehensively consider based on specific scenario
166
-
167
- #### **Why does BatchConsumer have data loss risk? How to avoid?**
168
-
169
- `BatchConsumer` maintains two queues in memory, one batch size queue responsible for storing single batch data, one batch\*max_cache_size size queue responsible for storing batch data queue failed to send due to network reasons. Because `BatchConsumer` is based on memory storage, when memory overflow or server crash happens, unsent data in memory will all be lost, recommendations:
170
-
171
- 1. Use LoggingConsumer + LogBus combination for data upload
172
- 2. Increase max_cache_size parameter value, when network abnormality causing data send failure, can store more data in memory, but will cause server memory usage increase, need to comprehensively consider based on specific scenario
173
- 3. Batch parameter should not be set too large, may cause single send time increase, increase probability of network error
174
-
175
- #### **What are BatchConsumer performance metrics? What scenarios is it suitable for?**
176
-
177
- Suitable for use in internal network environment with low concurrent data volume, guaranteed network (e.g. connected with TE cluster internal network).
178
-
179
- #### **Why is DebugConsumer forbidden in production environment?**
180
-
181
- DebugConsumer when uploading data, each record will be POST sent, production environment use will frequently create connections affecting efficiency.
182
-
183
- #### **When to call `close()` method?**
184
-
185
- Call when program needs normal end, close() method will write data in memory to file or send.
186
-
187
- #### **Called `track()` or `user_set()` method in program, why no data visible in TE backend?**
188
-
189
- Please check the following situations in order:
190
-
191
- - Check upload address and appid
192
- - Too few data, not triggered upload
193
- - Error data
194
- - Data time
195
- - Historical channel
196
- - Tracking plan
197
-
198
- #### **Why is "#ip" missing in uploaded data?**
199
-
200
- Server-side #ip needs separate upload, level same as #distinct_id, #event_name, #time, properties.
201
-
202
- # IV. Preset Properties, Special Type Upload
203
-
204
- #### **How to upload Object and Object Group types with Python SDK?**
205
-
206
- Python SDK 1.7.0 and above support uploading Object and Object Group types, code example please refer to Server SDK Complex Type Upload.
207
-
208
- #### **Common Properties**
209
-
210
- Server-side common properties cannot be precise to user level, in multi-threading situation uploading user-level property data may cause user data mismatch. Only recommended to put server ID etc. fields that won't have large changes in common properties, rest put in normal properties.
211
-
212
- #### **Timezone**
213
-
214
- Default timezone follows ThinkingData server, if want to achieve timezone offset need to upload #zone_offset field. Suppose filled 0 and event time is 2023-04-17 01:02:03, offset to East 8 zone will analyze with event time 2023-04-17 09:02:03.
215
-
216
- # V. Exception Errors
217
-
218
- 1. **Pip install Python SDK failed, error: "ERROR: Could not find a version that satisfies the requirement ThinkingDataSdk (from version: none) ERROR: No matching distribution found for ThinkingDataSdk"**
219
-
220
- This is common pip install issue, usually can be solved by upgrading pip version or changing pip source.
221
-
222
- 2. **Calling user_set() error: "error = year=1899 is before 1900; the datetime strftime() methods require year >= 1900"**
223
-
224
- Python SDK uses strftime() function for time conversion, doesn't support time before 1900.
225
-
226
- 3. **Calling track() error: "gevent.Hub.LoopExit: This operation would block forever"**
227
-
228
- This is customer using Python third-party library gevent error, many related materials and solutions online, can assist customer analysis, not Python SDK exception.
229
-
230
- 4. **BatchConsumer upload error: "Data transmission failed due to ConnectionError(ProtocolError('Connection aborted.', BadStatusLine('No status line received - the server has closed the connection',)),)"**
231
-
232
- This error comes from Python SDK's internal class \_HttpServices send() function, usually caused by network jitter. BatchConsumer's \_\_cache_buffer cache area won't remove failed upload data, will continue uploading next time, so network jitter won't cause data loss.