@thinkingai/ae-cli 6.0.61 → 6.0.63
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.
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/dist/{ai-monitor-NUKSJPLE.js → ai-monitor-X5GL44JT.js} +5 -5
- package/dist/ai-monitor.js +7 -7
- package/dist/{auth-MVAEBGBP.js → auth-SPQ46XQ3.js} +3 -3
- package/dist/{automation-6L6IAYRK.js → automation-7XC3VBZI.js} +85 -9
- package/dist/{capability-74N7AN5X.js → capability-JZP4KXZC.js} +3 -3
- package/dist/{chunk-SVNED423.js → chunk-2VKMHNUU.js} +4 -4
- package/dist/{chunk-JZY6WWAP.js → chunk-6HOM2FOJ.js} +10 -1
- package/dist/{chunk-COOMXFUG.js → chunk-AAN6KBUK.js} +2 -2
- package/dist/{chunk-H35VDOAE.js → chunk-E457FREE.js} +2 -2
- package/dist/{chunk-VLOGOM7N.js → chunk-ETQXIZFP.js} +2 -1
- package/dist/{chunk-XZDKAR4N.js → chunk-F36ORPI6.js} +3 -28
- package/dist/{chunk-7WBCSJL6.js → chunk-F7TCQPQX.js} +1 -1
- package/dist/{chunk-HRFYYEXR.js → chunk-FGGEF7MI.js} +2 -2
- package/dist/chunk-N2MAYIRU.js +32 -0
- package/dist/{chunk-RB26WNLM.js → chunk-PRCHMOWT.js} +1 -1
- package/dist/{chunk-LPKIMGIU.js → chunk-RYY5NJK3.js} +2 -2
- package/dist/{chunk-OTZ4JQDU.js → chunk-VR2D54AA.js} +1 -1
- package/dist/{chunk-THTROEGD.js → chunk-YIG3L4RC.js} +1 -1
- package/dist/{chunk-XPARQSYS.js → chunk-YJYC5PLL.js} +2 -3
- package/dist/{chunk-HIMOBNEY.js → chunk-ZVUXAHEV.js} +1 -1
- package/dist/{compat-check-W4XC27RG.js → compat-check-JD5D77ET.js} +1 -1
- package/dist/{config-264GB6C7.js → config-IIMRATTP.js} +3 -3
- package/dist/{context-SOQDFZIB.js → context-BXHIPIIX.js} +1 -1
- package/dist/{data-integration-UNJ7EPW2.js → data-integration-VRJQ3HVK.js} +2 -1
- package/dist/index.js +33 -31
- package/dist/{memory-ZLTTULZK.js → memory-B44LY27L.js} +3 -3
- package/dist/{metadata-EN2IWCDI.js → metadata-ZVPG2MIA.js} +5 -5
- package/dist/{model-NAKQWK4W.js → model-ANZBYVST.js} +1 -1
- package/dist/{personal-semantic-preference-UGN67KTN.js → personal-semantic-preference-YNCV4QG3.js} +4 -4
- package/dist/{project-semantic-5OP3YPZD.js → project-semantic-E7ZAQL5S.js} +4 -4
- package/dist/{sync-LDJQZRQH.js → sync-Y4OZRQAY.js} +3 -3
- package/dist/{te-agent-WNNAD4AJ.js → te-agent-RKAUTYJZ.js} +4 -4
- package/dist/{te-analysis-KIMH6AGU.js → te-analysis-7N5VC4JB.js} +5 -5
- package/dist/{te-community-P7NNBVCS.js → te-community-SIA2UHTS.js} +4 -4
- package/dist/{te-dataops-ZRKSG4R7.js → te-dataops-5MJQCODU.js} +2 -2
- package/dist/{te-engage-PVBVNRSU.js → te-engage-ZTLOMKO3.js} +68 -16
- package/dist/{te-kb-W7PRC7QN.js → te-kb-LDL3MF2Y.js} +44 -13
- package/dist/{te-system-F4ZU2HRQ.js → te-system-473I5O53.js} +1 -1
- package/dist/{te-team-5ONMRGKF.js → te-team-JOWHCMZA.js} +87 -6
- package/dist/{things-PFENSIF4.js → things-DOQ2L3O2.js} +4 -4
- package/dist/{update-EUZ4GNND.js → update-KUS6TCPB.js} +2 -2
- package/dist/{workspace-Z7L33OBQ.js → workspace-MJFPIV7C.js} +3 -3
- package/package.json +3 -3
- package/skills/ae-automation/SKILL.md +6 -2
- package/skills/ae-automation/references/cli.md +9 -3
- package/skills/ae-engage/SKILL.md +6 -1
- package/skills/ae-engage/references/common-metric.md +47 -1
- package/skills/ae-engage/references/flow-metric-update.md +1 -1
- package/skills/ae-engage/references/task-metric-update.md +1 -1
- package/skills/ae-kb/SKILL.md +8 -6
- package/skills/ae-kb/references/query-workflow.md +5 -1
- package/skills/ae-team/SKILL.md +7 -3
- package/skills/ae-team/references/copy-to-personal.md +7 -0
- package/skills/ae-team/references/promote.md +7 -0
- package/skills/ae-team/references/update.md +3 -3
- package/skills/ae-tracking-matrix/SKILL.md +0 -170
- package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
- package/skills/ae-tracking-matrix/i18n.yaml +0 -12
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
- package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
- package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
- package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
- package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
- package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
- package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
- package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
- package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
- package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
- package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
- package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
- package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
|
@@ -1,1369 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
code: macos_sdk_installation
|
|
3
|
-
name: "macOS"
|
|
4
|
-
wikiToken: FNr7wvZGCiD2nEkoGzWcUEXOn0g
|
|
5
|
-
parentWikiToken: FTcTwinIOi3OiRkK4MPc2Ex7neg
|
|
6
|
-
updateTime: 1745310913000
|
|
7
|
-
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=macos_sdk_installation
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# macOS
|
|
11
|
-
|
|
12
|
-
::: tip Tip
|
|
13
|
-
|
|
14
|
-
Before integration, please read the pre-installation preparation first.
|
|
15
|
-
|
|
16
|
-
macOS SDK requires minimum system version OSX 10.11
|
|
17
|
-
|
|
18
|
-
:::
|
|
19
|
-
|
|
20
|
-
**Latest Version: **v3.0.4
|
|
21
|
-
|
|
22
|
-
**Update Time:** 2024-08-01
|
|
23
|
-
|
|
24
|
-
**Resource Download: **Source code
|
|
25
|
-
|
|
26
|
-
**Beta Version: **v3.0.5-beta.1
|
|
27
|
-
|
|
28
|
-
::: tip Note
|
|
29
|
-
|
|
30
|
-
iOS SDK from v3.0.0 version has adapted to macOS platform
|
|
31
|
-
|
|
32
|
-
:::
|
|
33
|
-
|
|
34
|
-
### 1. SDK Integration
|
|
35
|
-
|
|
36
|
-
Use CocoaPods to install SDK
|
|
37
|
-
|
|
38
|
-
1.Create and edit Podfile content (if exists, edit directly):
|
|
39
|
-
|
|
40
|
-
Create Podfile, execute command in command line under project (.xcodeproj) file directory:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
pod init
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Edit Podfile content as follows:
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
platform :osx, '10.10'
|
|
50
|
-
target 'YourProjectTarget' do
|
|
51
|
-
pod 'ThinkingSDK'
|
|
52
|
-
end
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2.Execute installation command
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
pod install
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
3.Import successfully, start project
|
|
62
|
-
|
|
63
|
-
After command executes successfully, `.xcworkspace` file will be generated, indicating you have successfully imported `SDK`. Open `.xcworkspace` file to start project (Note: Cannot open `.xcodeproj` file simultaneously)
|
|
64
|
-
|
|
65
|
-
### 2. Initialization
|
|
66
|
-
|
|
67
|
-
Complete initialization operation in main thread. Sample code as follows:
|
|
68
|
-
|
|
69
|
-
:::: el-tabs
|
|
70
|
-
|
|
71
|
-
::: el-tab-pane label=Objective-C
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
#import <ThinkingSDK/ThinkingSDK.h>
|
|
75
|
-
|
|
76
|
-
// SDK needs to be initialized on the main thread
|
|
77
|
-
|
|
78
|
-
NSString *appid = @"APPID";
|
|
79
|
-
NSString *url = @"SERVER_URL";
|
|
80
|
-
|
|
81
|
-
// the first way
|
|
82
|
-
[TDAnalytics startAnalyticsWithAppId:appid serverUrl:url];
|
|
83
|
-
|
|
84
|
-
// the second way
|
|
85
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
86
|
-
config.appid = appid;
|
|
87
|
-
config.serverUrl = url;
|
|
88
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
:::
|
|
92
|
-
|
|
93
|
-
::: el-tab-pane label=Swift
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
// SDK needs to be initialized on the main thread
|
|
97
|
-
|
|
98
|
-
**let** appid = "APPID";
|
|
99
|
-
**let** url = "SERVER_URL";
|
|
100
|
-
|
|
101
|
-
// the first way
|
|
102
|
-
TDAnalytics.start(withAppId: appid, serverUrl: url)
|
|
103
|
-
|
|
104
|
-
// the second way
|
|
105
|
-
**let** config = TDConfig(appId: appid, serverUrl: url)
|
|
106
|
-
TDAnalytics.start(with: config)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
:::
|
|
110
|
-
|
|
111
|
-
::::
|
|
112
|
-
|
|
113
|
-
Parameter Description:
|
|
114
|
-
|
|
115
|
-
- `APPID`: Your project's APPID, can be obtained from TE backend project management page
|
|
116
|
-
- `SERVER_URL`: Data upload URL
|
|
117
|
-
- If you are using cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
118
|
-
- If you are using private deployment version, please bind domain to data collection address and configure HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
|
|
119
|
-
|
|
120
|
-
### 3. Common Features
|
|
121
|
-
|
|
122
|
-
Before using common features, we recommend you first understand the user identification rules. SDK will generate random number as visitor ID by default and persistently store it locally. Before user login, visitor ID will be used as identity identification ID. Note: Visitor ID will change when user reinstalls App or changes device.
|
|
123
|
-
|
|
124
|
-
#### 3.1 Setting Account ID
|
|
125
|
-
|
|
126
|
-
When user logs in, you can call `login:` to set user's account ID. TE platform will use account ID as identity identification ID, and the set account ID will be retained until `logout` is called. Multiple calls to `login:` will overwrite the previous account ID.
|
|
127
|
-
|
|
128
|
-
:::: el-tabs
|
|
129
|
-
|
|
130
|
-
::: el-tab-pane label=Objective-C
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
// User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TD
|
|
134
|
-
[TDAnalytics login:@"TD"];
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
:::
|
|
138
|
-
|
|
139
|
-
::: el-tab-pane label=Swift
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
// User's login unique identifier, this data corresponds to #account_id in reported data, now #account_id value is TD
|
|
143
|
-
TDAnalytics.login("TD")
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
:::
|
|
147
|
-
|
|
148
|
-
::::
|
|
149
|
-
|
|
150
|
-
<!-- unsupported block: 34 -->
|
|
151
|
-
|
|
152
|
-
**This method will not upload login event**
|
|
153
|
-
|
|
154
|
-
#### 3.2 Setting Common Event Properties
|
|
155
|
-
|
|
156
|
-
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.
|
|
157
|
-
|
|
158
|
-
:::: el-tabs
|
|
159
|
-
|
|
160
|
-
::: el-tab-pane label=Objective-C
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
NSDictionary *superProperties = @{
|
|
164
|
-
@"channel": @"ta",
|
|
165
|
-
@"age": @1,
|
|
166
|
-
@"isSuccess": @YES,
|
|
167
|
-
@"birthday": [NSDate date],
|
|
168
|
-
@"object": @{
|
|
169
|
-
@"key":@"value"
|
|
170
|
-
},
|
|
171
|
-
@"object_arr":@[
|
|
172
|
-
@{
|
|
173
|
-
@"key":@"value"
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
@"arr": @[@"value"],
|
|
177
|
-
};
|
|
178
|
-
[TDAnalytics setSuperProperties:superProperties];
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
:::
|
|
182
|
-
|
|
183
|
-
::: el-tab-pane label=Swift
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
var superProperties: [AnyHashable : Any] = [:]
|
|
187
|
-
superProperties["channel"] = "ta" //string
|
|
188
|
-
superProperties["age"] = 1 //number
|
|
189
|
-
superProperties["isSuccess"] = true //boolean
|
|
190
|
-
superProperties["birthday"] = Date() //time
|
|
191
|
-
superProperties["object"] = [
|
|
192
|
-
"key": "value"
|
|
193
|
-
] //object
|
|
194
|
-
superProperties["object_arr"] = [["key": "value"]] // object array
|
|
195
|
-
superProperties["arr"] = ["value"] // array
|
|
196
|
-
|
|
197
|
-
//set common event properties
|
|
198
|
-
TDAnalytics.setSuperProperties(superProperties)
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
:::
|
|
202
|
-
|
|
203
|
-
::::
|
|
204
|
-
|
|
205
|
-
Common event properties will be saved to cache and don't need to be called every time App starts. If `setSuperProperties:` is called to set a previously set common event property, it will overwrite the previous property.
|
|
206
|
-
|
|
207
|
-
- Event property is a `NSDictionary` object, where each element represents a property.
|
|
208
|
-
- 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
|
|
209
|
-
- Value is the property value, supports string, number, boolean, time, object, object array, array
|
|
210
|
-
- If you need to upload boolean properties, please use `@YES` and `@NO` or `[NSNumber numberWithBool:YES]` and `[NSNumber numberWithBool:NO]` to assign values. **Cannot use** `@true`, `@false`, `@TRUE` and `@FALSE` to assign boolean data.
|
|
211
|
-
<!-- unsupported block: 34 -->
|
|
212
|
-
|
|
213
|
-
**Event property and user property requirements are consistent with common event properties**
|
|
214
|
-
|
|
215
|
-
#### 3.3 Sending Events
|
|
216
|
-
|
|
217
|
-
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:
|
|
218
|
-
|
|
219
|
-
:::: el-tabs
|
|
220
|
-
|
|
221
|
-
::: el-tab-pane label=Objective-C
|
|
222
|
-
|
|
223
|
-
```
|
|
224
|
-
// Upload product purchase event
|
|
225
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
226
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
:::
|
|
230
|
-
|
|
231
|
-
::: el-tab-pane label=Swift
|
|
232
|
-
|
|
233
|
-
```
|
|
234
|
-
// Upload product purchase event
|
|
235
|
-
**let** properties = ["product_name": "book"] **as** [String: **Any**]
|
|
236
|
-
TDAnalytics.track("product_buy", properties: properties)
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
:::
|
|
240
|
-
|
|
241
|
-
::::
|
|
242
|
-
|
|
243
|
-
Event name is string type, must start with a letter, can contain numbers, letters and underscore "\_", maximum 50 characters.
|
|
244
|
-
|
|
245
|
-
#### 3.4 Setting User Properties
|
|
246
|
-
|
|
247
|
-
For general user properties, you can call `user_set:` 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:
|
|
248
|
-
|
|
249
|
-
:::: el-tabs
|
|
250
|
-
|
|
251
|
-
::: el-tab-pane label=Objective-C
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
// "username" is "ThinkingData"
|
|
255
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
256
|
-
// "username" is "TA"
|
|
257
|
-
[TDAnalytics userSet:@{@"username": @"TA"}];
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
:::
|
|
261
|
-
|
|
262
|
-
::: el-tab-pane label=Swift
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
// Set user properties
|
|
266
|
-
//now "username" is "ThinkingData"
|
|
267
|
-
TDAnalytics.userSet(["usernaame": "ThinkingData"])
|
|
268
|
-
//now "username" is "TA"
|
|
269
|
-
TDAnalytics.userSet(["usernaame": "TA"])
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
:::
|
|
273
|
-
|
|
274
|
-
::::
|
|
275
|
-
|
|
276
|
-
### 4. Best Practices
|
|
277
|
-
|
|
278
|
-
The following sample code includes all the above operations. We recommend using the following steps:
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
if (privacy policy authorized) {
|
|
282
|
-
// enable log
|
|
283
|
-
[TDAnalytics enableLog:NO];
|
|
284
|
-
|
|
285
|
-
// SDK needs to be initialized on the main thread
|
|
286
|
-
NSString *appid = @"APPID";
|
|
287
|
-
NSString *url = @"SERVER_URL";
|
|
288
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
289
|
-
config.appid = appid;
|
|
290
|
-
config.serverUrl = url;
|
|
291
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
292
|
-
|
|
293
|
-
[TDAnalytics login:@"TD"];
|
|
294
|
-
|
|
295
|
-
NSDictionary *superProperties = @{
|
|
296
|
-
@"channel": @"ta",
|
|
297
|
-
@"age": @1,
|
|
298
|
-
@"isSuccess": @YES,
|
|
299
|
-
@"birthday": [NSDate date],
|
|
300
|
-
@"object": @{
|
|
301
|
-
@"key":@"value"
|
|
302
|
-
},
|
|
303
|
-
@"object_arr":@[
|
|
304
|
-
@{
|
|
305
|
-
@"key":@"value"
|
|
306
|
-
}
|
|
307
|
-
],
|
|
308
|
-
@"arr": @[@"value"],
|
|
309
|
-
};
|
|
310
|
-
[TDAnalytics setSuperProperties:superProperties];
|
|
311
|
-
|
|
312
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
313
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
314
|
-
|
|
315
|
-
// "username" is "ThinkingData"
|
|
316
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
---
|
|
322
|
-
|
|
323
|
-
# Advanced Guide
|
|
324
|
-
|
|
325
|
-
### 1. Setting User ID
|
|
326
|
-
|
|
327
|
-
SDK instance will use `DeviceID_InstallCount` as the default visitor ID for each user by default. This visitor 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.
|
|
328
|
-
|
|
329
|
-
#### 1.1 Setting Visitor ID
|
|
330
|
-
|
|
331
|
-
::: tip Tip
|
|
332
|
-
|
|
333
|
-
Generally, you don't need to customize visitor ID. Please make sure you understand the user identification rules before setting visitor ID.
|
|
334
|
-
|
|
335
|
-
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.
|
|
336
|
-
|
|
337
|
-
:::
|
|
338
|
-
|
|
339
|
-
If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set visitor ID:
|
|
340
|
-
|
|
341
|
-
:::: el-tabs
|
|
342
|
-
|
|
343
|
-
::: el-tab-pane label=Objective-C
|
|
344
|
-
|
|
345
|
-
```
|
|
346
|
-
[TDAnalytics setDistinctId:@"Thinker"];
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
:::
|
|
350
|
-
|
|
351
|
-
::: el-tab-pane label=Swift
|
|
352
|
-
|
|
353
|
-
```
|
|
354
|
-
TDAnalytics.setDistinctId("Thinker")
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
:::
|
|
358
|
-
|
|
359
|
-
::::
|
|
360
|
-
|
|
361
|
-
If you need to get the current visitor ID, you can call `getDistinctId`:
|
|
362
|
-
|
|
363
|
-
:::: el-tabs
|
|
364
|
-
|
|
365
|
-
::: el-tab-pane label=Objective-C
|
|
366
|
-
|
|
367
|
-
```
|
|
368
|
-
NSString *distinctId = [TDAnalytics getDistinctId];
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
:::
|
|
372
|
-
|
|
373
|
-
::: el-tab-pane label=Swift
|
|
374
|
-
|
|
375
|
-
```
|
|
376
|
-
let distinctId = TDAnalytics.getDistinctId()
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
:::
|
|
380
|
-
|
|
381
|
-
::::
|
|
382
|
-
|
|
383
|
-
#### 1.2 Setting Account ID
|
|
384
|
-
|
|
385
|
-
When user logs in, you can call `login` to set user's account ID. TE platform will use account ID as identity identification ID, and the set account ID will be retained until `logout` is called. Multiple calls to `login` will overwrite the previous account ID.
|
|
386
|
-
|
|
387
|
-
:::: el-tabs
|
|
388
|
-
|
|
389
|
-
::: el-tab-pane label=Objective-C
|
|
390
|
-
|
|
391
|
-
```
|
|
392
|
-
[TDAnalytics login:@"TD"];
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
:::
|
|
396
|
-
|
|
397
|
-
::: el-tab-pane label=Swift
|
|
398
|
-
|
|
399
|
-
```
|
|
400
|
-
TDAnalytics.login("TD")
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
:::
|
|
404
|
-
|
|
405
|
-
::::
|
|
406
|
-
|
|
407
|
-
<!-- unsupported block: 34 -->
|
|
408
|
-
|
|
409
|
-
**This method will not upload login event**
|
|
410
|
-
|
|
411
|
-
#### 1.3 Clearing Account ID
|
|
412
|
-
|
|
413
|
-
After user logs out, you can call `logout` to clear account ID. Before the next `login` call, visitor ID will be used as identity identification ID.
|
|
414
|
-
|
|
415
|
-
:::: el-tabs
|
|
416
|
-
|
|
417
|
-
::: el-tab-pane label=Objective-C
|
|
418
|
-
|
|
419
|
-
```
|
|
420
|
-
[TDAnalytics logout];
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
:::
|
|
424
|
-
|
|
425
|
-
::: el-tab-pane label=Swift
|
|
426
|
-
|
|
427
|
-
```
|
|
428
|
-
TDAnalytics.logout()
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
:::
|
|
432
|
-
|
|
433
|
-
::::
|
|
434
|
-
|
|
435
|
-
We recommend you call `logout` at explicit logout events, such as when user performs account deregistration action, rather than when closing App.
|
|
436
|
-
|
|
437
|
-
<!-- unsupported block: 34 -->
|
|
438
|
-
|
|
439
|
-
**This method will not upload logout event**
|
|
440
|
-
|
|
441
|
-
### 2. Sending Events
|
|
442
|
-
|
|
443
|
-
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.
|
|
444
|
-
|
|
445
|
-
#### 2.1 Regular Events
|
|
446
|
-
|
|
447
|
-
You can call `track` to upload events. We recommend you set event properties and sending conditions according to your previously prepared document. Here is an example of user purchasing a product:
|
|
448
|
-
|
|
449
|
-
:::: el-tabs
|
|
450
|
-
|
|
451
|
-
::: el-tab-pane label=Objective-C
|
|
452
|
-
|
|
453
|
-
```
|
|
454
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
455
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
:::
|
|
459
|
-
|
|
460
|
-
::: el-tab-pane label=Swift
|
|
461
|
-
|
|
462
|
-
```
|
|
463
|
-
let properties = ["product_name": "book"] as [String: Any]
|
|
464
|
-
TDAnalytics.track("product_buy", properties: properties)
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
#### 2.2 First-time Events
|
|
468
|
-
|
|
469
|
-
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.
|
|
470
|
-
|
|
471
|
-
:::: el-tabs
|
|
472
|
-
|
|
473
|
-
::: el-tab-pane label=Objective-C
|
|
474
|
-
|
|
475
|
-
```
|
|
476
|
-
TDFirstEventModel *firstModel = [[TDFirstEventModel alloc] initWithEventName:@"device_activation"];
|
|
477
|
-
firstModel.properties = @{@"key":@"value"};
|
|
478
|
-
[TDAnalytics trackWithEventModel:firstModel];
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
:::
|
|
482
|
-
|
|
483
|
-
::: el-tab-pane label=Swift
|
|
484
|
-
|
|
485
|
-
```
|
|
486
|
-
let firstModel = TDFirstEventModel(eventName:"device_activation")
|
|
487
|
-
firstModel.properties = ["KEY": "VALUE"]
|
|
488
|
-
TDAnalytics.track(with: firstModel)
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
:::
|
|
492
|
-
|
|
493
|
-
::::
|
|
494
|
-
|
|
495
|
-
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:
|
|
496
|
-
|
|
497
|
-
:::: el-tabs
|
|
498
|
-
|
|
499
|
-
::: el-tab-pane label=Objective-C
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
TDFirstEventModel *firstModel = [[TDFirstEventModel alloc] initWithEventName:@"device_activation" firstCheckID:@"TD"];
|
|
503
|
-
firstModel.properties = @{@"key":@"value"};
|
|
504
|
-
[TDAnalytics trackWithEventModel:firstModel];
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
:::
|
|
508
|
-
|
|
509
|
-
::: el-tab-pane label=Swift
|
|
510
|
-
|
|
511
|
-
```
|
|
512
|
-
let firstModel = TDFirstEventModel(eventName:"device_activation", firstCheckID:"TD")
|
|
513
|
-
firstModel.properties = ["KEY": "VALUE"]
|
|
514
|
-
TDAnalytics.track(with: firstModel)
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
:::
|
|
518
|
-
|
|
519
|
-
::::
|
|
520
|
-
|
|
521
|
-
<!-- unsupported block: 34 -->
|
|
522
|
-
|
|
523
|
-
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.
|
|
524
|
-
|
|
525
|
-
#### 2.3 Updatable Events
|
|
526
|
-
|
|
527
|
-
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.
|
|
528
|
-
|
|
529
|
-
:::: el-tabs
|
|
530
|
-
|
|
531
|
-
::: el-tab-pane label=Objective-C
|
|
532
|
-
|
|
533
|
-
```
|
|
534
|
-
// Example: report updatable event, assuming event name is UPDATABLE_EVENT
|
|
535
|
-
// After reporting, event property status is 3, price is 100
|
|
536
|
-
TDUpdateEventModel *updateModel = [[TDUpdateEventModel alloc] initWithEventName:@"UPDATABLE_EVENT" eventID:@"test_event_id"];
|
|
537
|
-
updateModel.properties = @{@"status": @3, @"price": @100};
|
|
538
|
-
[TDAnalytics trackWithEventModel:updateModel];
|
|
539
|
-
|
|
540
|
-
// After reporting, event property status is updated to 5, price remains unchanged
|
|
541
|
-
TDUpdateEventModel *updateModelNew = [[TDUpdateEventModel alloc] initWithEventName:@"UPDATABLE_EVENT" eventID:@"test_event_id"];
|
|
542
|
-
updateModelNew.properties = @{@"status": @5};
|
|
543
|
-
[TDAnalytics trackWithEventModel:updateModelNew];
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
:::
|
|
547
|
-
|
|
548
|
-
::: el-tab-pane label=Swift
|
|
549
|
-
|
|
550
|
-
```
|
|
551
|
-
// Example: report updatable event, assuming event name is UPDATABLE_EVENT
|
|
552
|
-
// After reporting, event property status is 3, price is 100
|
|
553
|
-
let updateModel = TDUpdateEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
554
|
-
updateModel.properties = ["status": 3, "price": 100]
|
|
555
|
-
TDAnalytics.track(with: updateModel)
|
|
556
|
-
|
|
557
|
-
// After reporting, event property status is 5, price remains unchanged
|
|
558
|
-
let updateModel_new = TDUpdateEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
559
|
-
updateModel_new.properties = ["status": 5]
|
|
560
|
-
TDAnalytics.track(with: updateModel_new)
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
:::
|
|
564
|
-
|
|
565
|
-
::::
|
|
566
|
-
|
|
567
|
-
#### 2.4 Overwritable Events
|
|
568
|
-
|
|
569
|
-
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.
|
|
570
|
-
|
|
571
|
-
:::: el-tabs
|
|
572
|
-
|
|
573
|
-
::: el-tab-pane label=Objective-C
|
|
574
|
-
|
|
575
|
-
```
|
|
576
|
-
// Example: report overwritable event, assuming event name is OVERWRITE_EVENT
|
|
577
|
-
// After reporting, event property status is 3, price is 100
|
|
578
|
-
TDOverwriteEventModel *overwriteModel = [[TDOverwriteEventModel alloc] initWithEventName:@"OVERWRITE_EVENT" eventID:@"test_event_id"];
|
|
579
|
-
overwriteModel.properties = @{@"status": @3, @"price": @100};
|
|
580
|
-
[TDAnalytics trackWithEventModel:overwriteModel];
|
|
581
|
-
|
|
582
|
-
// After reporting, event property status is 5, price property is deleted
|
|
583
|
-
TDOverwriteEventModel *overwriteModel_new = [[TDOverwriteEventModel alloc] initWithEventName:@"OVERWRITE_EVENT" eventID:@"test_event_id"];
|
|
584
|
-
overwriteModel_new.properties = @{@"status": @5};
|
|
585
|
-
[TDAnalytics trackWithEventModel:overwriteModel_new];
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
:::
|
|
589
|
-
|
|
590
|
-
::: el-tab-pane label=Swift
|
|
591
|
-
|
|
592
|
-
```
|
|
593
|
-
// Example: report overwritable event, assuming event name is OVERWRITE_EVENT
|
|
594
|
-
// After reporting, event property status is 3, price is 100
|
|
595
|
-
let overwriteModel = TDOverwriteEventModel(eventName: "OVERWRITE_EVENT", eventID: "test_event_id")
|
|
596
|
-
overwriteModel.properties = ["status": 3, "price": 100]
|
|
597
|
-
TDAnalytics.track(with: overwriteModel)
|
|
598
|
-
|
|
599
|
-
// After reporting, event property status is 5, price is deleted
|
|
600
|
-
let overwriteModel_new = TDOverwriteEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
601
|
-
overwriteModel_new.properties = ["status": 5]
|
|
602
|
-
TDAnalytics.track(with: overwriteModel_new)
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
:::
|
|
606
|
-
|
|
607
|
-
::::
|
|
608
|
-
|
|
609
|
-
### 2.5 Common Event Properties
|
|
610
|
-
|
|
611
|
-
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`.
|
|
612
|
-
|
|
613
|
-
#### 2.5.1 Static Common Event Properties
|
|
614
|
-
|
|
615
|
-
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.
|
|
616
|
-
|
|
617
|
-
:::: el-tabs
|
|
618
|
-
|
|
619
|
-
::: el-tab-pane label=Objective-C
|
|
620
|
-
|
|
621
|
-
```
|
|
622
|
-
[TDAnalytics setSuperProperties:@{@"vip_level": @(2)}];
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
:::
|
|
626
|
-
|
|
627
|
-
::: el-tab-pane label=Swift
|
|
628
|
-
|
|
629
|
-
```
|
|
630
|
-
TDAnalytics.setSuperProperties(["vip_level" : 2])
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
:::
|
|
634
|
-
|
|
635
|
-
::::
|
|
636
|
-
|
|
637
|
-
Static common event properties will be saved to cache and don't need to be called every time App starts. If the property already exists, the newly set property will overwrite the original property value; if the property did not exist before, it will create a new property. Besides property setting, we also provide other APIs to operate static common event properties to meet daily business needs.
|
|
638
|
-
|
|
639
|
-
:::: el-tabs
|
|
640
|
-
|
|
641
|
-
::: el-tab-pane label=Objective-C
|
|
642
|
-
|
|
643
|
-
```
|
|
644
|
-
// Clear a common event property, clear previously set "isTest" property
|
|
645
|
-
[TDAnalytics unsetSuperProperty:@"isTest"];
|
|
646
|
-
|
|
647
|
-
// Clear all common event properties
|
|
648
|
-
[TDAnalytics clearSuperProperties];
|
|
649
|
-
|
|
650
|
-
//Get all common properties
|
|
651
|
-
[TDAnalytics getSuperProperties];
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
:::
|
|
655
|
-
|
|
656
|
-
::: el-tab-pane label=Swift
|
|
657
|
-
|
|
658
|
-
```
|
|
659
|
-
// Clear a common event property, clear previously set "isTest" property
|
|
660
|
-
TDAnalytics.unsetSuperProperty("isTest")
|
|
661
|
-
|
|
662
|
-
// Clear all common event properties
|
|
663
|
-
TDAnalytics.clearSuperProperties()
|
|
664
|
-
|
|
665
|
-
// Get all common properties
|
|
666
|
-
TDAnalytics.getSuperProperties()
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
:::
|
|
670
|
-
|
|
671
|
-
::::
|
|
672
|
-
|
|
673
|
-
#### 2.5.2 Dynamic Common Event Properties
|
|
674
|
-
|
|
675
|
-
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 `setDynamicSuperProperties`, SDK will get dynamic common properties when collecting events and add them to the triggered event.
|
|
676
|
-
|
|
677
|
-
:::: el-tabs
|
|
678
|
-
|
|
679
|
-
::: el-tab-pane label=Objective-C
|
|
680
|
-
|
|
681
|
-
```
|
|
682
|
-
// Set dynamic common property, dynamically get event occurrence time when event is reported
|
|
683
|
-
[TDAnalytics setDynamicSuperProperties:^NSDictionary * _Nonnull{
|
|
684
|
-
return @{@"now": [NSDate date]};
|
|
685
|
-
}];
|
|
686
|
-
```
|
|
687
|
-
|
|
688
|
-
:::
|
|
689
|
-
|
|
690
|
-
::: el-tab-pane label=Swift
|
|
691
|
-
|
|
692
|
-
```
|
|
693
|
-
// Set dynamic common property, dynamically get event occurrence time when event is reported
|
|
694
|
-
TDAnalytics.setDynamicSuperProperties{ () -> [String : Any] in
|
|
695
|
-
return ["now": Date()]
|
|
696
|
-
}
|
|
697
|
-
```
|
|
698
|
-
|
|
699
|
-
:::
|
|
700
|
-
|
|
701
|
-
::::
|
|
702
|
-
|
|
703
|
-
### 2.6 Recording Event Duration
|
|
704
|
-
|
|
705
|
-
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.
|
|
706
|
-
|
|
707
|
-
:::: el-tabs
|
|
708
|
-
|
|
709
|
-
::: el-tab-pane label=Objective-C
|
|
710
|
-
|
|
711
|
-
```
|
|
712
|
-
// The following example completes the statistics of user staying time on a product page
|
|
713
|
-
[TDAnalytics timeEvent:@"stay_shop"];
|
|
714
|
-
/*
|
|
715
|
-
do someting .......
|
|
716
|
-
*/
|
|
717
|
-
// User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
718
|
-
[TDAnalytics track:@"stay_shop"];
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
:::
|
|
722
|
-
|
|
723
|
-
::: el-tab-pane label=Swift
|
|
724
|
-
|
|
725
|
-
```
|
|
726
|
-
//The following example completes the statistics of user staying time on a product page
|
|
727
|
-
TDAnalytics.timeEvent("stay_shop")
|
|
728
|
-
/*
|
|
729
|
-
do someting .......
|
|
730
|
-
*/
|
|
731
|
-
//User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
732
|
-
TDAnalytics.track("stay_shop")
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
:::
|
|
736
|
-
|
|
737
|
-
::::
|
|
738
|
-
|
|
739
|
-
### 3. User Properties
|
|
740
|
-
|
|
741
|
-
TE platform supports the following user property setting APIs: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`.
|
|
742
|
-
|
|
743
|
-
#### 3.1 userSet
|
|
744
|
-
|
|
745
|
-
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:
|
|
746
|
-
|
|
747
|
-
:::: el-tabs
|
|
748
|
-
|
|
749
|
-
::: el-tab-pane label=Objective-C
|
|
750
|
-
|
|
751
|
-
```
|
|
752
|
-
//now "username" is "ThinkingData"
|
|
753
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
754
|
-
//now "username" is "TA"
|
|
755
|
-
[TDAnalytics userSet:@{@"username": @"TA"}];
|
|
756
|
-
```
|
|
757
|
-
|
|
758
|
-
:::
|
|
759
|
-
|
|
760
|
-
::: el-tab-pane label=Swift
|
|
761
|
-
|
|
762
|
-
```
|
|
763
|
-
// Set user properties
|
|
764
|
-
//now "username" is "ThinkingData"
|
|
765
|
-
TDAnalytics.userSet(["username": "ThinkingData"])
|
|
766
|
-
//now "username" is "TA"
|
|
767
|
-
TDAnalytics.userSet(["username": "TA"])
|
|
768
|
-
```
|
|
769
|
-
|
|
770
|
-
:::
|
|
771
|
-
|
|
772
|
-
::::
|
|
773
|
-
|
|
774
|
-
#### 3.2 userSetOnce
|
|
775
|
-
|
|
776
|
-
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:
|
|
777
|
-
|
|
778
|
-
:::: el-tabs
|
|
779
|
-
|
|
780
|
-
::: el-tab-pane label=Objective-C
|
|
781
|
-
|
|
782
|
-
```
|
|
783
|
-
// first_payment_time is 2018-01-01 01:23:45.678
|
|
784
|
-
[TDAnalytics userSetOnce:@{@"first_payment_time": @"2018-01-01 01:23:45.678"}];
|
|
785
|
-
// first_payment_time remains 2018-01-01 01:23:45.678
|
|
786
|
-
[TDAnalytics userSetOnce:@{@"first_payment_time": @"2018-12-31 01:23:45.678"}];
|
|
787
|
-
```
|
|
788
|
-
|
|
789
|
-
:::
|
|
790
|
-
|
|
791
|
-
::: el-tab-pane label=Swift
|
|
792
|
-
|
|
793
|
-
```
|
|
794
|
-
// first_payment_time is 2018-01-01 01:23:45.678
|
|
795
|
-
TDAnalytics.userSetOnce(["first_payment_time": "2018-01-01 01:23:45.678"])
|
|
796
|
-
// first_payment_time remains 2018-01-01 01:23:45.678
|
|
797
|
-
TDAnalytics.userSetOnce(["first_payment_time": "2018-12-31 01:23:45.678"])
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
:::
|
|
801
|
-
|
|
802
|
-
::::
|
|
803
|
-
|
|
804
|
-
#### 3.3 userAdd
|
|
805
|
-
|
|
806
|
-
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:
|
|
807
|
-
|
|
808
|
-
:::: el-tabs
|
|
809
|
-
|
|
810
|
-
::: el-tab-pane label=Objective-C
|
|
811
|
-
|
|
812
|
-
```
|
|
813
|
-
//total_revenue is 30
|
|
814
|
-
[TDAnalytics userAdd:@{@"total_revenue": @30}];
|
|
815
|
-
|
|
816
|
-
//total_revenue is 678
|
|
817
|
-
[TDAnalytics userAdd:@{@"total_revenue": @648}];
|
|
818
|
-
```
|
|
819
|
-
|
|
820
|
-
:::
|
|
821
|
-
|
|
822
|
-
::: el-tab-pane label=Swift
|
|
823
|
-
|
|
824
|
-
```
|
|
825
|
-
//total_revenue is 30
|
|
826
|
-
TDAnalytics.userAdd(["total_revenue": 30])
|
|
827
|
-
|
|
828
|
-
//total_revenue is 678
|
|
829
|
-
TDAnalytics.userAdd(["total_revenue": 648])
|
|
830
|
-
```
|
|
831
|
-
|
|
832
|
-
:::
|
|
833
|
-
|
|
834
|
-
::::
|
|
835
|
-
|
|
836
|
-
#### 3.4 userUnset
|
|
837
|
-
|
|
838
|
-
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
|
|
839
|
-
|
|
840
|
-
:::: el-tabs
|
|
841
|
-
|
|
842
|
-
::: el-tab-pane label=Objective-C
|
|
843
|
-
|
|
844
|
-
```
|
|
845
|
-
// Clear the user's cumulative payment amount property value
|
|
846
|
-
[TDAnalytics userUnset:@"total_revenue"];
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
:::
|
|
850
|
-
|
|
851
|
-
::: el-tab-pane label=Swift
|
|
852
|
-
|
|
853
|
-
```
|
|
854
|
-
// Clear the user's cumulative payment amount property value
|
|
855
|
-
TDAnalytics.userUnset("total_revenue")
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
:::
|
|
859
|
-
|
|
860
|
-
::::
|
|
861
|
-
|
|
862
|
-
#### 3.5 userDelete
|
|
863
|
-
|
|
864
|
-
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.
|
|
865
|
-
|
|
866
|
-
:::: el-tabs
|
|
867
|
-
|
|
868
|
-
::: el-tab-pane label=Objective-C
|
|
869
|
-
|
|
870
|
-
```
|
|
871
|
-
[TDAnalytics userDelete];
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
:::
|
|
875
|
-
|
|
876
|
-
::: el-tab-pane label=Swift
|
|
877
|
-
|
|
878
|
-
```
|
|
879
|
-
TDAnalytics.userDelete()
|
|
880
|
-
```
|
|
881
|
-
|
|
882
|
-
:::
|
|
883
|
-
|
|
884
|
-
::::
|
|
885
|
-
|
|
886
|
-
#### 3.6 userAppend
|
|
887
|
-
|
|
888
|
-
You can call `userAppend` to append elements to Array type user properties.
|
|
889
|
-
|
|
890
|
-
:::: el-tabs
|
|
891
|
-
|
|
892
|
-
::: el-tab-pane label=Objective-C
|
|
893
|
-
|
|
894
|
-
```
|
|
895
|
-
// Call userAppend to append elements to user property product_buy. If not exists, will create this element
|
|
896
|
-
[TDAnalytics userAppend:@{@"product_buy": @[@"apple", @"ball"]}];
|
|
897
|
-
```
|
|
898
|
-
|
|
899
|
-
:::
|
|
900
|
-
|
|
901
|
-
::: el-tab-pane label=Swift
|
|
902
|
-
|
|
903
|
-
```
|
|
904
|
-
// Call userAppend to append elements to user property product_buy. If not exists, will create this element
|
|
905
|
-
TDAnalytics.userAppend(["product_buy": ["apple", "ball"]])
|
|
906
|
-
```
|
|
907
|
-
|
|
908
|
-
:::
|
|
909
|
-
|
|
910
|
-
::::
|
|
911
|
-
|
|
912
|
-
#### 3.7 userUniqAppend
|
|
913
|
-
|
|
914
|
-
From v2.8.0, you can call `userUniqAppend` to append elements to Array type user properties.
|
|
915
|
-
|
|
916
|
-
Calling `userUniqAppend` interface will deduplicate the appended user properties, `userAppend` interface does not deduplicate, user properties can have duplicates.
|
|
917
|
-
|
|
918
|
-
:::: el-tabs
|
|
919
|
-
|
|
920
|
-
::: el-tab-pane label=Objective-C
|
|
921
|
-
|
|
922
|
-
```
|
|
923
|
-
// user_list property value is ["apple", "ball"]
|
|
924
|
-
[TDAnalytics userAppend:@{@"user_list":@[@"apple", @"ball"]}];
|
|
925
|
-
// user_list property value is ["apple","apple","ball","cube"]
|
|
926
|
-
[TDAnalytics userAppend:@{@"user_list":@[@"apple", @"cube"]}];
|
|
927
|
-
// user_list property value is ["apple", "ball","cube"]
|
|
928
|
-
[TDAnalytics userUniqAppend:@{@"user_list":@[@"apple", @"cube"]}];
|
|
929
|
-
```
|
|
930
|
-
|
|
931
|
-
:::
|
|
932
|
-
|
|
933
|
-
::: el-tab-pane label=Swift
|
|
934
|
-
|
|
935
|
-
```
|
|
936
|
-
// user_list property value is ["apple", "ball"]
|
|
937
|
-
TDAnalytics.userAppend(["user_list": ["apple", "ball"]])
|
|
938
|
-
// user_list property value is ["apple","apple","ball","cube"]
|
|
939
|
-
TDAnalytics.userAppend(["user_list": ["apple", "cube"]])
|
|
940
|
-
// user_list property value is ["apple", "ball","cube"]
|
|
941
|
-
TDAnalytics.userUniqAppend(["user_list": ["apple", "cube"]])
|
|
942
|
-
```
|
|
943
|
-
|
|
944
|
-
:::
|
|
945
|
-
|
|
946
|
-
::::
|
|
947
|
-
|
|
948
|
-
### 4. Other Features
|
|
949
|
-
|
|
950
|
-
#### 4.1 Getting Device ID
|
|
951
|
-
|
|
952
|
-
You can call `getDeviceId` to get device ID:
|
|
953
|
-
|
|
954
|
-
```
|
|
955
|
-
[TDAnalytics getDeviceId];
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
#### 4.2 Setting Default Timezone
|
|
959
|
-
|
|
960
|
-
By default, SDK will use local time when interface is called as event occurrence time for reporting. You can also set default timezone interface to specify default timezone, so all events will align event time according to your set timezone:
|
|
961
|
-
|
|
962
|
-
```
|
|
963
|
-
// Get TDConfig instance
|
|
964
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
965
|
-
// Set default timezone to UTC
|
|
966
|
-
config.defaultTimeZone = [NSTimeZone timeZoneWithName:@"UTC"];
|
|
967
|
-
// Initialize SDK
|
|
968
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
969
|
-
```
|
|
970
|
-
|
|
971
|
-
<!-- unsupported block: 34 -->
|
|
972
|
-
|
|
973
|
-
Note: Aligning event time with specified timezone will lose device local timezone information. If you need to preserve device local timezone information, you currently need to add related properties to events yourself.
|
|
974
|
-
|
|
975
|
-
#### 4.3 Time Calibration
|
|
976
|
-
|
|
977
|
-
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.
|
|
978
|
-
|
|
979
|
-
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.
|
|
980
|
-
|
|
981
|
-
:::: el-tabs
|
|
982
|
-
|
|
983
|
-
::: el-tab-pane label=Objective-C
|
|
984
|
-
|
|
985
|
-
```
|
|
986
|
-
// 1585633785954 is current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
987
|
-
[TDAnalytics calibrateTime:1585633785954];
|
|
988
|
-
```
|
|
989
|
-
|
|
990
|
-
:::
|
|
991
|
-
|
|
992
|
-
::: el-tab-pane label=Swift
|
|
993
|
-
|
|
994
|
-
```
|
|
995
|
-
// 1585633785954 is current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
996
|
-
TDAnalytics.calibrateTime(1585633785954)
|
|
997
|
-
```
|
|
998
|
-
|
|
999
|
-
:::
|
|
1000
|
-
|
|
1001
|
-
::::
|
|
1002
|
-
|
|
1003
|
-
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.
|
|
1004
|
-
|
|
1005
|
-
:::: el-tabs
|
|
1006
|
-
|
|
1007
|
-
::: el-tab-pane label=Objective-C
|
|
1008
|
-
|
|
1009
|
-
```
|
|
1010
|
-
// Use Apple's NTP service for time calibration
|
|
1011
|
-
[TDAnalytics calibrateTimeWithNtp:@"time.apple.com"];
|
|
1012
|
-
```
|
|
1013
|
-
|
|
1014
|
-
:::
|
|
1015
|
-
|
|
1016
|
-
::: el-tab-pane label=Swift
|
|
1017
|
-
|
|
1018
|
-
```
|
|
1019
|
-
TDAnalytics.calibrateTime(withNtp:"time.apple.com")
|
|
1020
|
-
```
|
|
1021
|
-
|
|
1022
|
-
:::
|
|
1023
|
-
|
|
1024
|
-
::::
|
|
1025
|
-
|
|
1026
|
-
<!-- unsupported block: 34 -->
|
|
1027
|
-
|
|
1028
|
-
- Using NTP service for time calibration has some uncertainty, we recommend you prefer using timestamp calibration method
|
|
1029
|
-
- You need to carefully choose your NTP server address to ensure that user devices can quickly get server time under good network conditions
|
|
1030
|
-
|
|
1031
|
-
#### 4.4 Immediately Upload Data
|
|
1032
|
-
|
|
1033
|
-
In certain business scenarios, if you expect data to be immediately uploaded to TE server, you can call `flush` interface
|
|
1034
|
-
|
|
1035
|
-
::: el-tabs
|
|
1036
|
-
|
|
1037
|
-
::: el-tab-pane label=Objective-C
|
|
1038
|
-
|
|
1039
|
-
```
|
|
1040
|
-
[TDAnalytics flush];
|
|
1041
|
-
```
|
|
1042
|
-
|
|
1043
|
-
:::
|
|
1044
|
-
|
|
1045
|
-
::: el-tab-pane label=Swift
|
|
1046
|
-
|
|
1047
|
-
```
|
|
1048
|
-
TDAnalytics.flush()()
|
|
1049
|
-
```
|
|
1050
|
-
|
|
1051
|
-
:::
|
|
1052
|
-
|
|
1053
|
-
::::
|
|
1054
|
-
|
|
1055
|
-
---
|
|
1056
|
-
|
|
1057
|
-
# Real-time Debugging
|
|
1058
|
-
|
|
1059
|
-
During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
|
|
1060
|
-
|
|
1061
|
-
### 1. Printing SDK Logs
|
|
1062
|
-
|
|
1063
|
-
:::: el-tabs
|
|
1064
|
-
|
|
1065
|
-
::: el-tab-pane label=Objective-C
|
|
1066
|
-
|
|
1067
|
-
```
|
|
1068
|
-
[TDAnalytics enableLog:YES];
|
|
1069
|
-
```
|
|
1070
|
-
|
|
1071
|
-
:::
|
|
1072
|
-
|
|
1073
|
-
::: el-tab-pane label=Swift
|
|
1074
|
-
|
|
1075
|
-
```
|
|
1076
|
-
TDAnalytics.enableLog(true)
|
|
1077
|
-
```
|
|
1078
|
-
|
|
1079
|
-
:::
|
|
1080
|
-
|
|
1081
|
-
::::
|
|
1082
|
-
|
|
1083
|
-
<!-- unsupported block: 34 -->
|
|
1084
|
-
|
|
1085
|
-
After enabling logs, you can filter ThinkingData related logs in IDE to observe SDK data reporting.
|
|
1086
|
-
|
|
1087
|
-
### 2. Enabling Debug Mode
|
|
1088
|
-
|
|
1089
|
-
Enabling Debug mode requires two steps:
|
|
1090
|
-
|
|
1091
|
-
1. Enable Debug mode on client
|
|
1092
|
-
Here is sample code for enabling Debug mode on client:
|
|
1093
|
-
|
|
1094
|
-
```
|
|
1095
|
-
[TDAnalytics enableLog:YES];
|
|
1096
|
-
NSString *appid = @"AppId";
|
|
1097
|
-
NSString *url = @"ServerUrl";
|
|
1098
|
-
|
|
1099
|
-
// SDK needs to be initialized on the main thread
|
|
1100
|
-
|
|
1101
|
-
// the second way
|
|
1102
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
1103
|
-
config.appid = appid;
|
|
1104
|
-
config.serverURL = url;
|
|
1105
|
-
/*
|
|
1106
|
-
Set running mode to Debug mode
|
|
1107
|
-
Normal mode: data will be cached and uploaded according to certain caching strategy, default is normal mode; recommended for production environment
|
|
1108
|
-
Debug mode: data is uploaded one by one. When problems occur, it will alert users via logs and exceptions; not recommended for production environment
|
|
1109
|
-
DebugOnly mode: only validate data, will not store; not recommended for production environment
|
|
1110
|
-
*/
|
|
1111
|
-
config.mode = TDModeDebug;
|
|
1112
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
1113
|
-
```
|
|
1114
|
-
|
|
1115
|
-
2. Add Debug device in TE backend
|
|
1116
|
-
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.
|
|
1117
|
-
|
|
1118
|
-
Device ID can be obtained through three ways:
|
|
1119
|
-
|
|
1120
|
-
- #device_id property in event data on TE platform
|
|
1121
|
-
- Client log: Device DeviceId will be printed after SDK initialization completes
|
|
1122
|
-
- Instance interface call: Get Device ID
|
|
1123
|
-
<!-- unsupported block: 34 -->
|
|
1124
|
-
|
|
1125
|
-
Debug mode may affect data collection quality and App stability, only use for integration stage data verification, do not use in production environment.
|
|
1126
|
-
|
|
1127
|
-
---
|
|
1128
|
-
|
|
1129
|
-
# Preset Properties
|
|
1130
|
-
|
|
1131
|
-
#### 1. Preset Properties for All Events
|
|
1132
|
-
|
|
1133
|
-
The following preset properties are preset properties that all events in SDK will have
|
|
1134
|
-
|
|
1135
|
-
**Property Name**
|
|
1136
|
-
|
|
1137
|
-
**Chinese Name**
|
|
1138
|
-
|
|
1139
|
-
Property Type
|
|
1140
|
-
|
|
1141
|
-
**Description**
|
|
1142
|
-
|
|
1143
|
-
#ip
|
|
1144
|
-
|
|
1145
|
-
IP Address
|
|
1146
|
-
|
|
1147
|
-
Text
|
|
1148
|
-
|
|
1149
|
-
User's IP address, TE will use this to get user's geographic location information
|
|
1150
|
-
|
|
1151
|
-
#country
|
|
1152
|
-
|
|
1153
|
-
Country
|
|
1154
|
-
|
|
1155
|
-
Text
|
|
1156
|
-
|
|
1157
|
-
User's country, generated from IP address
|
|
1158
|
-
|
|
1159
|
-
#country_code
|
|
1160
|
-
|
|
1161
|
-
Country Code
|
|
1162
|
-
|
|
1163
|
-
Text
|
|
1164
|
-
|
|
1165
|
-
User's country code (ISO 3166-1 alpha-2, i.e. two uppercase English letters), generated from IP address
|
|
1166
|
-
|
|
1167
|
-
#province
|
|
1168
|
-
|
|
1169
|
-
Province
|
|
1170
|
-
|
|
1171
|
-
Text
|
|
1172
|
-
|
|
1173
|
-
User's province, generated from IP address
|
|
1174
|
-
|
|
1175
|
-
#city
|
|
1176
|
-
|
|
1177
|
-
City
|
|
1178
|
-
|
|
1179
|
-
Text
|
|
1180
|
-
|
|
1181
|
-
User's city, generated from IP address
|
|
1182
|
-
|
|
1183
|
-
#os_version
|
|
1184
|
-
|
|
1185
|
-
OS Version
|
|
1186
|
-
|
|
1187
|
-
Text
|
|
1188
|
-
|
|
1189
|
-
iOS 11.2.2, Android 8.0.0 etc.
|
|
1190
|
-
|
|
1191
|
-
#manufacturer
|
|
1192
|
-
|
|
1193
|
-
Device Manufacturer
|
|
1194
|
-
|
|
1195
|
-
Text
|
|
1196
|
-
|
|
1197
|
-
User's device manufacturer, such as Apple, vivo etc.
|
|
1198
|
-
|
|
1199
|
-
#os
|
|
1200
|
-
|
|
1201
|
-
OS
|
|
1202
|
-
|
|
1203
|
-
Text
|
|
1204
|
-
|
|
1205
|
-
Such as Android, iOS etc.
|
|
1206
|
-
|
|
1207
|
-
#device_id
|
|
1208
|
-
|
|
1209
|
-
Device ID
|
|
1210
|
-
|
|
1211
|
-
Text
|
|
1212
|
-
|
|
1213
|
-
User's device ID, iOS gets user's IDFV or UUID, Android gets androidID
|
|
1214
|
-
|
|
1215
|
-
#app_version
|
|
1216
|
-
|
|
1217
|
-
APP Version
|
|
1218
|
-
|
|
1219
|
-
Text
|
|
1220
|
-
|
|
1221
|
-
Your APP version
|
|
1222
|
-
|
|
1223
|
-
#bundle_id
|
|
1224
|
-
|
|
1225
|
-
App Unique Identifier
|
|
1226
|
-
|
|
1227
|
-
Text
|
|
1228
|
-
|
|
1229
|
-
App package name or process name
|
|
1230
|
-
|
|
1231
|
-
#lib
|
|
1232
|
-
|
|
1233
|
-
SDK Type
|
|
1234
|
-
|
|
1235
|
-
Text
|
|
1236
|
-
|
|
1237
|
-
SDK type you integrated, such as Android, iOS etc.
|
|
1238
|
-
|
|
1239
|
-
#lib_version
|
|
1240
|
-
|
|
1241
|
-
SDK Version
|
|
1242
|
-
|
|
1243
|
-
Text
|
|
1244
|
-
|
|
1245
|
-
SDK version you integrated
|
|
1246
|
-
|
|
1247
|
-
#network_type
|
|
1248
|
-
|
|
1249
|
-
Network Status
|
|
1250
|
-
|
|
1251
|
-
Text
|
|
1252
|
-
|
|
1253
|
-
Network status when uploading event, such as WIFI, 3G, 4G etc.
|
|
1254
|
-
|
|
1255
|
-
#zone_offset
|
|
1256
|
-
|
|
1257
|
-
Timezone Offset
|
|
1258
|
-
|
|
1259
|
-
Number
|
|
1260
|
-
|
|
1261
|
-
Data time offset hours relative to UTC time
|
|
1262
|
-
|
|
1263
|
-
#install_time
|
|
1264
|
-
|
|
1265
|
-
Program Install Time
|
|
1266
|
-
|
|
1267
|
-
Time
|
|
1268
|
-
|
|
1269
|
-
User's app install time, value from system
|
|
1270
|
-
|
|
1271
|
-
#system_language
|
|
1272
|
-
|
|
1273
|
-
System Language
|
|
1274
|
-
|
|
1275
|
-
Text
|
|
1276
|
-
|
|
1277
|
-
User's device system language (ISO 639-1, i.e. two lowercase English letters), such as zh, en etc.
|
|
1278
|
-
|
|
1279
|
-
#### 2. Other Preset Properties
|
|
1280
|
-
|
|
1281
|
-
Besides the preset properties mentioned above, there are some preset properties that need to call corresponding interfaces to be recorded:
|
|
1282
|
-
|
|
1283
|
-
**Property Name**
|
|
1284
|
-
|
|
1285
|
-
**Chinese Name**
|
|
1286
|
-
|
|
1287
|
-
Property Type
|
|
1288
|
-
|
|
1289
|
-
**Description**
|
|
1290
|
-
|
|
1291
|
-
#duration
|
|
1292
|
-
|
|
1293
|
-
Event Duration
|
|
1294
|
-
|
|
1295
|
-
Number
|
|
1296
|
-
|
|
1297
|
-
Need to call timing function interface `timeEvent:`, records event occurrence duration, unit is seconds
|
|
1298
|
-
|
|
1299
|
-
#background_duration
|
|
1300
|
-
|
|
1301
|
-
Background Stay Duration
|
|
1302
|
-
|
|
1303
|
-
Number
|
|
1304
|
-
|
|
1305
|
-
Need to call timing function interface `timeEvent`, records app's background stay duration within event occurrence interval, unit is seconds
|
|
1306
|
-
|
|
1307
|
-
#### 3. Getting Preset Properties
|
|
1308
|
-
|
|
1309
|
-
You can call `getPresetProperties` method to get preset properties.
|
|
1310
|
-
|
|
1311
|
-
When server-side tracking needs some preset properties from App side, you can use this method to get App side preset properties and then pass to server.
|
|
1312
|
-
|
|
1313
|
-
:::: el-tabs
|
|
1314
|
-
|
|
1315
|
-
::: el-tab-pane label=Objective-C
|
|
1316
|
-
|
|
1317
|
-
```
|
|
1318
|
-
//Get property object
|
|
1319
|
-
TDPresetProperties *presetProperties = [TDAnalytics getPresetProperties];
|
|
1320
|
-
|
|
1321
|
-
//Generate event preset properties
|
|
1322
|
-
NSDictionary *properties = [presetProperties toEventPresetProperties];
|
|
1323
|
-
/*
|
|
1324
|
-
{
|
|
1325
|
-
"#os": "iOS",
|
|
1326
|
-
"#device_id": "A8B1C00B-A6AC-4856-8538-0FBC642C1BAD",
|
|
1327
|
-
"#bundle_id": "com.sw.thinkingdatademo",
|
|
1328
|
-
"#manufacturer": "Apple",
|
|
1329
|
-
"#system_language": "zh",
|
|
1330
|
-
"#os_version": "10",
|
|
1331
|
-
"#network_type": "WIFI",
|
|
1332
|
-
"#zone_offset": 8,
|
|
1333
|
-
"#app_version":"1.0.0"
|
|
1334
|
-
}
|
|
1335
|
-
*/
|
|
1336
|
-
|
|
1337
|
-
//Get a specific preset property
|
|
1338
|
-
NSString *bundle_id = presetProperties.bundle_id;//package name
|
|
1339
|
-
NSString *os = presetProperties.os;//os type, such as iOS
|
|
1340
|
-
NSString *system_language = presetProperties.system_language;//phone system language type
|
|
1341
|
-
NSString *os_version = presetProperties.os_version;//system version number
|
|
1342
|
-
NSNumber *zone_offset = presetProperties.zone_offset;//timezone offset
|
|
1343
|
-
```
|
|
1344
|
-
|
|
1345
|
-
:::
|
|
1346
|
-
|
|
1347
|
-
::: el-tab-pane label=Swift
|
|
1348
|
-
|
|
1349
|
-
```
|
|
1350
|
-
let presetProperties = TDAnalytics.getPresetProperties();
|
|
1351
|
-
|
|
1352
|
-
//Generate event preset properties
|
|
1353
|
-
let properties = presetProperties.toEventPresetProperties();
|
|
1354
|
-
|
|
1355
|
-
//Get a specific preset property
|
|
1356
|
-
let bundle_id = presetProperties.bundle_id;//package name
|
|
1357
|
-
let os = presetProperties.os;//os type, such as iOS
|
|
1358
|
-
let system_language = presetProperties.system_language;//phone system language type
|
|
1359
|
-
let os_version = presetProperties.os_version;//system version number
|
|
1360
|
-
let zone_offset = presetProperties.zone_offset;//timezone offset value
|
|
1361
|
-
```
|
|
1362
|
-
|
|
1363
|
-
:::
|
|
1364
|
-
|
|
1365
|
-
::::
|
|
1366
|
-
|
|
1367
|
-
<!-- unsupported block: 34 -->
|
|
1368
|
-
|
|
1369
|
-
IP, country and city information are generated from server-side parsing, client does not provide interface to get these properties
|