@thinkingai/ae-cli 6.0.61 → 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 (184) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +2 -0
  3. package/dist/{ai-monitor-NUKSJPLE.js → ai-monitor-X5GL44JT.js} +5 -5
  4. package/dist/ai-monitor.js +7 -7
  5. package/dist/{auth-MVAEBGBP.js → auth-SPQ46XQ3.js} +3 -3
  6. package/dist/{automation-6L6IAYRK.js → automation-7XC3VBZI.js} +85 -9
  7. package/dist/{capability-74N7AN5X.js → capability-JZP4KXZC.js} +3 -3
  8. package/dist/{chunk-SVNED423.js → chunk-2VKMHNUU.js} +4 -4
  9. package/dist/{chunk-JZY6WWAP.js → chunk-6HOM2FOJ.js} +10 -1
  10. package/dist/{chunk-COOMXFUG.js → chunk-AAN6KBUK.js} +2 -2
  11. package/dist/{chunk-H35VDOAE.js → chunk-E457FREE.js} +2 -2
  12. package/dist/{chunk-VLOGOM7N.js → chunk-ETQXIZFP.js} +2 -1
  13. package/dist/{chunk-XZDKAR4N.js → chunk-F36ORPI6.js} +3 -28
  14. package/dist/{chunk-7WBCSJL6.js → chunk-F7TCQPQX.js} +1 -1
  15. package/dist/{chunk-HRFYYEXR.js → chunk-FGGEF7MI.js} +2 -2
  16. package/dist/chunk-N2MAYIRU.js +32 -0
  17. package/dist/{chunk-RB26WNLM.js → chunk-PRCHMOWT.js} +1 -1
  18. package/dist/{chunk-LPKIMGIU.js → chunk-RYY5NJK3.js} +2 -2
  19. package/dist/{chunk-OTZ4JQDU.js → chunk-VR2D54AA.js} +1 -1
  20. package/dist/{chunk-THTROEGD.js → chunk-YIG3L4RC.js} +1 -1
  21. package/dist/{chunk-XPARQSYS.js → chunk-YJYC5PLL.js} +2 -3
  22. package/dist/{chunk-HIMOBNEY.js → chunk-ZVUXAHEV.js} +1 -1
  23. package/dist/{compat-check-W4XC27RG.js → compat-check-JD5D77ET.js} +1 -1
  24. package/dist/{config-264GB6C7.js → config-IIMRATTP.js} +3 -3
  25. package/dist/{context-SOQDFZIB.js → context-BXHIPIIX.js} +1 -1
  26. package/dist/{data-integration-UNJ7EPW2.js → data-integration-VRJQ3HVK.js} +2 -1
  27. package/dist/index.js +33 -31
  28. package/dist/{memory-ZLTTULZK.js → memory-B44LY27L.js} +3 -3
  29. package/dist/{metadata-EN2IWCDI.js → metadata-ZVPG2MIA.js} +5 -5
  30. package/dist/{model-NAKQWK4W.js → model-ANZBYVST.js} +1 -1
  31. package/dist/{personal-semantic-preference-UGN67KTN.js → personal-semantic-preference-YNCV4QG3.js} +4 -4
  32. package/dist/{project-semantic-5OP3YPZD.js → project-semantic-E7ZAQL5S.js} +4 -4
  33. package/dist/{sync-LDJQZRQH.js → sync-Y4OZRQAY.js} +3 -3
  34. package/dist/{te-agent-WNNAD4AJ.js → te-agent-RKAUTYJZ.js} +4 -4
  35. package/dist/{te-analysis-KIMH6AGU.js → te-analysis-7N5VC4JB.js} +5 -5
  36. package/dist/{te-community-P7NNBVCS.js → te-community-SIA2UHTS.js} +4 -4
  37. package/dist/{te-dataops-ZRKSG4R7.js → te-dataops-5MJQCODU.js} +2 -2
  38. package/dist/{te-engage-PVBVNRSU.js → te-engage-ZTLOMKO3.js} +68 -16
  39. package/dist/{te-kb-W7PRC7QN.js → te-kb-LDL3MF2Y.js} +44 -13
  40. package/dist/{te-system-F4ZU2HRQ.js → te-system-473I5O53.js} +1 -1
  41. package/dist/{te-team-5ONMRGKF.js → te-team-JOWHCMZA.js} +87 -6
  42. package/dist/{things-PFENSIF4.js → things-DOQ2L3O2.js} +4 -4
  43. package/dist/{update-EUZ4GNND.js → update-KUS6TCPB.js} +2 -2
  44. package/dist/{workspace-Z7L33OBQ.js → workspace-MJFPIV7C.js} +3 -3
  45. package/package.json +3 -3
  46. package/skills/ae-automation/SKILL.md +6 -2
  47. package/skills/ae-automation/references/cli.md +9 -3
  48. package/skills/ae-engage/SKILL.md +6 -1
  49. package/skills/ae-engage/references/common-metric.md +47 -1
  50. package/skills/ae-engage/references/flow-metric-update.md +1 -1
  51. package/skills/ae-engage/references/task-metric-update.md +1 -1
  52. package/skills/ae-kb/SKILL.md +8 -6
  53. package/skills/ae-kb/references/query-workflow.md +5 -1
  54. package/skills/ae-team/SKILL.md +7 -3
  55. package/skills/ae-team/references/copy-to-personal.md +7 -0
  56. package/skills/ae-team/references/promote.md +7 -0
  57. package/skills/ae-team/references/update.md +3 -3
  58. package/skills/ae-tracking-matrix/SKILL.md +0 -170
  59. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  60. package/skills/ae-tracking-matrix/i18n.yaml +0 -12
  61. package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
  62. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
  63. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
  64. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
  65. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
  66. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
  67. package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
  68. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
  69. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
  70. package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
  71. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
  72. package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
  73. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
  74. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
  75. package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
  76. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
  77. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
  78. package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
  79. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
  80. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
  81. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
  82. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
  83. package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
  84. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
  85. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
  86. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
  87. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
  88. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
  89. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
  90. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
  91. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
  92. package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
  93. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
  94. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
  95. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
  96. package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
  97. package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
  98. package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
  99. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
  100. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
  101. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
  102. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
  103. package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
  104. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
  105. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
  106. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
  107. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
  108. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
  109. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
  110. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
  111. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
  112. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
  113. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
  114. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
  115. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
  116. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
  117. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
  118. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
  119. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
  120. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
  121. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
  122. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
  123. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
  124. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
  125. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
  126. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
  127. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
  128. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
  129. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
  130. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
  131. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
  132. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
  133. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
  134. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
  135. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
  136. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
  137. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
  138. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
  139. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
  140. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
  141. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
  142. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
  143. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
  144. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
  145. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
  146. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
  147. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
  148. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
  149. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
  150. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
  151. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
  152. package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
  153. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
  154. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
  155. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
  156. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
  157. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
  158. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
  159. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
  160. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
  161. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
  162. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
  163. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
  164. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
  165. package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
  166. package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
  167. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
  168. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
  169. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
  170. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
  171. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
  172. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
  173. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
  174. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
  175. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
  176. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
  177. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
  178. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
  179. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
  180. package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
  181. package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
  182. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
  183. package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
  184. package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
@@ -1,763 +0,0 @@
1
- ---
2
- code: rn_sdk_support
3
- name: "React Native"
4
- wikiToken: BNJxwC9F9i9i9MkJyYQcbUs2nAf
5
- parentWikiToken: EaDPwgIujiz2GKk0rWxct8ZNn4g
6
- updateTime: 1764555635000
7
- sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=rn_sdk_support
8
- ---
9
-
10
- # React Native
11
-
12
- This guide will introduce how to use SDK features in React Native.
13
-
14
- **Latest Version: **v3.2.0
15
-
16
- **Update Time:** 2025-12-01
17
-
18
- **Resource Download: **Source code
19
-
20
- ::: warning Note
21
-
22
- This document applies to v3.0.0 and later versions. For historical versions, please refer to ReactNative Integration Guide (V2)
23
-
24
- :::
25
-
26
- ### 1. SDK Integration
27
-
28
- react-native-thinking-data has two integration methods: automatic and manual. We recommend using automatic integration.
29
-
30
- #### 1.1 Automatic Integration
31
-
32
- Add react-native-thinking-data in package.json file
33
-
34
- ```
35
- "dependencies": {
36
- "react-native-thinking-data": "3.2.0"
37
- }
38
- ```
39
-
40
- ### 2. SDK Initialization
41
-
42
- Here is the sample code for SDK initialization:
43
-
44
- ```
45
- import TDAnalytics,{TDAutoTrackEventType} from "react-native-thinking-data";
46
- TDAnalytics.init({
47
- appId: "xxx",
48
- serverUrl: "https://xxx"
49
- });
50
- ```
51
-
52
- Parameter Description:
53
-
54
- - `appId`: Your project's APPID, which can be obtained from the TE backend project management page
55
- - `serverUrl`: Data upload URL
56
- - If you are using cloud service, enter: https://global-receiver-ta.thinkingdata.cn
57
- - If you are using a private deployment version, please bind a domain to the data collection address and configure an HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
58
- <!-- unsupported block: 34 -->
59
-
60
- Since Android 9.0+ restricts HTTP requests by default, please make sure to use HTTPS protocol
61
-
62
- ### 3. Common Features
63
-
64
- Before using common features, we recommend you first understand the user identification rules. SDK will generate a random number as the visitor ID by default and persistently store it locally. Before user login, the visitor ID will be used as the identity identification ID. Note: Visitor ID will change when user reinstalls the App or changes device.
65
-
66
- #### 3.1 Setting Account ID
67
-
68
- When user logs in, you can call `login` to set the user's account ID. TE platform will use account ID as the 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.
69
-
70
- ```
71
- TDAnalytics.login("TA")
72
- ```
73
-
74
- `login` can be called multiple times. Each call will check whether the passed account ID is the same as the previously saved ID. If same, the call will be ignored. If different, it will overwrite the previous ID.
75
-
76
- <!-- unsupported block: 34 -->
77
-
78
- **This method will not upload a login event**
79
-
80
- #### 3.2 Setting Common Event Properties
81
-
82
- 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.
83
-
84
- ```
85
- TDAnalytics.setSuperProperties({
86
- 'channel': 'ta',//string
87
- 'age': 1,//number
88
- 'isSuccess': true,//boolean
89
- 'birthday': new Date(),//time
90
- 'object': {
91
- 'key': 'value'
92
- },//object
93
- 'object_arr': [
94
- { 'key': 'value' }
95
- ],//object array
96
- 'arr': ['value']//array
97
- })
98
- ```
99
-
100
- Common event properties will be saved to cache and don't need to be called every time the App starts. If `setSuperProperties` is called to upload a previously set common event property, it will overwrite the previous property.
101
-
102
- - 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
103
- - Value is the property value, supports string, number, boolean, time, object, object array, array
104
- <!-- unsupported block: 34 -->
105
-
106
- **Event property and user property requirements are consistent with common event properties**
107
-
108
- #### 3.3 Enabling Auto-tracking
109
-
110
- The following sample code enables auto-tracking for install, start, and end events. If you want to learn more about auto-tracking events, you can read the auto-tracking feature introduction
111
-
112
- ```
113
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_INSTALL)
114
- ```
115
-
116
- #### 3.4 Sending Events
117
-
118
- 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:
119
-
120
- ```
121
- TDAnalytics.track({
122
- eventName:"product_buy",
123
- properties:{
124
- 'product_name':'product name'
125
- }
126
- })
127
- ```
128
-
129
- #### 3.5 Setting User Properties
130
-
131
- For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
132
-
133
- ```
134
- //username is TA
135
- TDAnalytics.userSet({ username:"TA"})
136
- //username is TE
137
- TDAnalytics.userSet({ username:"TE"})
138
- ```
139
-
140
- ### 4. Best Practices
141
-
142
- The following sample code includes all the above operations. We recommend using the following steps:
143
-
144
- ```
145
- import TDAnalytics,{TDAutoTrackEventType} from "react-native-thinking-data";
146
- if (privacy policy authorized)
147
- {
148
- //SDK initialization
149
- TDAnalytics.init({appId: "xxx",serverUrl: "https://xxx",});
150
- //enable auto-tracking
151
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_INSTALL)
152
- //if user is logged in, you can set user's account ID as unique identity
153
- TDAnalytics.login("TA")
154
- //after setting common event properties, every event will have common event properties
155
- TDAnalytics.setSuperProperties({
156
- 'channel': 'ta',//string
157
- 'age': 1,//number
158
- 'isSuccess': true,//boolean
159
- 'birthday': new Date(),//time
160
- 'object': {'key': 'value'},//object
161
- 'object_arr': [{ 'key': 'value'}],//object array
162
- 'arr': ['value']//array
163
- })
164
- //send event
165
- TDAnalytics.track({
166
- eventName:"product_buy",
167
- properties:{
168
- 'product_name':'product name'
169
- }
170
- })
171
- //set user properties
172
- TDAnalytics.userSet({ username:"TE"})
173
- }
174
-
175
- ```
176
-
177
- ---
178
-
179
- # Advanced Guide
180
-
181
- ### 1. Setting User ID
182
-
183
- 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.
184
-
185
- #### 1.1 Setting Visitor ID
186
-
187
- ::: tip Tip
188
-
189
- Generally, you don't need to customize visitor ID. Please make sure you understand the user identification rules before setting visitor ID.
190
-
191
- 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.
192
-
193
- :::
194
-
195
- If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set visitor ID:
196
-
197
- ```
198
- // Set visitor ID to Thinker
199
- TDAnalytics.setDistinctId("Thinker");
200
- ```
201
-
202
- If you need to get the current visitor ID, you can call `getDistinctId`:
203
-
204
- ```
205
- //return visitor ID
206
- async () => {
207
- var distinct_id = await TDAnalytics.getDistinctId()
208
- }
209
- ```
210
-
211
- #### 1.2 Setting Account ID
212
-
213
- When user logs in, you can call `login` to set the user's account ID. TE platform will use account ID as the 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.
214
-
215
- ```
216
- // User's login unique identifier, this data corresponds to #account_id in the reported data, now #account_id is TA
217
- TDAnalytics.login("TA");
218
- ```
219
-
220
- <!-- unsupported block: 34 -->
221
-
222
- **This method will not upload a login event**
223
-
224
- #### 1.3 Clearing Account ID
225
-
226
- After user logs out, you can call `logout` to clear account ID. Before the next `login` call, visitor ID will be used as the identity identification ID.
227
-
228
- ```
229
- TDAnalytics.logout();
230
- ```
231
-
232
- We recommend you call `logout` at explicit logout events, such as when user performs account deregistration action, rather than when closing App.
233
-
234
- <!-- unsupported block: 34 -->
235
-
236
- **This method will not upload a logout event**
237
-
238
- ### 2. Sending Events
239
-
240
- #### 2.1 Regular Events
241
-
242
- 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.
243
-
244
- ```
245
- //store purchase event
246
- TDAnalytics.track({
247
- eventName:"product_buy",
248
- properties:{
249
- 'product_name':'product name'
250
- }
251
- })
252
- ```
253
-
254
- #### 2.2 First-time Events
255
-
256
- First-time events refer to events that will only be recorded once for a certain device or other dimension ID. For example, in some scenarios, you may want to record an activation event on a certain device, you can use first-time events to report data.
257
-
258
- ```
259
- // Example: report device first-time event, assuming event name is DEVICE_FIRST
260
- TDAnalytics.trackFirst({
261
- eventName:'device_activation',
262
- properties: {
263
- KEY_NUMBER: 1.02,
264
- KEY_STRING: "name",
265
- KEY_LIST: [1, 2, 3],
266
- KEY_BOOL: true,
267
- KEY_DateTime: "2020-05-12 06:27:18.371"
268
- },
269
- eventId:'YOUR_ACCOUNT_ID'
270
- })
271
- ```
272
-
273
- 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:
274
-
275
- ```
276
- // Set user ID as first_check_id for first-time event, to collect user first-time activation event
277
- TDAnalytics.trackFirst({
278
- eventName:'device_activation',
279
- properties: {
280
- KEY_NUMBER: 1.02,
281
- KEY_STRING: "name",
282
- KEY_LIST: [1, 2, 3],
283
- KEY_BOOL: true,
284
- KEY_DateTime: "2020-05-12 06:27:18.371"
285
- },
286
- eventId:'TA'
287
- })
288
- ```
289
-
290
- <!-- unsupported block: 34 -->
291
-
292
- 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.
293
-
294
- #### 2.3 Updatable Events
295
-
296
- 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.
297
-
298
- ```
299
- // Example: report updatable event, assuming event name is UPDATABLE_EVENT
300
- // After reporting, event property status is 3, price is 100
301
- TDAnalytics.trackUpdate({
302
- eventName:'UPDATABLE_EVENT',
303
- properties: { status: 3, price: 100},
304
- eventId:'test_event_id'
305
- })
306
- // After reporting, event property status is updated to 5, price remains unchanged
307
- TDAnalytics.trackUpdate({
308
- eventName:'UPDATABLE_EVENT',
309
- properties: { status: 5},
310
- eventId:'test_event_id'
311
- })
312
- ```
313
-
314
- #### 2.4 Overwritable Events
315
-
316
- 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.
317
-
318
- ```
319
- // Example: report overwritable event, assuming event name is OVERWRITE_EVENT
320
- // After reporting, event property status is 3, price is 100
321
- TDAnalytics.trackOverwrite({
322
- eventName:'OVERWRITE_EVENT',
323
- properties: { status: 3, price: 100},
324
- eventId:'test_event_id'
325
- })
326
- // After reporting, event property status is updated to 5, price property is deleted
327
- TDAnalytics.trackOverwrite({
328
- eventName:'OVERWRITE_EVENT',
329
- properties: { status: 5},
330
- eventId:'test_event_id'
331
- })
332
- ```
333
-
334
- #### 2.5 Common Event Properties
335
-
336
- 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`.
337
-
338
- ##### 2.5.1 Setting Static Common Event Properties
339
-
340
- 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.
341
-
342
- ```
343
- TDAnalytics.setSuperProperties({ vip_level: 2})
344
- ```
345
-
346
- Static common event properties will be saved to cache and don't need to be called every time the 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.
347
-
348
- ```
349
- //clear a common event property
350
- TDAnalytics.unsetSuperProperty("superKey")
351
- //clear all common event properties
352
- TDAnalytics.clearSuperProperties()
353
- //get all common event properties
354
- async () => {
355
- var properties = await TDAnalytics.getSuperProperties()
356
- }
357
- ```
358
-
359
- ##### 2.5.2 Setting Dynamic Common Event Properties
360
-
361
- Dynamic common event properties are high-frequency changing properties that every event will have, such as user's coin count. After setting dynamic common property class via `setDynamicSuperPropertiesTracker`, SDK will automatically get the properties from `getDynamicSuperProperties` when collecting events and add them to the triggered event.
362
-
363
- ```
364
- var coin = 0;
365
- TDAnalytics.setDynamicSuperProperties(function () {
366
- return { coin: coin++ }
367
- })
368
- ```
369
-
370
- #### 2.6 Recording Event Duration
371
-
372
- 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.
373
-
374
- ```
375
- //The following example completes the statistics of user staying time on a product page
376
- //User enters product page, start timing
377
- TDAnalytics.timeEvent("stay_shop")
378
- /**do someting
379
- .......
380
- **/
381
- //User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
382
- TDAnalytics.track({eventName:"stay_shop"})
383
- ```
384
-
385
- ### 3. User Properties
386
-
387
- TE platform currently supports the following user property setting interfaces: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`
388
-
389
- #### 4.1 userSet
390
-
391
- For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
392
-
393
- ```
394
- // username is TA
395
- TDAnalytics.userSet({ username: "TA" });
396
- //username is TE
397
- TDAnalytics.userSet({ username: "TE" });
398
- ```
399
-
400
- #### 4.2 userSetOnce
401
-
402
- If you want to upload a user property that only needs to be set once, you can call `userSetOnce` to set it. When the property already has a value, this information will be ignored. Here is an example of setting first payment time:
403
-
404
- ```
405
- //first_payment_time is 2018-01-01 01:23:45.678
406
- TDAnalytics.userSetOnce({first_payment_time: "2018-01-01 01:23:45.678" });
407
- //first_payment_time remains 2018-01-01 01:23:45.678
408
- TDAnalytics.userSetOnce({first_payment_time: "2018-12-31 01:23:45.678" });
409
- ```
410
-
411
- #### 4.3 userAdd
412
-
413
- 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. Here is an example of cumulative payment amount:
414
-
415
- ```
416
- //total_revenue is 30
417
- TDAnalytics.userAdd({ total_revenue: 30 });
418
- //total_revenue is 678
419
- TDAnalytics.userAdd({ total_revenue: 648 });
420
- ```
421
-
422
- <!-- unsupported block: 34 -->
423
-
424
- The property key must be a string, and Value must be a number.
425
-
426
- #### 4.4 userUnset
427
-
428
- When you want to clear a user's user property value, you can call `userUnset` to clear the specified property. If the property has not been created in the cluster, `userUnset` will **not** create the property
429
-
430
- ```
431
- TDAnalytics.userUnset("usersetkey")
432
- ```
433
-
434
- <!-- unsupported block: 34 -->
435
-
436
- userUnset parameter is the user property name, type is string or string array, supports variable-length parameter form.
437
-
438
- #### 4.5 userDelete
439
-
440
- 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.
441
-
442
- ```
443
- TDAnalytics.userDelete()
444
- ```
445
-
446
- #### 4.6 userAppend
447
-
448
- You can call `userAppend` to append elements to Array type user properties.
449
-
450
- ```
451
- TDAnalytics.userAppend({ user_list: ["apple", "ball"] });
452
- ```
453
-
454
- #### 4.7 userUniqAppend
455
-
456
- You can call `userUniqAppend` to append unique elements to Array (List) type user data. Calling `userUniqAppend` interface will deduplicate the appended user properties, `userAppend` interface does not deduplicate, user properties can have duplicates.
457
-
458
- ```
459
- //user_list property value is ["apple", "ball"]
460
- TDAnalytics.userAppend({ user_list: ["apple", "ball"] });
461
- //user_list property value is ["apple","apple","ball","cube"]
462
- TDAnalytics.userAppend({ user_list: ["apple", "cube"] });
463
- //user_list property value is ["apple", "ball","cube"]
464
- TDAnalytics.userUniqAppend({ user_list: ["apple", "cube"] });
465
- ```
466
-
467
- ### 4. Encryption Feature
468
-
469
- SDK supports encryption feature. Client supports AES + RSA to encrypt data, then server decrypts the data. Encryption and decryption capabilities need to be coordinated between client and server. Please consult customer success personnel for details.
470
-
471
- Set `enableEncrypt` property to true, and set default version number and public key.
472
-
473
- ```
474
- import TDAnalytics, { TDAutoTrackEventType,TDThirdPartyType,TDTrackStatus} from "react-native-thinking-data";
475
- TDAnalytics.init({
476
- appId: "xxx",
477
- serverUrl: "https://xxx",
478
- enableEncrypt: true,// enable data transmission encryption
479
- secretKey: {
480
- publicKey: "xxx",// encryption public key
481
- version: 1,// key version number
482
- symmetricEncryption: "AES",
483
- asymmetricEncryption: "RSA"
484
- }
485
- });
486
- ```
487
-
488
- ### 5. Enabling Integration with H5 Pages
489
-
490
- If you need to integrate with JavaScript SDK that collects H5 page data, please call the following interface. For details, please refer to H5 and APP SDK Integration section
491
-
492
- ```
493
- <WebView
494
- ref={webViewRef}
495
- source={localHtmlFile}
496
- onMessage={ event => {
497
- console.log(event.nativeEvent.data);
498
- TDAnalytics.h5ClickHandler(event.nativeEvent.data);
499
- }}
500
- javaScriptEnabled={true}
501
- injectedJavaScript='window.ThinkingData_APP_ReactNative_Bridge = function(data) { window.ReactNativeWebView.postMessage(data); };'
502
- />
503
- ```
504
-
505
- ### 6. Other Features
506
-
507
- #### 6.1 Getting Device ID
508
-
509
- You can call `getDeviceId` to get device ID:
510
-
511
- ```
512
- async () => {
513
- var device_id = await TDAnalytics.getDeviceId()
514
- }
515
- ```
516
-
517
- #### 6.2 Time Calibration
518
-
519
- 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.
520
-
521
- - 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.
522
-
523
- ```
524
- // 1585633785954 is current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
525
- TDAnalytics.calibrateTime(1585633785954);
526
- ```
527
-
528
- - 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.
529
-
530
- ```
531
- // Use Apple's NTP service for time calibration
532
- TDAnalytics.calibrateTimeWithNtp("time.apple.com");
533
- ```
534
-
535
- <!-- unsupported block: 34 -->
536
-
537
- 1. Using NTP service for time calibration has some uncertainty, we recommend you prefer using timestamp calibration method
538
-
539
- 2. You need to carefully choose your NTP server address to ensure that user devices can quickly get server time under good network conditions
540
-
541
- #### 6.3 Immediately Upload Data
542
-
543
- In certain business scenarios, if you expect data to be immediately uploaded to TE server, you can call `flush` interface
544
-
545
- ```
546
- TDAnalytics.flush();
547
- ```
548
-
549
- ---
550
-
551
- # Real-time Debugging
552
-
553
- During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
554
-
555
- ### 1. Printing SDK Logs
556
-
557
- You can set enableLog to true during SDK initialization to enable SDK log switch. After enabling, data uploaded will be printed in IDE console.
558
-
559
- ```
560
- TDAnalytics.init({
561
- appId: "xxx",
562
- serverUrl: "https://xxx",
563
- enableLog: true
564
- });
565
- ```
566
-
567
- <!-- unsupported block: 34 -->
568
-
569
- After enabling logs, you can filter ThinkingAnalytics related logs in IDE to observe SDK data reporting.
570
-
571
- ### 2. Enabling Debug Mode
572
-
573
- Enabling Debug mode requires two steps:
574
-
575
- 1. Enable Debug mode on client
576
- Here is sample code for enabling Debug mode on client:
577
-
578
- ```
579
- /*
580
- Set running mode to Debug mode
581
- normal mode: data will be cached and uploaded according to certain caching strategy, default is NORMAL mode; recommended for production environment
582
- debug mode: data is uploaded one by one. When problems occur, it will alert users via logs and exceptions; not recommended for production environment
583
- debugOnly mode: only validate data, will not store; not recommended for production environment
584
- */
585
- TDAnalytics.init({
586
- appId: "xxx",
587
- serverUrl: "https://xxx",
588
- mode:"debug"
589
- });
590
- ```
591
-
592
- 2. Add Debug device in TE backend
593
- 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.
594
-
595
- Device ID can be obtained through three ways:
596
-
597
- - #device_id property in event data on TE platform
598
- - Client log: Device DeviceId will be printed after SDK initialization completes
599
- - Instance interface call: Get Device ID
600
- <!-- unsupported block: 34 -->
601
-
602
- Debug mode may affect data collection quality and App stability, only use for integration stage data verification, do not use in production environment.
603
-
604
- ---
605
-
606
- # Auto-tracking
607
-
608
- ### 1. Enabling Auto-tracking Events
609
-
610
- You can call `enableAutoTrack` and pass a `TDAutoTrackEventType` type to enable auto-tracking. Currently supports six types:
611
-
612
- - `ta_app_start`: App enters foreground, corresponding type is `TDAutoTrackEventType.APP_START`
613
- - `ta_app_end`: App enters background, corresponding type is `TDAutoTrackEventType.APP_END`
614
- - `ta_app_install`: First open after installation, corresponding type is `TDAutoTrackEventType.APP_INSTALL`
615
- - `ta_app_crash`: App crashes due to uncaught exception, corresponding type is `TDAutoTrackEventType.APP_CRASH`
616
- - `ta_app_view`: Triggered when APP uses Navigator route navigation, corresponding type is `TDAutoTrackEventType.APP_VIEW_SCREEN` (supported in 3.2.0 and later versions)
617
- - `ta_app_click`: APP control click event triggered when user clicks control, corresponding type is `TDAutoTrackEventType.APP_CLICK` (supported in 3.2.0 and later versions)
618
- Notes about auto-tracking events:
619
-
620
- 1. Auto-tracking events are implemented in native SDK, so dynamic common properties currently cannot be added to auto-tracking events.
621
- 1. If you need to set visitor ID or common properties, please complete setting before enabling auto-tracking events.
622
- Sample code for enabling auto-tracking:
623
-
624
- ```
625
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_INSTALL| TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_CLICK | TDAutoTrackEventType.APP_VIEW_SCREEN);
626
- ```
627
-
628
- ### 2. Detailed Introduction
629
-
630
- #### 2.1 Page View Events
631
-
632
- App page view events support React Navigation ^2.0 ~ ^6.0
633
-
634
- Triggered when APP uses navigation route navigation. Detailed event introduction:
635
-
636
- - Event name: ta_app_view
637
- - Preset properties:
638
- `#screen_name`: string type, page name
639
-
640
- `#title`: string type, page title
641
-
642
- `#referrer`: string type, previous address
643
-
644
- - Enable method:
645
- - Call `enableAutoTrack`, pass `TDAutoTrackEventType.APP_VIEW_SCREEN`
646
-
647
- ```
648
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_VIEW_SCREEN);
649
- ```
650
-
651
- - Execute script
652
-
653
- ```
654
- node node_modules/react-native-thinking-data/ThinkingDataRNHook.js -run
655
- ```
656
-
657
- - Set page custom properties: When navigating via Navigation, you can add custom properties in params. SDK will automatically use the settings in params to supplement or overwrite App page view event properties.
658
-
659
- ```
660
- navigation.navigate('PageB', {
661
- thinkingdataparams: {
662
- name: 'name_A',
663
- '#title': 'Second Page',
664
- '#screen_name': "page_B"
665
- }
666
- });
667
- ```
668
-
669
- If you need to customize #title and #screen_name, you can pass them in thinkingdataparams parameter.
670
-
671
- - Ignore single page view event: When TDIgnoreViewScreen property with value true is added in thinkingdataparams, this page view event will be ignored
672
-
673
- ```
674
- navigation.navigate('PageB', {
675
- thinkingdataparams: {
676
- name: 'name_A',
677
- '#title': 'Second Page',
678
- '#screen_name': "page_B",
679
- TDIgnoreViewScreen: true
680
- }
681
- });
682
- ```
683
-
684
- #### 2.2 Element Click Events
685
-
686
- App element click events support React Native 0.23 ~ 0.70.0
687
-
688
- APP control click event triggered when user clicks control
689
-
690
- - Event name: ta_app_click
691
- - Preset properties:
692
- `#screen_name`: string type, page name
693
-
694
- `#title`: string type, page title
695
-
696
- `#element_content`: string type, element content
697
-
698
- - Enable method:
699
- - Call `enableAutoTrack`, pass `TDAutoTrackEventType.APP_CLICK`
700
-
701
- ```
702
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_CLICK);
703
- ```
704
-
705
- - Execute script:
706
-
707
- ```
708
- node node_modules/react-native-thinking-data/ThinkingDataRNHook.js -run
709
- ```
710
-
711
- - Set control custom properties: Add custom properties thinkingdataparams in control
712
-
713
- ```
714
- <CustomButton
715
- title="Button"
716
- thinkingdataparams={{
717
- name: 'button',
718
- pro_key:'pro_value'
719
- }}
720
- />
721
- ```
722
-
723
- - Ignore single control click event: When TDIgnoreViewClick property with value true is added in thinkingdataparams, this control click event will be ignored
724
-
725
- ```
726
- <CustomButton
727
- title="Button"
728
- thinkingdataparams={{
729
- name: 'button',
730
- pro_key:'pro_value'
731
- TDIgnoreViewClick: true
732
- }}
733
- />
734
- ```
735
-
736
- ### 3. Setting Auto-tracking Event Custom Properties
737
-
738
- You can call `enableAutoTrack` to set auto-tracking event properties
739
-
740
- ```
741
- TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START,{
742
- auto_name: "xxx",
743
- auto_age: "xxx"
744
- })
745
- ```
746
-
747
- ---
748
-
749
- # Preset Properties
750
-
751
- ### 1. Preset Properties Description
752
-
753
- Preset properties collected by iOS and Android platforms will have some differences. Please refer to the following documents:
754
-
755
- iOS platform preset properties, Android platform preset properties
756
-
757
- ### 2. Getting Preset Properties
758
-
759
- ```
760
- async () => {
761
- var presetProperties = await TDAnalytics.getPresetProperties()
762
- }
763
- ```