@thinkingai/ae-cli 6.0.60 → 6.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/README.zh.md +8 -1
- package/bin/runtime-capabilities.json +1 -1
- package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-X5GL44JT.js} +10 -9
- package/dist/ai-monitor.js +14 -13
- package/dist/{auth-ATK2SLEV.js → auth-SPQ46XQ3.js} +18 -10
- package/dist/{automation-FLCPFMN4.js → automation-7XC3VBZI.js} +87 -12
- package/dist/{capability-6KTSOI7L.js → capability-JZP4KXZC.js} +10 -9
- package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
- package/dist/{chunk-VRMGHQKE.js → chunk-2VKMHNUU.js} +11 -11
- package/dist/{chunk-2ETRY2CU.js → chunk-6HOM2FOJ.js} +19 -9
- package/dist/{chunk-KTJXD27G.js → chunk-AAN6KBUK.js} +3 -3
- package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
- package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
- package/dist/{chunk-BEYLCUZX.js → chunk-E457FREE.js} +3 -3
- package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
- package/dist/{chunk-5M5LBRR3.js → chunk-ETQXIZFP.js} +15 -8
- package/dist/{chunk-72NJKS7O.js → chunk-F36ORPI6.js} +7 -32
- package/dist/{chunk-5E7MTTFN.js → chunk-F7TCQPQX.js} +23 -9
- package/dist/{chunk-AXTO4FTM.js → chunk-FGGEF7MI.js} +3 -3
- package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
- package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
- package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
- package/dist/chunk-N2MAYIRU.js +32 -0
- package/dist/chunk-NNK3JBH4.js +60 -0
- package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
- package/dist/{chunk-HSZAIPUX.js → chunk-PRCHMOWT.js} +7 -5
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
- package/dist/{chunk-SDKW6LYE.js → chunk-RYY5NJK3.js} +3 -3
- package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
- package/dist/{chunk-VJUXKVRE.js → chunk-VR2D54AA.js} +2 -2
- package/dist/{chunk-HVMCPKOZ.js → chunk-YIG3L4RC.js} +1 -1
- package/dist/{chunk-LOR4IA26.js → chunk-YJYC5PLL.js} +166 -188
- package/dist/{chunk-F2VFZUGG.js → chunk-ZVUXAHEV.js} +2 -2
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
- package/dist/{compat-check-XD2U7PZ2.js → compat-check-JD5D77ET.js} +5 -4
- package/dist/{config-U3GDWU6E.js → config-IIMRATTP.js} +7 -6
- package/dist/{context-YAQG6YQC.js → context-BXHIPIIX.js} +8 -6
- package/dist/{data-integration-QE37EQ3A.js → data-integration-VRJQ3HVK.js} +7 -6
- package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
- package/dist/index.js +49 -43
- package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
- package/dist/{memory-WEB27VI6.js → memory-B44LY27L.js} +6 -7
- package/dist/{metadata-7FYE4234.js → metadata-ZVPG2MIA.js} +10 -9
- package/dist/{model-T7H7Q6BG.js → model-ANZBYVST.js} +4 -5
- package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-YNCV4QG3.js} +45 -14
- package/dist/{project-semantic-2GGFJWW6.js → project-semantic-E7ZAQL5S.js} +9 -8
- package/dist/{sync-ULBB7WO5.js → sync-Y4OZRQAY.js} +9 -9
- package/dist/{te-agent-6RMF7LUV.js → te-agent-RKAUTYJZ.js} +303 -17
- package/dist/{te-analysis-HSYC7GNV.js → te-analysis-7N5VC4JB.js} +25 -20
- package/dist/{te-community-FLKZGQKB.js → te-community-SIA2UHTS.js} +13 -11
- package/dist/{te-dataops-OQQGTCUA.js → te-dataops-5MJQCODU.js} +13 -11
- package/dist/{te-engage-RIEBHL5T.js → te-engage-ZTLOMKO3.js} +73 -20
- package/dist/{te-kb-4HG2FMHJ.js → te-kb-LDL3MF2Y.js} +107 -25
- package/dist/{te-system-AL4B4XZL.js → te-system-473I5O53.js} +6 -7
- package/dist/{te-team-5O4UVUWE.js → te-team-JOWHCMZA.js} +92 -10
- package/dist/{things-TSJ64GBT.js → things-DOQ2L3O2.js} +9 -8
- package/dist/{update-Q5LURAWV.js → update-KUS6TCPB.js} +8 -6
- package/dist/{workspace-FF2HXJGR.js → workspace-MJFPIV7C.js} +6 -7
- package/package.json +6 -3
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-automation/SKILL.md +6 -2
- package/skills/ae-automation/references/cli.md +9 -3
- package/skills/ae-capability/SKILL.md +8 -4
- 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 +11 -7
- package/skills/ae-kb/references/publication.md +45 -0
- 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/dist/chunk-Y74WTIKJ.js +0 -10
- 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,2755 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
code: ios_sdk_installation
|
|
3
|
-
name: "iOS"
|
|
4
|
-
wikiToken: RCJRwHveBi4YRBk2AqncI0VqncS
|
|
5
|
-
parentWikiToken: FTcTwinIOi3OiRkK4MPc2Ex7neg
|
|
6
|
-
updateTime: 1773312570000
|
|
7
|
-
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=ios_sdk_installation
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# iOS
|
|
11
|
-
|
|
12
|
-
::: tip Tip
|
|
13
|
-
|
|
14
|
-
Please read the pre-installation preparation before integration.
|
|
15
|
-
|
|
16
|
-
iOS SDK requires minimum system version iOS 9.0
|
|
17
|
-
|
|
18
|
-
iOS SDK (Framework format) size is approximately 2.7 MB
|
|
19
|
-
|
|
20
|
-
:::
|
|
21
|
-
|
|
22
|
-
**Latest Version:** v3.3.5
|
|
23
|
-
|
|
24
|
-
**Update Time:** 2026-03-12
|
|
25
|
-
|
|
26
|
-
**Resource Download:** Source code Download
|
|
27
|
-
|
|
28
|
-
::: warning Note
|
|
29
|
-
|
|
30
|
-
This document applies to v3.0.0 and later versions. For historical versions, please refer to iOS Integration Guide (V2), SDK Download (v2.8.4)
|
|
31
|
-
|
|
32
|
-
:::
|
|
33
|
-
|
|
34
|
-
### I. Integrate SDK
|
|
35
|
-
|
|
36
|
-
#### 1.1 Automatic Integration
|
|
37
|
-
|
|
38
|
-
- Install SDK using CocoaPods
|
|
39
|
-
|
|
40
|
-
1. Create and edit Podfile content (if exists, edit directly):
|
|
41
|
-
|
|
42
|
-
Create Podfile, execute command in the same directory as the project file (`.xcodeproj`):
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
pod init
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Edit Podfile content as follows:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
platform :ios, '9.0'
|
|
52
|
-
target 'YourProjectTarget' do
|
|
53
|
-
pod 'ThinkingSDK', '3.3.5'
|
|
54
|
-
end
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
2. Execute installation command in the project root directory
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
pod install
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
After success, the terminal will show the following message:
|
|
64
|
-
|
|
65
|
-
3. Import successful, launch project
|
|
66
|
-
|
|
67
|
-
After successful command execution, a `.xcworkspace` file will be generated, indicating you have successfully imported `iOS SDK`. Open `.xcworkspace` file to launch the project (Note: `.xcodeproj` file cannot be opened simultaneously)
|
|
68
|
-
|
|
69
|
-
#### 1.2 Manual Integration
|
|
70
|
-
|
|
71
|
-
1. Download and unzip iOS SDK
|
|
72
|
-
|
|
73
|
-
2. Drag `ThinkingSDK.xcframework` and `ThinkingDataCore.xcframework` into XCode Project Workspace
|
|
74
|
-
|
|
75
|
-
3. Find Targets, add `-ObjC` to `Other linker flags` option in Build Settings menu
|
|
76
|
-
|
|
77
|
-
4. Switch to Build Phases tab, add the following dependencies under `Link Binary With Libraries`:
|
|
78
|
-
|
|
79
|
-
`libz.dylib`, `Security.framework`, `SystemConfiguration.framework`, `libsqlite3.tbd`
|
|
80
|
-
|
|
81
|
-
### II. Initialize
|
|
82
|
-
|
|
83
|
-
:::: el-tabs
|
|
84
|
-
|
|
85
|
-
::: el-tab-pane label=Objective-C
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
#import <ThinkingSDK/ThinkingSDK.h>
|
|
89
|
-
|
|
90
|
-
NSString *appid = @"APPID";
|
|
91
|
-
NSString *url = @"SERVER_URL";
|
|
92
|
-
|
|
93
|
-
// Method one
|
|
94
|
-
[TDAnalytics startAnalyticsWithAppId:appid serverUrl:url];
|
|
95
|
-
|
|
96
|
-
// Method two
|
|
97
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
98
|
-
config.appid = appid;
|
|
99
|
-
config.serverUrl = url;
|
|
100
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
:::
|
|
104
|
-
|
|
105
|
-
::: el-tab-pane label=Swift
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
// SDK needs to be initialized on the main thread
|
|
109
|
-
|
|
110
|
-
**let** appid = "APPID";
|
|
111
|
-
**let** url = "SERVER_URL";
|
|
112
|
-
|
|
113
|
-
// Method one
|
|
114
|
-
TDAnalytics.start(withAppId: appid, serverUrl: url)
|
|
115
|
-
|
|
116
|
-
// Method two
|
|
117
|
-
**let** config = TDConfig(appId: appid, serverUrl: url)
|
|
118
|
-
TDAnalytics.start(with: config)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
:::
|
|
122
|
-
|
|
123
|
-
::::
|
|
124
|
-
|
|
125
|
-
Parameter description:
|
|
126
|
-
|
|
127
|
-
- `APPID`: Your project's APPID, can be obtained from TE backend project management page
|
|
128
|
-
- `SERVER_URL`: Data upload URL
|
|
129
|
-
- If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
130
|
-
- If you are using private deployment version, please bind a domain for data collection address and configure HTTPS certificate: https://data-collection-address-bound-domain
|
|
131
|
-
|
|
132
|
-
### III. Common Features
|
|
133
|
-
|
|
134
|
-
Before using common features, we recommend you first understand user identification rules. SDK will default use `DeviceID_InstallCount` as visitor ID, and persistently store visitor ID locally. Before user logs in, visitor ID will be used as identity identification ID. Note: Visitor ID will change when user reinstalls the App or switches devices.
|
|
135
|
-
|
|
136
|
-
#### 3.1 Set Account ID
|
|
137
|
-
|
|
138
|
-
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 previous account ID.
|
|
139
|
-
|
|
140
|
-
:::: el-tabs
|
|
141
|
-
|
|
142
|
-
::: el-tab-pane label=Objective-C
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
// User's unique login identifier, this data corresponds to #account_id in reported data, at this time #account_id value is TD
|
|
146
|
-
[TDAnalytics login:@"TD"];
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
:::
|
|
150
|
-
|
|
151
|
-
::: el-tab-pane label=Swift
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
// User's unique login identifier, this data corresponds to #account_id in reported data, at this time #account_id value is TD
|
|
155
|
-
TDAnalytics.login("TD")
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
:::
|
|
159
|
-
|
|
160
|
-
::::
|
|
161
|
-
|
|
162
|
-
<!-- unsupported block: 34 -->
|
|
163
|
-
|
|
164
|
-
**This method does not upload login event**
|
|
165
|
-
|
|
166
|
-
#### 3.2 Set Common Event Properties
|
|
167
|
-
|
|
168
|
-
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 important properties like user membership level, source channel, etc., which need to be set in every event, you can set these properties as common event properties.
|
|
169
|
-
|
|
170
|
-
:::: el-tabs
|
|
171
|
-
|
|
172
|
-
::: el-tab-pane label=Objective-C
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
NSDictionary *superProperties = @{
|
|
176
|
-
@"channel": @"ta",
|
|
177
|
-
@"age": @1,
|
|
178
|
-
@"isSuccess": @YES,
|
|
179
|
-
@"birthday": [NSDate date],
|
|
180
|
-
@"object": @{
|
|
181
|
-
@"key":@"value"
|
|
182
|
-
},
|
|
183
|
-
@"object_arr":@[
|
|
184
|
-
@{
|
|
185
|
-
@"key":@"value"
|
|
186
|
-
}
|
|
187
|
-
],
|
|
188
|
-
@"arr": @[@"value"],
|
|
189
|
-
};
|
|
190
|
-
[TDAnalytics setSuperProperties:superProperties];
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
:::
|
|
194
|
-
|
|
195
|
-
::: el-tab-pane label=Swift
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
var superProperties: [AnyHashable : Any] = [:]
|
|
199
|
-
superProperties["channel"] = "ta"
|
|
200
|
-
superProperties["age"] = 1
|
|
201
|
-
superProperties["isSuccess"] = true
|
|
202
|
-
superProperties["birthday"] = Date()
|
|
203
|
-
superProperties["object"] = [
|
|
204
|
-
"key": "value"
|
|
205
|
-
]
|
|
206
|
-
superProperties["object_arr"] = [["key": "value"]]
|
|
207
|
-
superProperties["arr"] = ["value"]
|
|
208
|
-
|
|
209
|
-
TDAnalytics.setSuperProperties(superProperties)
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
:::
|
|
213
|
-
|
|
214
|
-
::::
|
|
215
|
-
|
|
216
|
-
Common event properties will be saved to cache, no need to call every time App starts. If `setSuperProperties` is called to set a previously set common event property, it will overwrite the previous property.
|
|
217
|
-
|
|
218
|
-
- Event property is a `NSDictionary` object, where each element represents a property.
|
|
219
|
-
- Key is the property name, string type, must start with letter, contain numbers, letters and underscore "\_", maximum length 50 characters, case insensitive, TE will convert to lowercase letters
|
|
220
|
-
- Value is the property value, supports string, number, boolean, time, object, object array, array
|
|
221
|
-
- If you need to upload boolean property, please use `@YES` and `@NO` or `[NSNumber numberWithBool:YES]` and `[NSNumber numberWithBool:NO]` to assign. **Cannot use** `@true`, `@false`, `@TRUE` and `@FALSE` to assign boolean data.
|
|
222
|
-
<!-- unsupported block: 34 -->
|
|
223
|
-
|
|
224
|
-
**Event properties and user properties requirements are consistent with common event properties**
|
|
225
|
-
|
|
226
|
-
#### 3.3 Enable Auto Tracking
|
|
227
|
-
|
|
228
|
-
The following code example enables install, start, and end events. If you want to understand SDK's auto tracking capabilities in detail, you can view the auto tracking feature detailed introduction.
|
|
229
|
-
|
|
230
|
-
:::: el-tabs
|
|
231
|
-
|
|
232
|
-
::: el-tab-pane label=Objective-C
|
|
233
|
-
|
|
234
|
-
```
|
|
235
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAppInstall | TDAutoTrackEventTypeAppStart | TDAutoTrackEventTypeAppEnd];
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
:::
|
|
239
|
-
|
|
240
|
-
::: el-tab-pane label=Swift
|
|
241
|
-
|
|
242
|
-
```
|
|
243
|
-
TDAnalytics.enableAutoTrack([.appStart, .appEnd, .appInstall])
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
:::
|
|
247
|
-
|
|
248
|
-
::::
|
|
249
|
-
|
|
250
|
-
#### 3.4 Send Event
|
|
251
|
-
|
|
252
|
-
You can call `track` to upload events. We recommend you set event properties and conditions for sending information according to your tracking documentation. Here is an example of user purchasing a product:
|
|
253
|
-
|
|
254
|
-
:::: el-tabs
|
|
255
|
-
|
|
256
|
-
::: el-tab-pane label=Objective-C
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
260
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
:::
|
|
264
|
-
|
|
265
|
-
::: el-tab-pane label=Swift
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
let properties = ["product_name": "book"] as [String: Any]
|
|
269
|
-
TDAnalytics.track("product_buy", properties: properties)
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
:::
|
|
273
|
-
|
|
274
|
-
::::
|
|
275
|
-
|
|
276
|
-
Event name is string type, must start with letter, can contain numbers, letters and underscore "\_", maximum length 50 characters.
|
|
277
|
-
|
|
278
|
-
#### 3.5 Set User Properties
|
|
279
|
-
|
|
280
|
-
For general user properties, you can call `userSet` to set. Properties uploaded using this interface will overwrite original property values. If the user property did not exist before, it will create a new user property, type consistent with the uploaded property type. Here is an example of setting username:
|
|
281
|
-
|
|
282
|
-
:::: el-tabs
|
|
283
|
-
|
|
284
|
-
::: el-tab-pane label=Objective-C
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
// Now "username" is "ThinkingData"
|
|
288
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
289
|
-
// Now "username" is "TA"
|
|
290
|
-
[TDAnalytics userSet:@{@"username": @"TA"}];
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
:::
|
|
294
|
-
|
|
295
|
-
::: el-tab-pane label=Swift
|
|
296
|
-
|
|
297
|
-
```
|
|
298
|
-
// Now "username" is "ThinkingData"
|
|
299
|
-
TDAnalytics.userSet(["usernaame": "ThinkingData"])
|
|
300
|
-
// Now "username" is "TA"
|
|
301
|
-
TDAnalytics.userSet(["usernaame": "TA"])
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
:::
|
|
305
|
-
|
|
306
|
-
::::
|
|
307
|
-
|
|
308
|
-
### IV. Best Practices
|
|
309
|
-
|
|
310
|
-
The following example code includes all the above operations. We recommend using the following steps:
|
|
311
|
-
|
|
312
|
-
:::: el-tabs
|
|
313
|
-
|
|
314
|
-
::: el-tab-pane label=Objective-C
|
|
315
|
-
|
|
316
|
-
```
|
|
317
|
-
if (Privacy policy authorized) {
|
|
318
|
-
// Enable log
|
|
319
|
-
[TDAnalytics enableLog:NO];
|
|
320
|
-
|
|
321
|
-
// SDK initialization
|
|
322
|
-
NSString *appid = @"APPID";
|
|
323
|
-
NSString *url = @"SERVER_URL";
|
|
324
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
325
|
-
config.appid = appid;
|
|
326
|
-
config.serverUrl = url;
|
|
327
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
328
|
-
|
|
329
|
-
// Enable auto tracking
|
|
330
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAppInstall | TDAutoTrackEventTypeAppStart | TDAutoTrackEventTypeAppEnd];
|
|
331
|
-
|
|
332
|
-
[TDAnalytics login:@"TD"];
|
|
333
|
-
|
|
334
|
-
NSDictionary *superProperties = @{
|
|
335
|
-
@"channel": @"ta",
|
|
336
|
-
@"age": @1,
|
|
337
|
-
@"isSuccess": @YES,
|
|
338
|
-
@"birthday": [NSDate date],
|
|
339
|
-
@"object": @{
|
|
340
|
-
@"key":@"value"
|
|
341
|
-
},
|
|
342
|
-
@"object_arr":@[
|
|
343
|
-
@{
|
|
344
|
-
@"key":@"value"
|
|
345
|
-
}
|
|
346
|
-
],
|
|
347
|
-
@"arr": @[@"value"],
|
|
348
|
-
};
|
|
349
|
-
[TDAnalytics setSuperProperties:superProperties];
|
|
350
|
-
|
|
351
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
352
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
353
|
-
|
|
354
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
:::
|
|
360
|
-
|
|
361
|
-
::: el-tab-pane label=Swift
|
|
362
|
-
|
|
363
|
-
```
|
|
364
|
-
if (Privacy policy authorized) {
|
|
365
|
-
// Enable log
|
|
366
|
-
TDAnalytics.enableLog(true)
|
|
367
|
-
|
|
368
|
-
// SDK initialization
|
|
369
|
-
let appid = "app_id";
|
|
370
|
-
let url = "server_url";
|
|
371
|
-
let config = TDConfig(appId: appid, serverUrl: url)
|
|
372
|
-
TDAnalytics.start(with: config)
|
|
373
|
-
|
|
374
|
-
// Enable auto tracking
|
|
375
|
-
TDAnalytics.enableAutoTrack([.appStart, .appEnd, .appInstall])
|
|
376
|
-
|
|
377
|
-
TDAnalytics.login("TD")
|
|
378
|
-
|
|
379
|
-
var superProperties: [AnyHashable : Any] = [:]
|
|
380
|
-
superProperties["channel"] = "ta"
|
|
381
|
-
superProperties["age"] = 1
|
|
382
|
-
superProperties["isSuccess"] = true
|
|
383
|
-
superProperties["birthday"] = Date()
|
|
384
|
-
superProperties["object"] = [
|
|
385
|
-
"key": "value"
|
|
386
|
-
]
|
|
387
|
-
superProperties["object_arr"] = [["key": "value"]]
|
|
388
|
-
superProperties["arr"] = ["value"]
|
|
389
|
-
TDAnalytics.setSuperProperties(superProperties)
|
|
390
|
-
|
|
391
|
-
let eventProperties : [String: Any] = ["product_name": "book"]
|
|
392
|
-
TDAnalytics.track("test", properties: eventProperties)
|
|
393
|
-
|
|
394
|
-
TDAnalytics.userSet(["level": "1"])
|
|
395
|
-
}
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
:::
|
|
399
|
-
|
|
400
|
-
::::
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
# Advanced Guide
|
|
405
|
-
|
|
406
|
-
### I. Set User ID
|
|
407
|
-
|
|
408
|
-
SDK default will use `DeviceID_InstallCount` as the default visitor ID for each user. This visitor ID will be used as identity identification ID when user is not logged in. Note that visitor ID will change when user reinstalls App or switches devices.
|
|
409
|
-
|
|
410
|
-
#### 1.1 Set Visitor ID
|
|
411
|
-
|
|
412
|
-
::: tip Tip
|
|
413
|
-
|
|
414
|
-
Generally, you don't need to customize visitor ID. Please ensure you understand user identification rules before setting visitor ID.
|
|
415
|
-
|
|
416
|
-
If you need to replace visitor ID, you should call it immediately after SDK initialization is complete. Do not call multiple times to avoid creating useless accounts.
|
|
417
|
-
|
|
418
|
-
:::
|
|
419
|
-
|
|
420
|
-
If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set visitor ID:
|
|
421
|
-
|
|
422
|
-
:::: el-tabs
|
|
423
|
-
|
|
424
|
-
::: el-tab-pane label=Objective-C
|
|
425
|
-
|
|
426
|
-
```
|
|
427
|
-
[TDAnalytics setDistinctId:@"Thinker"];
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
:::
|
|
431
|
-
|
|
432
|
-
::: el-tab-pane label=Swift
|
|
433
|
-
|
|
434
|
-
```
|
|
435
|
-
TDAnalytics.setDistinctId("Thinker")
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
:::
|
|
439
|
-
|
|
440
|
-
::::
|
|
441
|
-
|
|
442
|
-
If you need to get current visitor ID, you can call `getDistinctId` to retrieve:
|
|
443
|
-
|
|
444
|
-
:::: el-tabs
|
|
445
|
-
|
|
446
|
-
::: el-tab-pane label=Objective-C
|
|
447
|
-
|
|
448
|
-
```
|
|
449
|
-
NSString *distinctId = [TDAnalytics getDistinctId];
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
:::
|
|
453
|
-
|
|
454
|
-
::: el-tab-pane label=Swift
|
|
455
|
-
|
|
456
|
-
```
|
|
457
|
-
let distinctId = TDAnalytics.getDistinctId()
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
:::
|
|
461
|
-
|
|
462
|
-
::::
|
|
463
|
-
|
|
464
|
-
#### 1.2 Set Account ID
|
|
465
|
-
|
|
466
|
-
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 previous account ID.
|
|
467
|
-
|
|
468
|
-
:::: el-tabs
|
|
469
|
-
|
|
470
|
-
::: el-tab-pane label=Objective-C
|
|
471
|
-
|
|
472
|
-
```
|
|
473
|
-
[TDAnalytics login:@"TD"];
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
:::
|
|
477
|
-
|
|
478
|
-
::: el-tab-pane label=Swift
|
|
479
|
-
|
|
480
|
-
```
|
|
481
|
-
TDAnalytics.login("TD")
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
:::
|
|
485
|
-
|
|
486
|
-
::::
|
|
487
|
-
|
|
488
|
-
<!-- unsupported block: 34 -->
|
|
489
|
-
|
|
490
|
-
**This method does not upload login event**
|
|
491
|
-
|
|
492
|
-
#### 1.3 Clear Account ID
|
|
493
|
-
|
|
494
|
-
After user generates logout behavior, you can call `logout` to clear account ID. Before next `login` call, visitor ID will be used as identity identification ID.
|
|
495
|
-
|
|
496
|
-
:::: el-tabs
|
|
497
|
-
|
|
498
|
-
::: el-tab-pane label=Objective-C
|
|
499
|
-
|
|
500
|
-
```
|
|
501
|
-
[TDAnalytics logout];
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
:::
|
|
505
|
-
|
|
506
|
-
::: el-tab-pane label=Swift
|
|
507
|
-
|
|
508
|
-
```
|
|
509
|
-
TDAnalytics.logout()
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
:::
|
|
513
|
-
|
|
514
|
-
::::
|
|
515
|
-
|
|
516
|
-
We recommend you call `logout` when there is an explicit logout event, such as when user performs account cancellation action, rather than calling when closing App.
|
|
517
|
-
|
|
518
|
-
<!-- unsupported block: 34 -->
|
|
519
|
-
|
|
520
|
-
**This method does not upload logout event**
|
|
521
|
-
|
|
522
|
-
### II. Send Event
|
|
523
|
-
|
|
524
|
-
After SDK initialization is complete, you can perform data tracking and collect user behavior information. Generally, normal events can meet business scenario requirements. You can also use first-time, updatable events according to your actual business scenarios.
|
|
525
|
-
|
|
526
|
-
#### 2.1 Normal Event
|
|
527
|
-
|
|
528
|
-
You can call `track` to upload events. We recommend you set event properties and conditions for sending events according to your documentation. Here is an example of user purchasing a product:
|
|
529
|
-
|
|
530
|
-
:::: el-tabs
|
|
531
|
-
|
|
532
|
-
::: el-tab-pane label=Objective-C
|
|
533
|
-
|
|
534
|
-
```
|
|
535
|
-
NSDictionary *eventProperties = @{@"product_name": @"book"};
|
|
536
|
-
[TDAnalytics track:@"product_buy" properties:eventProperties];
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
:::
|
|
540
|
-
|
|
541
|
-
::: el-tab-pane label=Swift
|
|
542
|
-
|
|
543
|
-
```
|
|
544
|
-
let properties = ["product_name": "book"] as [String: Any]
|
|
545
|
-
TDAnalytics.track("product_buy", properties: properties)
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
:::
|
|
549
|
-
|
|
550
|
-
::::
|
|
551
|
-
|
|
552
|
-
#### 2.2 First-time Event
|
|
553
|
-
|
|
554
|
-
First-time event refers to an event that will only be recorded once for a certain device or other dimension ID. For example, in some scenarios, you may want to record the activation event on a certain device, you can use first-time event to report data.
|
|
555
|
-
|
|
556
|
-
:::: el-tabs
|
|
557
|
-
|
|
558
|
-
::: el-tab-pane label=Objective-C
|
|
559
|
-
|
|
560
|
-
```
|
|
561
|
-
TDFirstEventModel *firstModel = [[TDFirstEventModel alloc] initWithEventName:@"device_activation"];
|
|
562
|
-
firstModel.properties = @{@"key":@"value"};
|
|
563
|
-
[TDAnalytics trackWithEventModel:firstModel];
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
:::
|
|
567
|
-
|
|
568
|
-
::: el-tab-pane label=Swift
|
|
569
|
-
|
|
570
|
-
```
|
|
571
|
-
let firstModel = TDFirstEventModel(eventName:"device_activation")
|
|
572
|
-
firstModel.properties = ["KEY": "VALUE"]
|
|
573
|
-
TDAnalytics.track(with: firstModel)
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
:::
|
|
577
|
-
|
|
578
|
-
::::
|
|
579
|
-
|
|
580
|
-
If you want to use other dimensions besides device to determine whether it's first-time, you can customize first_check_id for the first-time event:
|
|
581
|
-
|
|
582
|
-
:::: el-tabs
|
|
583
|
-
|
|
584
|
-
::: el-tab-pane label=Objective-C
|
|
585
|
-
|
|
586
|
-
```
|
|
587
|
-
TDFirstEventModel *firstModel = [[TDFirstEventModel alloc] initWithEventName:@"device_activation" firstCheckID:@"TD"];
|
|
588
|
-
firstModel.properties = @{@"key":@"value"};
|
|
589
|
-
[TDAnalytics trackWithEventModel:firstModel];
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
:::
|
|
593
|
-
|
|
594
|
-
::: el-tab-pane label=Swift
|
|
595
|
-
|
|
596
|
-
```
|
|
597
|
-
**let** firstModel = TDFirstEventModel(eventName:"device_activation", firstCheckID:"TD")
|
|
598
|
-
firstModel.properties = ["KEY": "VALUE"]
|
|
599
|
-
TDAnalytics.track(with: firstModel)
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
:::
|
|
603
|
-
|
|
604
|
-
::::
|
|
605
|
-
|
|
606
|
-
<!-- unsupported block: 34 -->
|
|
607
|
-
|
|
608
|
-
Note: Since the server completes the verification of whether it's first-time, first-time events will have a 1-hour delay before being stored.
|
|
609
|
-
|
|
610
|
-
#### 2.3 Updatable Event
|
|
611
|
-
|
|
612
|
-
You can use updatable events to implement the need to modify event data in specific scenarios. Updatable events need to specify the ID that identifies the event and pass it when creating the updatable event object. TE backend will determine the data that needs to be updated based on event name and event ID.
|
|
613
|
-
|
|
614
|
-
:::: el-tabs
|
|
615
|
-
|
|
616
|
-
::: el-tab-pane label=Objective-C
|
|
617
|
-
|
|
618
|
-
```
|
|
619
|
-
// Example: Report an updatable event, assuming event name is UPDATABLE_EVENT
|
|
620
|
-
// After reporting, event property status is 3, price is 100
|
|
621
|
-
TDUpdateEventModel *updateModel = [[TDUpdateEventModel alloc] initWithEventName:@"UPDATABLE_EVENT" eventID:@"test_event_id"];
|
|
622
|
-
updateModel.properties = @{@"status": @3, @"price": @100};
|
|
623
|
-
[TDAnalytics trackWithEventModel:updateModel];
|
|
624
|
-
|
|
625
|
-
// After reporting, event property status is updated to 5, price unchanged
|
|
626
|
-
TDUpdateEventModel *updateModelNew = [[TDUpdateEventModel alloc] initWithEventName:@"UPDATABLE_EVENT" eventID:@"test_event_id"];
|
|
627
|
-
updateModelNew.properties = @{@"status": @5};
|
|
628
|
-
[TDAnalytics trackWithEventModel:updateModelNew];
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
:::
|
|
632
|
-
|
|
633
|
-
::: el-tab-pane label=Swift
|
|
634
|
-
|
|
635
|
-
```
|
|
636
|
-
// Example: Report an updatable event, assuming event name is UPDATABLE_EVENT
|
|
637
|
-
// After reporting, event property status is 3, price is 100
|
|
638
|
-
**let** updateModel = TDUpdateEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
639
|
-
updateModel.properties = ["status": 3, "price": 100]
|
|
640
|
-
TDAnalytics.track(with: updateModel)
|
|
641
|
-
|
|
642
|
-
// After reporting, event property status is 5, price unchanged
|
|
643
|
-
**let** updateModel_new = TDUpdateEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
644
|
-
updateModel_new.properties = ["status": 5]
|
|
645
|
-
TDAnalytics.track(with: updateModel_new)
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
:::
|
|
649
|
-
|
|
650
|
-
::::
|
|
651
|
-
|
|
652
|
-
#### 2.4 Overwritable Event
|
|
653
|
-
|
|
654
|
-
Overwritable event is similar to updatable event, the difference is that overwritable event will completely overwrite historical 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 that needs to be updated based on event name and event ID.
|
|
655
|
-
|
|
656
|
-
:::: el-tabs
|
|
657
|
-
|
|
658
|
-
::: el-tab-pane label=Objective-C
|
|
659
|
-
|
|
660
|
-
```
|
|
661
|
-
// Example: Report an overwritable event, assuming event name is OVERWRITE_EVENT
|
|
662
|
-
// After reporting, event property status is 3, price is 100
|
|
663
|
-
TDOverwriteEventModel *overwriteModel = [[TDOverwriteEventModel alloc] initWithEventName:@"OVERWRITE_EVENT" eventID:@"test_event_id"];
|
|
664
|
-
overwriteModel.properties = @{@"status": @3, @"price": @100};
|
|
665
|
-
[TDAnalytics trackWithEventModel:overwriteModel];
|
|
666
|
-
|
|
667
|
-
// After reporting, event property status is 5, price property is deleted
|
|
668
|
-
TDOverwriteEventModel *overwriteModel_new = [[TDOverwriteEventModel alloc] initWithEventName:@"OVERWRITE_EVENT" eventID:@"test_event_id"];
|
|
669
|
-
overwriteModel_new.properties = @{@"status": @5};
|
|
670
|
-
[TDAnalytics trackWithEventModel:overwriteModel_new];
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
:::
|
|
674
|
-
|
|
675
|
-
::: el-tab-pane label=Swift
|
|
676
|
-
|
|
677
|
-
```
|
|
678
|
-
// Example: Report an overwritable event, assuming event name is OVERWRITE_EVENT
|
|
679
|
-
// After reporting, event property status is 3, price is 100
|
|
680
|
-
**let** overwriteModel = TDOverwriteEventModel(eventName: "OVERWRITE_EVENT", eventID: "test_event_id")
|
|
681
|
-
overwriteModel.properties = ["status": 3, "price": 100]
|
|
682
|
-
TDAnalytics.track(with: overwriteModel)
|
|
683
|
-
|
|
684
|
-
// After reporting, event property status is 5, price is deleted
|
|
685
|
-
**let** overwriteModel_new = TDOverwriteEventModel(eventName: "UPDATABLE_EVENT", eventID: "test_event_id")
|
|
686
|
-
overwriteModel_new.properties = ["status": 5]
|
|
687
|
-
TDAnalytics.track(with: overwriteModel_new)
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
:::
|
|
691
|
-
|
|
692
|
-
::::
|
|
693
|
-
|
|
694
|
-
#### 2.5 Common Event Properties
|
|
695
|
-
|
|
696
|
-
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 specific business scenario requirements. We recommend you set common event properties before sending events. For the same event, when common event properties, event custom properties, and preset properties have the same Key, we will assign values according to the following priority: `custom properties > dynamic common event properties > static common event properties > preset properties`.
|
|
697
|
-
|
|
698
|
-
##### 2.5.1 Static Common Event Properties
|
|
699
|
-
|
|
700
|
-
Static common event properties are properties that change infrequently and every event will have, such as user membership level. After setting static common event properties through `setSuperProperties`, SDK will get the set common event properties as event properties during event collection.
|
|
701
|
-
|
|
702
|
-
:::: el-tabs
|
|
703
|
-
|
|
704
|
-
::: el-tab-pane label=Objective-C
|
|
705
|
-
|
|
706
|
-
```
|
|
707
|
-
[TDAnalytics setSuperProperties:@{@"vip_level": @(2)}];
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
:::
|
|
711
|
-
|
|
712
|
-
::: el-tab-pane label=Swift
|
|
713
|
-
|
|
714
|
-
```
|
|
715
|
-
TDAnalytics.setSuperProperties(["vip_level" : 2])
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
:::
|
|
719
|
-
|
|
720
|
-
::::
|
|
721
|
-
|
|
722
|
-
Static common event properties will be saved to cache, no need to call 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, a new property will be created. Besides property setting, we also provide other APIs to operate static common event properties to meet daily business needs.
|
|
723
|
-
|
|
724
|
-
:::: el-tabs
|
|
725
|
-
|
|
726
|
-
::: el-tab-pane label=Objective-C
|
|
727
|
-
|
|
728
|
-
```
|
|
729
|
-
// Clear a common event property, clearing the previously set "isTest" property
|
|
730
|
-
[TDAnalytics unsetSuperProperty:@"isTest"];
|
|
731
|
-
|
|
732
|
-
// Clear all common event properties
|
|
733
|
-
[TDAnalytics clearSuperProperties];
|
|
734
|
-
|
|
735
|
-
// Get all common properties
|
|
736
|
-
[TDAnalytics getSuperProperties];
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
:::
|
|
740
|
-
|
|
741
|
-
::: el-tab-pane label=Swift
|
|
742
|
-
|
|
743
|
-
```
|
|
744
|
-
// Clear a common event property, clearing the previously set "isTest" property
|
|
745
|
-
TDAnalytics.unsetSuperProperty("isTest")
|
|
746
|
-
|
|
747
|
-
// Clear all common event properties
|
|
748
|
-
TDAnalytics.clearSuperProperties()
|
|
749
|
-
|
|
750
|
-
// Get all common properties
|
|
751
|
-
TDAnalytics.getSuperProperties()
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
:::
|
|
755
|
-
|
|
756
|
-
::::
|
|
757
|
-
|
|
758
|
-
##### 2.5.2 Dynamic Common Event Properties
|
|
759
|
-
|
|
760
|
-
Dynamic common event properties are properties that change frequently and every event will have, such as user's coin count. After setting dynamic common properties through `setDynamicSuperProperties`, SDK will get dynamic common properties during event collection and add them to triggered events.
|
|
761
|
-
|
|
762
|
-
:::: el-tabs
|
|
763
|
-
|
|
764
|
-
::: el-tab-pane label=Objective-C
|
|
765
|
-
|
|
766
|
-
```
|
|
767
|
-
// Set dynamic common properties, dynamically get event occurrence time during event reporting
|
|
768
|
-
[TDAnalytics setDynamicSuperProperties:^NSDictionary * **_Nonnull**{
|
|
769
|
-
**return** @{@"now": [NSDate date]};
|
|
770
|
-
}];
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
:::
|
|
774
|
-
|
|
775
|
-
::: el-tab-pane label=Swift
|
|
776
|
-
|
|
777
|
-
```
|
|
778
|
-
// Set dynamic common properties, dynamically get event occurrence time during event reporting
|
|
779
|
-
TDAnalytics.setDynamicSuperProperties{ () -> [String : **Any**] **in**
|
|
780
|
-
**return** ["now": Date()]
|
|
781
|
-
}
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
:::
|
|
785
|
-
|
|
786
|
-
::::
|
|
787
|
-
|
|
788
|
-
#### 2.6 Record Event Duration
|
|
789
|
-
|
|
790
|
-
If you need to record the duration of a certain event, you can call `timeEvent` to start timing. Configure the event name you want to time. When you upload the event, it will automatically add `#duration` property in your event properties to represent the recorded duration, in seconds. Note that only one timing task can exist for the same event name.
|
|
791
|
-
|
|
792
|
-
:::: el-tabs
|
|
793
|
-
|
|
794
|
-
::: el-tab-pane label=Objective-C
|
|
795
|
-
|
|
796
|
-
```
|
|
797
|
-
// The following example completes the statistics of user stay duration on a product page
|
|
798
|
-
[TDAnalytics timeEvent:@"stay_shop"];
|
|
799
|
-
/*
|
|
800
|
-
do someting .......
|
|
801
|
-
*/
|
|
802
|
-
// User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
803
|
-
[TDAnalytics track:@"stay_shop"];
|
|
804
|
-
```
|
|
805
|
-
|
|
806
|
-
:::
|
|
807
|
-
|
|
808
|
-
::: el-tab-pane label=Swift
|
|
809
|
-
|
|
810
|
-
```
|
|
811
|
-
// The following example completes the statistics of user stay duration on a product page
|
|
812
|
-
TDAnalytics.timeEvent("stay_shop")
|
|
813
|
-
/*
|
|
814
|
-
do someting .......
|
|
815
|
-
*/
|
|
816
|
-
// User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
817
|
-
TDAnalytics.track("stay_shop")
|
|
818
|
-
```
|
|
819
|
-
|
|
820
|
-
:::
|
|
821
|
-
|
|
822
|
-
::::
|
|
823
|
-
|
|
824
|
-
### III. User Properties
|
|
825
|
-
|
|
826
|
-
TE platform supports user property setting APIs: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`.
|
|
827
|
-
|
|
828
|
-
#### 3.1 userSet
|
|
829
|
-
|
|
830
|
-
For general user properties, you can call `userSet` to set. Properties uploaded using this interface will overwrite original property values. If the user property did not exist before, it will create a new user property, type consistent with the uploaded property type. Here is an example of setting username:
|
|
831
|
-
|
|
832
|
-
:::: el-tabs
|
|
833
|
-
|
|
834
|
-
::: el-tab-pane label=Objective-C
|
|
835
|
-
|
|
836
|
-
```
|
|
837
|
-
// Now "username" is "ThinkingData"
|
|
838
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"}];
|
|
839
|
-
// Now "username" is "TA"
|
|
840
|
-
[TDAnalytics userSet:@{@"username": @"TA"}];
|
|
841
|
-
```
|
|
842
|
-
|
|
843
|
-
:::
|
|
844
|
-
|
|
845
|
-
::: el-tab-pane label=Swift
|
|
846
|
-
|
|
847
|
-
```
|
|
848
|
-
// Now "username" is "ThinkingData"
|
|
849
|
-
TDAnalytics.userSet(["username": "ThinkingData"])
|
|
850
|
-
// Now "username" is "TA"
|
|
851
|
-
TDAnalytics.userSet(["username": "TA"])
|
|
852
|
-
```
|
|
853
|
-
|
|
854
|
-
:::
|
|
855
|
-
|
|
856
|
-
::::
|
|
857
|
-
|
|
858
|
-
#### 3.2 userSetOnce
|
|
859
|
-
|
|
860
|
-
If the user property you want to upload only needs to be set once, you can call `userSetOnce` to set. When the property already has a value before, this message will be ignored. Here is an example of setting first payment time:
|
|
861
|
-
|
|
862
|
-
:::: el-tabs
|
|
863
|
-
|
|
864
|
-
::: el-tab-pane label=Objective-C
|
|
865
|
-
|
|
866
|
-
```
|
|
867
|
-
// first_payment_time is 2018-01-01 01:23:45.678
|
|
868
|
-
[TDAnalytics userSetOnce:@{@"first_payment_time": @"2018-01-01 01:23:45.678"}];
|
|
869
|
-
// first_payment_time is still 2018-01-01 01:23:45.678
|
|
870
|
-
[TDAnalytics userSetOnce:@{@"first_payment_time": @"2018-12-31 01:23:45.678"}];
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
:::
|
|
874
|
-
|
|
875
|
-
::: el-tab-pane label=Swift
|
|
876
|
-
|
|
877
|
-
```
|
|
878
|
-
// first_payment_time is 2018-01-01 01:23:45.678
|
|
879
|
-
TDAnalytics.userSetOnce(["first_payment_time": "2018-01-01 01:23:45.678"])
|
|
880
|
-
// first_payment_time is still 2018-01-01 01:23:45.678
|
|
881
|
-
TDAnalytics.userSetOnce(["first_payment_time": "2018-12-31 01:23:45.678"])
|
|
882
|
-
```
|
|
883
|
-
|
|
884
|
-
:::
|
|
885
|
-
|
|
886
|
-
::::
|
|
887
|
-
|
|
888
|
-
#### 3.3 userAdd
|
|
889
|
-
|
|
890
|
-
When you want to upload numeric properties, you can call `userAdd` to accumulate the property. If the property has not been set yet, it will assign 0 before calculation. Negative values can be passed, equivalent to subtraction operation. Here is an example of cumulative payment amount:
|
|
891
|
-
|
|
892
|
-
:::: el-tabs
|
|
893
|
-
|
|
894
|
-
::: el-tab-pane label=Objective-C
|
|
895
|
-
|
|
896
|
-
```
|
|
897
|
-
// Now total_revenue is 30
|
|
898
|
-
[TDAnalytics userAdd:@{@"total_revenue": @30}];
|
|
899
|
-
|
|
900
|
-
// Now total_revenue is 678
|
|
901
|
-
[TDAnalytics userAdd:@{@"total_revenue": @648}];
|
|
902
|
-
```
|
|
903
|
-
|
|
904
|
-
:::
|
|
905
|
-
|
|
906
|
-
::: el-tab-pane label=Swift
|
|
907
|
-
|
|
908
|
-
```
|
|
909
|
-
// Now total_revenue is 30
|
|
910
|
-
TDAnalytics.userAdd(["total_revenue": 30])
|
|
911
|
-
|
|
912
|
-
// Now total_revenue is 678
|
|
913
|
-
TDAnalytics.userAdd(["total_revenue": 648])
|
|
914
|
-
```
|
|
915
|
-
|
|
916
|
-
:::
|
|
917
|
-
|
|
918
|
-
::::
|
|
919
|
-
|
|
920
|
-
#### 3.4 userUnset
|
|
921
|
-
|
|
922
|
-
When you want to clear a user's certain user property value, you can call `userUnset` to clear the specified property. If the property has not been created in the cluster yet, `userUnset` will not create the property
|
|
923
|
-
|
|
924
|
-
:::: el-tabs
|
|
925
|
-
|
|
926
|
-
::: el-tab-pane label=Objective-C
|
|
927
|
-
|
|
928
|
-
```
|
|
929
|
-
// Clear the user's cumulative payment amount property value
|
|
930
|
-
[TDAnalytics userUnset:@"total_revenue"];
|
|
931
|
-
```
|
|
932
|
-
|
|
933
|
-
:::
|
|
934
|
-
|
|
935
|
-
::: el-tab-pane label=Swift
|
|
936
|
-
|
|
937
|
-
```
|
|
938
|
-
// Clear the user's cumulative payment amount property value
|
|
939
|
-
TDAnalytics.userUnset("total_revenue")
|
|
940
|
-
```
|
|
941
|
-
|
|
942
|
-
:::
|
|
943
|
-
|
|
944
|
-
::::
|
|
945
|
-
|
|
946
|
-
#### 3.5 userDelete
|
|
947
|
-
|
|
948
|
-
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.
|
|
949
|
-
|
|
950
|
-
:::: el-tabs
|
|
951
|
-
|
|
952
|
-
::: el-tab-pane label=Objective-C
|
|
953
|
-
|
|
954
|
-
```
|
|
955
|
-
[TDAnalytics userDelete];
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
:::
|
|
959
|
-
|
|
960
|
-
::: el-tab-pane label=Swift
|
|
961
|
-
|
|
962
|
-
```
|
|
963
|
-
TDAnalytics.userDelete()
|
|
964
|
-
```
|
|
965
|
-
|
|
966
|
-
:::
|
|
967
|
-
|
|
968
|
-
::::
|
|
969
|
-
|
|
970
|
-
#### 3.6 userAppend
|
|
971
|
-
|
|
972
|
-
You can call `userAppend` to append elements to array type user properties.
|
|
973
|
-
|
|
974
|
-
:::: el-tabs
|
|
975
|
-
|
|
976
|
-
::: el-tab-pane label=Objective-C
|
|
977
|
-
|
|
978
|
-
```
|
|
979
|
-
// Call userAppend to append elements to user property product_buy. If not exists, will create the element
|
|
980
|
-
[TDAnalytics userAppend:@{@"product_buy": @[@"apple", @"ball"]}];
|
|
981
|
-
```
|
|
982
|
-
|
|
983
|
-
:::
|
|
984
|
-
|
|
985
|
-
::: el-tab-pane label=Swift
|
|
986
|
-
|
|
987
|
-
```
|
|
988
|
-
// Call userAppend to append elements to user property product_buy. If not exists, will create the element
|
|
989
|
-
TDAnalytics.userAppend(["product_buy": ["apple", "ball"]])
|
|
990
|
-
```
|
|
991
|
-
|
|
992
|
-
:::
|
|
993
|
-
|
|
994
|
-
::::
|
|
995
|
-
|
|
996
|
-
#### 3.7 userUniqAppend
|
|
997
|
-
|
|
998
|
-
From v2.8.0, you can call `userUniqAppend` to append elements to array type user properties.
|
|
999
|
-
|
|
1000
|
-
Calling `userUniqAppend` interface will deduplicate appended user properties. `userAppend` interface does not deduplicate, user properties may have duplicates.
|
|
1001
|
-
|
|
1002
|
-
:::: el-tabs
|
|
1003
|
-
|
|
1004
|
-
::: el-tab-pane label=Objective-C
|
|
1005
|
-
|
|
1006
|
-
```
|
|
1007
|
-
// Now user_list property value is ["apple", "ball"]
|
|
1008
|
-
[TDAnalytics userAppend:@{@"user_list":@[@"apple", @"ball"]}];
|
|
1009
|
-
// Now user_list property value is ["apple", "apple", "ball", "cube"]
|
|
1010
|
-
[TDAnalytics userAppend:@{@"user_list":@[@"apple", @"cube"]}];
|
|
1011
|
-
// Now user_list property value is ["apple", "ball", "cube"]
|
|
1012
|
-
[TDAnalytics userUniqAppend:@{@"user_list":@[@"apple", @"cube"]}];
|
|
1013
|
-
```
|
|
1014
|
-
|
|
1015
|
-
:::
|
|
1016
|
-
|
|
1017
|
-
::: el-tab-pane label=Swift
|
|
1018
|
-
|
|
1019
|
-
```
|
|
1020
|
-
// Now user_list property value is ["apple", "ball"]
|
|
1021
|
-
TDAnalytics.userAppend(["user_list": ["apple", "ball"]])
|
|
1022
|
-
// Now user_list property value is ["apple", "apple", "ball", "cube"]
|
|
1023
|
-
TDAnalytics.userAppend(["user_list": ["apple", "cube"]])
|
|
1024
|
-
// Now user_list property value is ["apple", "ball", "cube"]
|
|
1025
|
-
TDAnalytics.userUniqAppend(["user_list": ["apple", "cube"]])
|
|
1026
|
-
```
|
|
1027
|
-
|
|
1028
|
-
:::
|
|
1029
|
-
|
|
1030
|
-
::::
|
|
1031
|
-
|
|
1032
|
-
### IV. Encryption Feature
|
|
1033
|
-
|
|
1034
|
-
From v2.8.0, SDK supports using AES+RSA encryption for data. Data encryption feature requires client and server cooperation. Please consult customer success staff for specific usage.
|
|
1035
|
-
|
|
1036
|
-
```
|
|
1037
|
-
TDConfig *sdkConfig = [[TDConfig alloc] initWithAppId:appid serverUrl:url];
|
|
1038
|
-
NSString *publicKey = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzA......QIDAQAB";
|
|
1039
|
-
// Configure version number, public key and other key information
|
|
1040
|
-
[sdkConfig enableEncryptWithVersion:1 publicKey:publicKey];
|
|
1041
|
-
[TDAnalytics startAnalyticsWithConfig:sdkConfig];
|
|
1042
|
-
```
|
|
1043
|
-
|
|
1044
|
-
### V. Enable Integration with H5 Pages
|
|
1045
|
-
|
|
1046
|
-
If you need to integrate with JavaScript SDK that collects H5 page data, please call the following interface. For details, please refer to the H5 and APP SDK Integration section.
|
|
1047
|
-
|
|
1048
|
-
:::: el-tabs
|
|
1049
|
-
|
|
1050
|
-
::: el-tab-pane label=Objective-C
|
|
1051
|
-
|
|
1052
|
-
```
|
|
1053
|
-
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
|
1054
|
-
config.applicationNameForUserAgent = [NSString stringWithFormat:@"%@ %@", config.applicationNameForUserAgent ?: @"", @"/td-sdk-ios"];
|
|
1055
|
-
```
|
|
1056
|
-
|
|
1057
|
-
:::
|
|
1058
|
-
|
|
1059
|
-
::: el-tab-pane label=Swift
|
|
1060
|
-
|
|
1061
|
-
```
|
|
1062
|
-
let webViewConfig = WKWebViewConfiguration()
|
|
1063
|
-
webViewConfig.applicationNameForUserAgent = "\(webViewConfig.applicationNameForUserAgent ?? "") /td-sdk-ios"
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
|
-
:::
|
|
1067
|
-
|
|
1068
|
-
::::
|
|
1069
|
-
|
|
1070
|
-
### VI. Other Features
|
|
1071
|
-
|
|
1072
|
-
#### 6.1 Get Device ID
|
|
1073
|
-
|
|
1074
|
-
You can get device ID by calling `getDeviceId`:
|
|
1075
|
-
|
|
1076
|
-
:::: el-tabs
|
|
1077
|
-
|
|
1078
|
-
::: el-tab-pane label=Objective-C
|
|
1079
|
-
|
|
1080
|
-
```
|
|
1081
|
-
[TDAnalytics getDeviceId];
|
|
1082
|
-
```
|
|
1083
|
-
|
|
1084
|
-
:::
|
|
1085
|
-
|
|
1086
|
-
::: el-tab-pane label=Swift
|
|
1087
|
-
|
|
1088
|
-
```
|
|
1089
|
-
TDAnalytics.getDeviceId()
|
|
1090
|
-
```
|
|
1091
|
-
|
|
1092
|
-
:::
|
|
1093
|
-
|
|
1094
|
-
::::
|
|
1095
|
-
|
|
1096
|
-
#### 6.2 Set Default Timezone
|
|
1097
|
-
|
|
1098
|
-
By default, SDK will use the local time at interface call time 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:
|
|
1099
|
-
|
|
1100
|
-
:::: el-tabs
|
|
1101
|
-
|
|
1102
|
-
::: el-tab-pane label=Objective-C
|
|
1103
|
-
|
|
1104
|
-
```
|
|
1105
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
1106
|
-
// Set default timezone to UTC
|
|
1107
|
-
config.defaultTimeZone = [NSTimeZone timeZoneWithName:@"UTC"];
|
|
1108
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
1109
|
-
```
|
|
1110
|
-
|
|
1111
|
-
:::
|
|
1112
|
-
|
|
1113
|
-
::: el-tab-pane label=Swift
|
|
1114
|
-
|
|
1115
|
-
```
|
|
1116
|
-
let config = TDConfig(appId: appid, serverUrl: url)
|
|
1117
|
-
config.defaultTimeZone = TimeZone.current
|
|
1118
|
-
TDAnalytics.start(with: config)
|
|
1119
|
-
```
|
|
1120
|
-
|
|
1121
|
-
:::
|
|
1122
|
-
|
|
1123
|
-
::::
|
|
1124
|
-
|
|
1125
|
-
<!-- unsupported block: 34 -->
|
|
1126
|
-
|
|
1127
|
-
Note: Using specified timezone to align event time will lose device local timezone information. If you need to preserve device local timezone information, currently you need to add relevant properties to events yourself.
|
|
1128
|
-
|
|
1129
|
-
#### 6.3 Calibrate Time
|
|
1130
|
-
|
|
1131
|
-
SDK default will use local time as event occurrence time for reporting. If user manually modifies device time, it will affect your business analysis. In this case, you can ensure the accuracy of event occurrence time through time calibration operation. We provide `timestamp, NTP` two time calibration methods.
|
|
1132
|
-
|
|
1133
|
-
- 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 calibrated time.
|
|
1134
|
-
:::: el-tabs
|
|
1135
|
-
|
|
1136
|
-
::: el-tab-pane label=Objective-C
|
|
1137
|
-
|
|
1138
|
-
```
|
|
1139
|
-
// 1585633785954 is current unix timestamp, unit is milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
1140
|
-
[TDAnalytics calibrateTime:1585633785954];
|
|
1141
|
-
```
|
|
1142
|
-
|
|
1143
|
-
:::
|
|
1144
|
-
|
|
1145
|
-
::: el-tab-pane label=Swift
|
|
1146
|
-
|
|
1147
|
-
```
|
|
1148
|
-
// 1585633785954 is current unix timestamp, unit is milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
1149
|
-
TDAnalytics.calibrateTime(1585633785954)
|
|
1150
|
-
```
|
|
1151
|
-
|
|
1152
|
-
:::
|
|
1153
|
-
|
|
1154
|
-
::::
|
|
1155
|
-
|
|
1156
|
-
- You can also set NTP server address. After that, SDK will try to get current time from the passed NTP server address and calibrate SDK time. If correct return result is not obtained within default timeout time (3 seconds), subsequent data will be reported using local time.
|
|
1157
|
-
:::: el-tabs
|
|
1158
|
-
|
|
1159
|
-
::: el-tab-pane label=Objective-C
|
|
1160
|
-
|
|
1161
|
-
```
|
|
1162
|
-
// Use Apple NTP service to calibrate time
|
|
1163
|
-
[TDAnalytics calibrateTimeWithNtp:@"time.apple.com"];
|
|
1164
|
-
```
|
|
1165
|
-
|
|
1166
|
-
:::
|
|
1167
|
-
|
|
1168
|
-
::: el-tab-pane label=Swift
|
|
1169
|
-
|
|
1170
|
-
```
|
|
1171
|
-
// Use Apple NTP service to calibrate time
|
|
1172
|
-
TDAnalytics.calibrateTime(withNtp:"time.apple.com")
|
|
1173
|
-
```
|
|
1174
|
-
|
|
1175
|
-
:::
|
|
1176
|
-
|
|
1177
|
-
::::
|
|
1178
|
-
|
|
1179
|
-
<!-- unsupported block: 34 -->
|
|
1180
|
-
|
|
1181
|
-
- Using NTP service for time calibration has certain uncertainty. We recommend you consider timestamp calibration method first
|
|
1182
|
-
- You need to carefully choose your NTP server address to ensure that user devices can quickly get server time under good network conditions
|
|
1183
|
-
|
|
1184
|
-
#### 6.4 Immediately Report Data
|
|
1185
|
-
|
|
1186
|
-
In certain business scenarios, if you expect data to be immediately reported to TE server, you can call `flush` interface to complete
|
|
1187
|
-
|
|
1188
|
-
:::: el-tabs
|
|
1189
|
-
|
|
1190
|
-
::: el-tab-pane label=Objective-C
|
|
1191
|
-
|
|
1192
|
-
```
|
|
1193
|
-
[TDAnalytics flush];
|
|
1194
|
-
```
|
|
1195
|
-
|
|
1196
|
-
:::
|
|
1197
|
-
|
|
1198
|
-
::: el-tab-pane label=Swift
|
|
1199
|
-
|
|
1200
|
-
```
|
|
1201
|
-
TDAnalytics.flush()
|
|
1202
|
-
```
|
|
1203
|
-
|
|
1204
|
-
:::
|
|
1205
|
-
|
|
1206
|
-
::::
|
|
1207
|
-
|
|
1208
|
-
#### 6.5 Get Country/Region Code
|
|
1209
|
-
|
|
1210
|
-
In certain business scenarios, if you need to know user device's country/region code, you can get it through `getLocalRegion`
|
|
1211
|
-
|
|
1212
|
-
:::: el-tabs
|
|
1213
|
-
|
|
1214
|
-
::: el-tab-pane label=Objective-C
|
|
1215
|
-
|
|
1216
|
-
```
|
|
1217
|
-
[TDAnalytics getLocalRegion];
|
|
1218
|
-
```
|
|
1219
|
-
|
|
1220
|
-
:::
|
|
1221
|
-
|
|
1222
|
-
::: el-tab-pane label=Swift
|
|
1223
|
-
|
|
1224
|
-
```
|
|
1225
|
-
TDAnalytics.getLocalRegion()
|
|
1226
|
-
```
|
|
1227
|
-
|
|
1228
|
-
:::
|
|
1229
|
-
|
|
1230
|
-
::::
|
|
1231
|
-
|
|
1232
|
-
#### 6.6 Support IP Reporting Data
|
|
1233
|
-
|
|
1234
|
-
To prevent or solve the problem of client data unable to normally report to server due to DNS hijacking, SDK parses ServerUrl to get IP, then directly reports data to server through IP. Specific enabling example is as follows:
|
|
1235
|
-
|
|
1236
|
-
:::: el-tabs
|
|
1237
|
-
|
|
1238
|
-
::: el-tab-pane label=Objective-C
|
|
1239
|
-
|
|
1240
|
-
```
|
|
1241
|
-
NSString *appId = @"appId";
|
|
1242
|
-
NSString *serverUrl = @"serverUrl";
|
|
1243
|
-
TDConfig *config = [[TDConfig alloc] initWithAppId:appId serverUrl:serverUrl];
|
|
1244
|
-
|
|
1245
|
-
[config enableDNSServcie:@[TDDNSServiceCloudALi, TDDNSServiceCloudGoogle, TDDNSServiceCloudFlare]];
|
|
1246
|
-
|
|
1247
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
1248
|
-
```
|
|
1249
|
-
|
|
1250
|
-
:::
|
|
1251
|
-
|
|
1252
|
-
::: el-tab-pane label=Swift
|
|
1253
|
-
|
|
1254
|
-
```
|
|
1255
|
-
let appid = "app_id";
|
|
1256
|
-
let url = "url";
|
|
1257
|
-
let config = TDConfig(appId: appid, serverUrl: url)
|
|
1258
|
-
|
|
1259
|
-
config.enableDNSServcie([.cloudALi, .cloudGoogle, .cloudFlare])
|
|
1260
|
-
|
|
1261
|
-
TDAnalytics.start(with: config)
|
|
1262
|
-
```
|
|
1263
|
-
|
|
1264
|
-
:::
|
|
1265
|
-
|
|
1266
|
-
::::
|
|
1267
|
-
|
|
1268
|
-
#### 6.7 Support SDK Error Callback
|
|
1269
|
-
|
|
1270
|
-
<!-- unsupported block: 19 -->
|
|
1271
|
-
|
|
1272
|
-
Requires SDK version >= 3.3.0
|
|
1273
|
-
|
|
1274
|
-
In certain scenarios, you may want to customize operations when network request fails. You can register errorCallback. Specific enabling example is as follows:
|
|
1275
|
-
|
|
1276
|
-
:::: el-tabs
|
|
1277
|
-
|
|
1278
|
-
::: el-tab-pane label=Objective-C
|
|
1279
|
-
|
|
1280
|
-
```
|
|
1281
|
-
[TDAnalytics registerErrorCallback:^(NSInteger code, NSString * **_Nullable** errorMsg, NSString * **_Nullable** ext) {
|
|
1282
|
-
|
|
1283
|
-
}];
|
|
1284
|
-
```
|
|
1285
|
-
|
|
1286
|
-
:::
|
|
1287
|
-
|
|
1288
|
-
::: el-tab-pane label=Swift
|
|
1289
|
-
|
|
1290
|
-
```
|
|
1291
|
-
TDAnalytics.registerErrorCallback { (code: Int, msg: String?, ext: String?) **in**
|
|
1292
|
-
|
|
1293
|
-
}
|
|
1294
|
-
```
|
|
1295
|
-
|
|
1296
|
-
:::
|
|
1297
|
-
|
|
1298
|
-
::::
|
|
1299
|
-
|
|
1300
|
-
code error codes
|
|
1301
|
-
|
|
1302
|
-
Error Code
|
|
1303
|
-
|
|
1304
|
-
Description
|
|
1305
|
-
|
|
1306
|
-
1001
|
|
1307
|
-
|
|
1308
|
-
Network request failed
|
|
1309
|
-
|
|
1310
|
-
---
|
|
1311
|
-
|
|
1312
|
-
# Third-party Data
|
|
1313
|
-
|
|
1314
|
-
**Latest Version:** v0.3.5
|
|
1315
|
-
|
|
1316
|
-
**Update Time:** 2025-02-10
|
|
1317
|
-
|
|
1318
|
-
**Resource Download:** Source code Framework Download
|
|
1319
|
-
|
|
1320
|
-
Use cocopoads to integrate:
|
|
1321
|
-
|
|
1322
|
-
```
|
|
1323
|
-
pod 'TAThirdParty'
|
|
1324
|
-
```
|
|
1325
|
-
|
|
1326
|
-
ThinkingSDK from v2.8.0 supports third-party data integration feature. The following is example code for synchronizing data from multiple platforms:
|
|
1327
|
-
|
|
1328
|
-
```
|
|
1329
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppsFlyer | TDThirdPartyTypeAdjust | TDThirdPartyTypeTradPlus | TDThirdPartyTypeTracking | TDThirdPartyTypeTopOn | TDThirdPartyTypeBranch | TDThirdPartyTypeIronSource];
|
|
1330
|
-
```
|
|
1331
|
-
|
|
1332
|
-
<!-- unsupported block: 34 -->
|
|
1333
|
-
|
|
1334
|
-
If you need to add extra parameters, you can use `enableThirdPartySharing:customMap`. This API does not support bitwise operations.
|
|
1335
|
-
|
|
1336
|
-
### I. Appsflyer
|
|
1337
|
-
|
|
1338
|
-
Call API before AppsFlyer SDK calls start method
|
|
1339
|
-
|
|
1340
|
-
```
|
|
1341
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppsFlyer];
|
|
1342
|
-
```
|
|
1343
|
-
|
|
1344
|
-
After creating role (optional)
|
|
1345
|
-
|
|
1346
|
-
```
|
|
1347
|
-
[TDAnalytics login:@"account_id"];
|
|
1348
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppsFlyer properties:@{@"ta_data11":@"ta_value11"}];
|
|
1349
|
-
```
|
|
1350
|
-
|
|
1351
|
-
Each time TE's `login` method or `setDistinctId` method is called, you need to synchronously call `enableThirdPartySharing` to update user identifier.
|
|
1352
|
-
|
|
1353
|
-
Note: Since AppFlyer's setAdditionalData each call will overwrite the set user identifier. You can set parameters through our provided `enableThirdPartySharing` method:
|
|
1354
|
-
|
|
1355
|
-
```
|
|
1356
|
-
NSDictionary *dic = @{@"af_test_key1": @"test1",@"af_test_key2": @"test2"};
|
|
1357
|
-
[AppsFlyerLib.shared setAdditionalData:dic];
|
|
1358
|
-
```
|
|
1359
|
-
|
|
1360
|
-
Because setAdditionalData called multiple times will overwrite previous parameters, you can pass parameters to TE. SDK will internally concatenate and merge the parameters.
|
|
1361
|
-
|
|
1362
|
-
```
|
|
1363
|
-
NSDictionary *dic = @{@"af_test_key1": @"test1",@"af_test_key2": @"test2"};
|
|
1364
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppsFlyer properties:dic];
|
|
1365
|
-
```
|
|
1366
|
-
|
|
1367
|
-
### II. Adjust
|
|
1368
|
-
|
|
1369
|
-
Call before Adjust SDK initialization
|
|
1370
|
-
|
|
1371
|
-
```
|
|
1372
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAdjust];
|
|
1373
|
-
```
|
|
1374
|
-
|
|
1375
|
-
After creating role (optional)
|
|
1376
|
-
|
|
1377
|
-
```
|
|
1378
|
-
[TDAnalytics login:@"account_id"];
|
|
1379
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAdjust];
|
|
1380
|
-
```
|
|
1381
|
-
|
|
1382
|
-
### III. Branch
|
|
1383
|
-
|
|
1384
|
-
Call before Branch SDK initialization
|
|
1385
|
-
|
|
1386
|
-
```
|
|
1387
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeBranch];
|
|
1388
|
-
```
|
|
1389
|
-
|
|
1390
|
-
After creating role (optional)
|
|
1391
|
-
|
|
1392
|
-
```
|
|
1393
|
-
[TDAnalytics login:@"account_id"];
|
|
1394
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeBranch];
|
|
1395
|
-
```
|
|
1396
|
-
|
|
1397
|
-
### IV. TopOn
|
|
1398
|
-
|
|
1399
|
-
Call before ATSDK initialization:
|
|
1400
|
-
|
|
1401
|
-
```
|
|
1402
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeTopOn];
|
|
1403
|
-
```
|
|
1404
|
-
|
|
1405
|
-
Multiple calls to TE's `login` or `setDistinctId` require calling enableThirdPartySharing again to synchronize data.
|
|
1406
|
-
|
|
1407
|
-
Note: Since TopOn's `setCustomData` each call will overwrite the set user identifier. You can set parameters through our provided `enableThirdPartySharing` method:
|
|
1408
|
-
|
|
1409
|
-
```
|
|
1410
|
-
NSDictionary *dic = @{@"test_key1": @"test1", @"test_key2": @"test2"};
|
|
1411
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeTopOn properties:dic];
|
|
1412
|
-
```
|
|
1413
|
-
|
|
1414
|
-
### V. Tradplus
|
|
1415
|
-
|
|
1416
|
-
Call before TradPlusSdk initialization
|
|
1417
|
-
|
|
1418
|
-
```
|
|
1419
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeTradPlus];
|
|
1420
|
-
```
|
|
1421
|
-
|
|
1422
|
-
### VI. IronSource
|
|
1423
|
-
|
|
1424
|
-
Call after IronSourceSdk initialization
|
|
1425
|
-
|
|
1426
|
-
```
|
|
1427
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeIronSource];
|
|
1428
|
-
```
|
|
1429
|
-
|
|
1430
|
-
### VII. AppLovin
|
|
1431
|
-
|
|
1432
|
-
- Display level
|
|
1433
|
-
Call after AppLovinSdk initialization
|
|
1434
|
-
|
|
1435
|
-
```
|
|
1436
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppLovin];
|
|
1437
|
-
```
|
|
1438
|
-
|
|
1439
|
-
- User level
|
|
1440
|
-
If you want to implement monetization data acquisition, you need to implement `-[MAAdRevenueDelegate didPayRevenueForAd:]`. In this method, get monetization data and report data through SDK's `enableThirdPartySharing`. Example code is as follows:
|
|
1441
|
-
|
|
1442
|
-
```
|
|
1443
|
-
- (**void**)didPayRevenueForAd:(MAAd *)ad {
|
|
1444
|
-
// Get Ad data
|
|
1445
|
-
NSDictionary *adInfo = @{
|
|
1446
|
-
@"ad_id": ad.adUnitIdentifier,
|
|
1447
|
-
@"revenue": @(ad.revenue),
|
|
1448
|
-
@"countryCode": [[[ALSdk shared] configuration] countryCode],
|
|
1449
|
-
@"networkName": ad.networkName,
|
|
1450
|
-
@"adUnitId": ad.adUnitIdentifier,
|
|
1451
|
-
@"adFormat": ad.format,
|
|
1452
|
-
@"placement": ad.placement
|
|
1453
|
-
};
|
|
1454
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppLovin];
|
|
1455
|
-
[TDAnalytics track:@"appLovin_sdk_ad_revenue" properties:adInfo];
|
|
1456
|
-
}
|
|
1457
|
-
```
|
|
1458
|
-
|
|
1459
|
-
---
|
|
1460
|
-
|
|
1461
|
-
# Multiple Instances
|
|
1462
|
-
|
|
1463
|
-
### I. Multiple Instance Feature Introduction
|
|
1464
|
-
|
|
1465
|
-
In iOS SDK 1.2.0 version, multiple APPID feature was added. You can create multiple SDK instances, each corresponding to their own APPID for data reporting, which means you can report data to multiple APPIDs.
|
|
1466
|
-
|
|
1467
|
-
In iOS SDK 2.1.0 version, lightweight instance feature was added. You can generate multiple child lightweight instances for the same APPID. Child lightweight instance and parent instance have the same APPID, but account information etc. are different.
|
|
1468
|
-
|
|
1469
|
-
If you upgrade old version (before 1.2.0) SDK to version after 1.2.0, and old version SDK local cache still has unreported data, it will be directly reported to the first instantiated APPID. **For users who only use one APPID instance, data will not be affected.**
|
|
1470
|
-
|
|
1471
|
-
### II. How to Create Multiple SDK Instances
|
|
1472
|
-
|
|
1473
|
-
This section introduces SDK multiple instance usage:
|
|
1474
|
-
|
|
1475
|
-
```
|
|
1476
|
-
[TDAnalytics enableLog:**YES**];
|
|
1477
|
-
|
|
1478
|
-
NSString *appId_1 = @"appId_1";
|
|
1479
|
-
NSString *receiverUrl_1 = @"https://receiver-ta-preview.thinkingdata.cn";
|
|
1480
|
-
[TDAnalytics startAnalyticsWithAppId:appId_1 serverUrl:receiverUrl_1];
|
|
1481
|
-
|
|
1482
|
-
NSString *appId_2 = @"appId_2";
|
|
1483
|
-
NSString *receiverUrl_2 = @"https://receiver-ta-preview.thinkingdata.cn";
|
|
1484
|
-
[TDAnalytics startAnalyticsWithAppId:appId_2 serverUrl:receiverUrl_2];
|
|
1485
|
-
|
|
1486
|
-
[TDAnalytics calibrateTimeWithNtp:@"time.apple.com"];
|
|
1487
|
-
|
|
1488
|
-
[TDAnalytics login:@"TD" withAppId:appId_1];
|
|
1489
|
-
[TDAnalytics login:@"TD" withAppId:appId_2];
|
|
1490
|
-
|
|
1491
|
-
[TDAnalytics setDistinctId:@"Thinker" withAppId:appId_2];
|
|
1492
|
-
|
|
1493
|
-
// Set static common properties
|
|
1494
|
-
[TDAnalytics setSuperProperties:@{@"channel": @"ta",} withAppId:appId_1];
|
|
1495
|
-
[TDAnalytics setSuperProperties:@{@"channel": @"ta",} withAppId:appId_2];
|
|
1496
|
-
[TDAnalytics unsetSuperProperty:@"isTest" withAppId:appId_1];
|
|
1497
|
-
[TDAnalytics clearSuperPropertiesWithAppId:appId_1];
|
|
1498
|
-
[TDAnalytics getSuperPropertiesWithAppId:appId_1];
|
|
1499
|
-
[TDAnalytics setDynamicSuperProperties:^NSDictionary * **_Nonnull**{
|
|
1500
|
-
**return** @{@"now": [NSDate date]};
|
|
1501
|
-
} withAppId:appId_1];
|
|
1502
|
-
|
|
1503
|
-
// Enable auto tracking
|
|
1504
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAppInstall | TDAutoTrackEventTypeAppStart | TDAutoTrackEventTypeAppEnd withAppId:appId_1];
|
|
1505
|
-
// Ignore auto tracking events for a certain page
|
|
1506
|
-
[TDAnalytics ignoreAutoTrackViewControllers:@[] withAppId:appId_1];
|
|
1507
|
-
[TDAnalytics setAutoTrackProperties:TDAutoTrackEventTypeAll properties:@{@"auto_key2": @"auto_value2"} withAppId:appId_1];
|
|
1508
|
-
|
|
1509
|
-
// Report normal event
|
|
1510
|
-
[TDAnalytics track:@"product_buy" withAppId:appId_1];
|
|
1511
|
-
|
|
1512
|
-
// Report first-time event
|
|
1513
|
-
TDFirstEventModel *firstModel = [[TDFirstEventModel alloc] initWithEventName:@"device_activation" firstCheckID:@"TD"];
|
|
1514
|
-
firstModel.properties = @{@"key":@"value"};
|
|
1515
|
-
[TDAnalytics trackWithEventModel:firstModel withAppId:appId_1];
|
|
1516
|
-
|
|
1517
|
-
// Report updatable event
|
|
1518
|
-
TDUpdateEventModel *updateModel = [[TDUpdateEventModel alloc] initWithEventName:@"UPDATABLE_EVENT" eventID:@"test_event_id"];
|
|
1519
|
-
updateModel.properties = @{@"status": @3, @"price": @100};
|
|
1520
|
-
[TDAnalytics trackWithEventModel:updateModel withAppId:appId_1];
|
|
1521
|
-
|
|
1522
|
-
// Report overwritable event
|
|
1523
|
-
TDOverwriteEventModel *overwriteModel = [[TDOverwriteEventModel alloc] initWithEventName:@"OVERWRITE_EVENT" eventID:@"test_event_id"];
|
|
1524
|
-
overwriteModel.properties = @{@"status": @3, @"price": @100};
|
|
1525
|
-
[TDAnalytics trackWithEventModel:overwriteModel withAppId:appId_1];
|
|
1526
|
-
|
|
1527
|
-
// The following example completes statistics of user stay duration on a product page
|
|
1528
|
-
[TDAnalytics timeEvent:@"stay_shop" withAppId:appId_1];
|
|
1529
|
-
/*
|
|
1530
|
-
do someting .......
|
|
1531
|
-
*/
|
|
1532
|
-
// User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
1533
|
-
[TDAnalytics track:@"stay_shop" withAppId:appId_1];
|
|
1534
|
-
|
|
1535
|
-
// Logout
|
|
1536
|
-
[TDAnalytics logoutWithAppId:appId_1];
|
|
1537
|
-
|
|
1538
|
-
// User properties
|
|
1539
|
-
[TDAnalytics userSet:@{@"username": @"ThinkingData"} withAppId:appId_2];
|
|
1540
|
-
[TDAnalytics userSetOnce:@{@"first_payment_time": @"2018-01-01 01:23:45.678"} withAppId:appId_1];
|
|
1541
|
-
[TDAnalytics userAdd:@{@"total_revenue": @30} withAppId:appId_1];
|
|
1542
|
-
[TDAnalytics userUnset:@"key" withAppId:appId_1];
|
|
1543
|
-
[TDAnalytics userDeleteWithAppId:appId_1];
|
|
1544
|
-
[TDAnalytics userAppend:@{@"user_list": @[@"apple", @"ball"]} withAppId:appId_1];
|
|
1545
|
-
[TDAnalytics userUniqAppend:@{@"user_list":@[@"apple", @"cube"]} withAppId:appId_1];
|
|
1546
|
-
|
|
1547
|
-
// Integrate H5 page data
|
|
1548
|
-
[TDAnalytics addWebViewUserAgent];
|
|
1549
|
-
|
|
1550
|
-
// Get device ID
|
|
1551
|
-
[TDAnalytics getDeviceId];
|
|
1552
|
-
|
|
1553
|
-
[TDAnalytics flushWithAppId:appId_1];
|
|
1554
|
-
|
|
1555
|
-
// Third-party data integration
|
|
1556
|
-
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeAppsFlyer withAppId:appId_1];
|
|
1557
|
-
```
|
|
1558
|
-
|
|
1559
|
-
Please note that multiple SDK instances' APPID must be different. Most data between multiple instances is not shared. For details, please refer to Section IV "Multiple Instance Data and Settings Sharing".
|
|
1560
|
-
|
|
1561
|
-
### III. Create Lightweight Instance
|
|
1562
|
-
|
|
1563
|
-
In iOS SDK 3.0.0 version, you can create multiple instances under the same APPID through lightweight instance method
|
|
1564
|
-
|
|
1565
|
-
```
|
|
1566
|
-
// Original project
|
|
1567
|
-
NSString *appId = @"appId";
|
|
1568
|
-
NSString *receiverUrl = @"https://receiver-ta-preview.thinkingdata.cn";
|
|
1569
|
-
[TDAnalytics startAnalyticsWithAppId:appId serverUrl:receiverUrl];
|
|
1570
|
-
|
|
1571
|
-
// Create lightweight instance through original project
|
|
1572
|
-
NSString *lightProjectAppId = [TDAnalytics lightInstanceIdWithAppId:appId];
|
|
1573
|
-
|
|
1574
|
-
// Report event
|
|
1575
|
-
[TDAnalytics track:@"event" withAppId:lightProjectAppId];
|
|
1576
|
-
|
|
1577
|
-
// User properties
|
|
1578
|
-
[TDAnalytics userSet:@{@"age": 18} withAppId:lightProjectAppId];
|
|
1579
|
-
```
|
|
1580
|
-
|
|
1581
|
-
Child lightweight instance and parent instance have the same APPID, reporting address and some settings, but other information is not shared. For details, please refer to Section IV "Multiple Instance Data and Settings Sharing".
|
|
1582
|
-
|
|
1583
|
-
### IV. Multiple Instance Data and Settings Sharing
|
|
1584
|
-
|
|
1585
|
-
Most interfaces are called by instance objects, so most data and settings are not shared between multiple APPID instances, parent instance and lightweight instance. But some data and settings will take effect for all instances. The following is detailed explanation of whether all data and settings are shared between multiple instances:
|
|
1586
|
-
|
|
1587
|
-
- Account related information
|
|
1588
|
-
- System default generated visitor ID `#distinct_id`: Shared
|
|
1589
|
-
- Visitor ID `#distinct_id` set by calling `setDistinctId`: Not shared
|
|
1590
|
-
- Account ID `#account_id` set by calling `login`: Not shared
|
|
1591
|
-
- Event reporting `track` and user property reporting `userSet`, `userSetOnce`, `userAdd`, `userDelete`: Not shared
|
|
1592
|
-
- Common properties `setSuperProperties` and dynamic common properties `setDynamicSuperProperties`: Not shared
|
|
1593
|
-
- SDK configuration information whether shared between multiple instances:
|
|
1594
|
-
- Reporting strategy related (i.e. reporting interval time and data volume per batch): Shared, determined by the first instantiated APPID corresponding project data
|
|
1595
|
-
- Upload network condition `setNetworkType`: Shared
|
|
1596
|
-
- Auto tracking events
|
|
1597
|
-
- Recommend enabling auto tracking events on only one instance
|
|
1598
|
-
- Support reporting auto tracking events to multiple APP IDs
|
|
1599
|
-
- Auto tracking event settings can take effect for single APPID instance only. For details, please refer to iOS SDK Auto Tracking Guide
|
|
1600
|
-
- Record event duration `timeEvent`: Not shared
|
|
1601
|
-
|
|
1602
|
-
---
|
|
1603
|
-
|
|
1604
|
-
# Real-time Debugging
|
|
1605
|
-
|
|
1606
|
-
During SDK integration, you can perform real-time debugging by viewing SDK logs in IDE console or using TE's Debug feature.
|
|
1607
|
-
|
|
1608
|
-
### I. Print SDK Logs
|
|
1609
|
-
|
|
1610
|
-
:::: el-tabs
|
|
1611
|
-
|
|
1612
|
-
::: el-tab-pane label=Objective-C
|
|
1613
|
-
|
|
1614
|
-
```
|
|
1615
|
-
[TDAnalytics enableLog:**YES**];
|
|
1616
|
-
```
|
|
1617
|
-
|
|
1618
|
-
:::
|
|
1619
|
-
|
|
1620
|
-
::: el-tab-pane label=Swift
|
|
1621
|
-
|
|
1622
|
-
```
|
|
1623
|
-
TDAnalytics.enableLog(**true**)
|
|
1624
|
-
```
|
|
1625
|
-
|
|
1626
|
-
:::
|
|
1627
|
-
|
|
1628
|
-
::::
|
|
1629
|
-
|
|
1630
|
-
<!-- unsupported block: 34 -->
|
|
1631
|
-
|
|
1632
|
-
After enabling logs, you can filter ThinkingData related logs in IDE to observe SDK data reporting.
|
|
1633
|
-
|
|
1634
|
-
### II. Enable Debug Mode
|
|
1635
|
-
|
|
1636
|
-
Enabling Debug mode requires the following two steps:
|
|
1637
|
-
|
|
1638
|
-
1. Client enables Debug mode
|
|
1639
|
-
The following is example code for client enabling Debug mode:
|
|
1640
|
-
|
|
1641
|
-
:::: el-tabs
|
|
1642
|
-
|
|
1643
|
-
::: el-tab-pane label=Objective-C
|
|
1644
|
-
|
|
1645
|
-
```
|
|
1646
|
-
NSString *appid = @"appId";
|
|
1647
|
-
NSString *url = @"https://receiver-ta-preview.thinkingdata.cn";
|
|
1648
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
1649
|
-
config.appid = appid;
|
|
1650
|
-
config.serverUrl = url;
|
|
1651
|
-
/*
|
|
1652
|
-
Set running mode to Debug mode
|
|
1653
|
-
Normal mode: Data will be stored in cache and reported according to certain cache strategy. Default is normal mode. Recommended for production environment.
|
|
1654
|
-
Debug mode: Data is reported one by one. When problems occur, will prompt user through logs and exceptions. Not recommended for production environment.
|
|
1655
|
-
DebugOnly mode: Only validates data, will not store. Not recommended for production environment.
|
|
1656
|
-
*/
|
|
1657
|
-
config.mode = TDModeDebug;
|
|
1658
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
1659
|
-
```
|
|
1660
|
-
|
|
1661
|
-
:::
|
|
1662
|
-
|
|
1663
|
-
::: el-tab-pane label=Swift
|
|
1664
|
-
|
|
1665
|
-
```
|
|
1666
|
-
let appid = "APPID";
|
|
1667
|
-
let url = "SERVER_URL";
|
|
1668
|
-
let config = TDConfig(appId: appid, serverUrl: url)
|
|
1669
|
-
config.mode = TDMode.debug
|
|
1670
|
-
TDAnalytics.start(with: config)
|
|
1671
|
-
```
|
|
1672
|
-
|
|
1673
|
-
:::
|
|
1674
|
-
|
|
1675
|
-
::::
|
|
1676
|
-
|
|
1677
|
-
1. TE backend add Debug device
|
|
1678
|
-
To avoid Debug mode being launched in production environment, only specified devices can enable Debug mode. Only devices that have enabled Debug mode on client and device ID configured in TE backend's "Tracking Management" page's "Debug Data" section can enable Debug mode.
|
|
1679
|
-
|
|
1680
|
-
Device ID can be obtained through the following three ways:
|
|
1681
|
-
|
|
1682
|
-
- #device_id property in event data on TE platform
|
|
1683
|
-
- Client log: SDK will print device DeviceId after initialization is complete
|
|
1684
|
-
- Through instance interface call: Get device ID
|
|
1685
|
-
<!-- unsupported block: 34 -->
|
|
1686
|
-
|
|
1687
|
-
Debug mode may affect data collection quality and App stability. Only use for integration phase data validation. Do not use in production environment.
|
|
1688
|
-
|
|
1689
|
-
---
|
|
1690
|
-
|
|
1691
|
-
# Auto Tracking
|
|
1692
|
-
|
|
1693
|
-
### I. Auto Tracking Introduction
|
|
1694
|
-
|
|
1695
|
-
TE system provides automated data collection interface. You can choose the data to be automatically collected according to business requirements.
|
|
1696
|
-
|
|
1697
|
-
Currently supported automated data collection:
|
|
1698
|
-
|
|
1699
|
-
1. APP installation, records APP being installed
|
|
1700
|
-
1. APP start, including opening APP and waking from background
|
|
1701
|
-
1. APP close, including closing APP and entering background, also collects start duration
|
|
1702
|
-
1. User browsing pages in APP (native pages)
|
|
1703
|
-
1. User clicking controls in APP
|
|
1704
|
-
1. APP crash information when APP crashes
|
|
1705
|
-
Next will introduce each data collection method in detail
|
|
1706
|
-
|
|
1707
|
-
### II. Enable Auto Tracking
|
|
1708
|
-
|
|
1709
|
-
You can call `enableAutoTrack:` to enable auto tracking feature:
|
|
1710
|
-
|
|
1711
|
-
```
|
|
1712
|
-
[TDAnalytics enableAutoTrack:
|
|
1713
|
-
TDAutoTrackEventTypeAppStart |// APP start event
|
|
1714
|
-
TDAutoTrackEventTypeAppInstall |// APP install event
|
|
1715
|
-
TDAutoTrackEventTypeAppEnd |// APP close event
|
|
1716
|
-
TDAutoTrackEventTypeAppViewScreen |// APP browse page event
|
|
1717
|
-
TDAutoTrackEventTypeAppClick |// APP click control event
|
|
1718
|
-
TDAutoTrackEventTypeAppViewCrash];// APP crash event
|
|
1719
|
-
```
|
|
1720
|
-
|
|
1721
|
-
### III. Auto Tracking Event Details
|
|
1722
|
-
|
|
1723
|
-
#### 3.1 APP Install Event
|
|
1724
|
-
|
|
1725
|
-
APP install event will record the actual installation of APP. It is reported when APP starts. Event trigger time is the first start time after APP installation. APP upgrade will not trigger install event, but reinstall after deletion will report install event.
|
|
1726
|
-
|
|
1727
|
-
- Event name: ta_app_install
|
|
1728
|
-
|
|
1729
|
-
#### 3.2 APP Start Event
|
|
1730
|
-
|
|
1731
|
-
APP start event will be triggered when user opens APP or wakes APP from background. Detailed event introduction:
|
|
1732
|
-
|
|
1733
|
-
- Event name: ta_app_start. Normal APP start process will trigger this event.
|
|
1734
|
-
- Preset property: `#resume_from_background`, boolean type, indicates whether APP is user opened or woke from background. Value true means woke from background, false means directly opened.
|
|
1735
|
-
- Event name: ta_app_bg_start. This event is triggered when APP starts in background. This event is not collected by default. Needs to enable configuration item during initialization:
|
|
1736
|
-
|
|
1737
|
-
```
|
|
1738
|
-
TDConfig *config = [[TDConfig alloc] init];
|
|
1739
|
-
config.appid = appId;
|
|
1740
|
-
config.serverUrl = serverUrl;
|
|
1741
|
-
|
|
1742
|
-
// Allow collecting events in background
|
|
1743
|
-
config.trackRelaunchedInBackgroundEvents = YES;
|
|
1744
|
-
|
|
1745
|
-
[TDAnalytics startAnalyticsWithConfig:config];
|
|
1746
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAll];
|
|
1747
|
-
```
|
|
1748
|
-
|
|
1749
|
-
#### 3.3 APP Close Event
|
|
1750
|
-
|
|
1751
|
-
APP close event will be triggered when user closes APP or puts APP to background. Detailed event introduction:
|
|
1752
|
-
|
|
1753
|
-
- Event name: ta_app_end
|
|
1754
|
-
- Preset property: `#duration`, numeric type, indicates the duration of this APP visit (from start to end), unit is seconds.
|
|
1755
|
-
|
|
1756
|
-
#### 3.4 APP Browse Page Event
|
|
1757
|
-
|
|
1758
|
-
APP browse page event will trigger browse page event when user switches page (View Controller). Detailed event introduction:
|
|
1759
|
-
|
|
1760
|
-
- Event name: ta_app_view
|
|
1761
|
-
- Preset properties:
|
|
1762
|
-
- `#screen_name`, string type, is View Controller class name
|
|
1763
|
-
- `#title`, string type, is View Controller title, value is `controller.navigationItem.title` property value
|
|
1764
|
-
You can add other properties to page browse event to extend its analysis value. The following is how to customize browse page event properties:
|
|
1765
|
-
|
|
1766
|
-
##### 3.4.1 Customize Page Browse Event Properties
|
|
1767
|
-
|
|
1768
|
-
For View Controller inherited from `UIViewController`, you can set properties and page URL information by implementing Protocol `<TDScreenAutoTracker>`. SDK will automatically add `getTrackProperties` return value to this View Controller's APP browse page event. Additionally, `getScreenUrl` return value will be used as this page's URL Schema. When this page's browse event is triggered, preset property `#url` will be added, value is current page's URL Schema. Meanwhile, SDK will get the URL Schema of the previous page. If it can be obtained, it will be added to preset property `#referrer` as the forward address.
|
|
1769
|
-
|
|
1770
|
-
```
|
|
1771
|
-
@interface MYController : UITableViewController<TDScreenAutoTracker>
|
|
1772
|
-
@end
|
|
1773
|
-
|
|
1774
|
-
@implementation MYController
|
|
1775
|
-
|
|
1776
|
-
// Set for all APPID instances
|
|
1777
|
-
|
|
1778
|
-
- (NSDictionary *)getTrackProperties {
|
|
1779
|
-
return @{@"PageName" : @"Product Detail Page", @"ProductId" : @12345};
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
- (NSString *)getScreenUrl {
|
|
1783
|
-
return @"APP://test";
|
|
1784
|
-
|
|
1785
|
-
/** Set separately for multiple APPID instances
|
|
1786
|
-
* - (NSDictionary *)getTrackPropertiesWithAppid{
|
|
1787
|
-
* return @{@"appid1" : @{@"testTrackProperties" : @"Test Page"},
|
|
1788
|
-
* @"appid2" : @{@"testTrackProperties2" : @"Test Page 2"},
|
|
1789
|
-
* };
|
|
1790
|
-
* }
|
|
1791
|
-
* -(NSDictionary *)getScreenUrlWithAppid {
|
|
1792
|
-
* return @{@"appid1" : @"APP://test1",
|
|
1793
|
-
* @"appid2" : @"APP://test2",
|
|
1794
|
-
* };
|
|
1795
|
-
* }
|
|
1796
|
-
*/
|
|
1797
|
-
|
|
1798
|
-
}
|
|
1799
|
-
@end
|
|
1800
|
-
```
|
|
1801
|
-
|
|
1802
|
-
Related preset properties:
|
|
1803
|
-
|
|
1804
|
-
- `#url`, string type, indicates the URL of browsed page
|
|
1805
|
-
- `#referrer`, string type, indicates the URL of the page before page jump
|
|
1806
|
-
|
|
1807
|
-
#### 3.5 APP Control Click Event
|
|
1808
|
-
|
|
1809
|
-
APP control click event will be triggered when user clicks control
|
|
1810
|
-
|
|
1811
|
-
- Event name: ta_app_click
|
|
1812
|
-
- Preset properties:
|
|
1813
|
-
- `#screen_name`, string type, is the class name of the View Controller where control is located
|
|
1814
|
-
- `#element_content`, string type, is the content of control
|
|
1815
|
-
- `#element_type`, string type, is the type of control
|
|
1816
|
-
- `#element_position`, string type, only exists when control type is `UITableView` or `UICollectionView`, indicates the position where control is clicked, value is `Section Row`
|
|
1817
|
-
For click events on page View, there are multiple ways to set more properties to extend its analysis value:
|
|
1818
|
-
|
|
1819
|
-
##### 3.5.1 Set Control Element ID
|
|
1820
|
-
|
|
1821
|
-
You can set element ID for page elements (View) to distinguish elements with different meanings. You can use the following method to set element ID:
|
|
1822
|
-
|
|
1823
|
-
```
|
|
1824
|
-
// Set for all APPID instances
|
|
1825
|
-
self.table1.thinkingAnalyticsViewID = @"testtable1";
|
|
1826
|
-
|
|
1827
|
-
// Set separately for multiple APPID instances
|
|
1828
|
-
self.table1.thinkingAnalyticsViewIDWithAppid = @{ @"app1" : @"testtableID2",
|
|
1829
|
-
@"app2" : @"testtableID3" };
|
|
1830
|
-
```
|
|
1831
|
-
|
|
1832
|
-
At this time, `table1` click event will add preset property `#element_id`, value is the passed value here
|
|
1833
|
-
|
|
1834
|
-
- Related preset property: `#element_id`, string type, indicates the custom ID of this element
|
|
1835
|
-
|
|
1836
|
-
##### 3.5.2 Customize Control Click Event Properties
|
|
1837
|
-
|
|
1838
|
-
For most controls, you can directly use `thinkingAnalyticsViewProperties` to set custom properties:
|
|
1839
|
-
|
|
1840
|
-
```
|
|
1841
|
-
// Set for all APPID instances
|
|
1842
|
-
self.table1.thinkingAnalyticsViewProperties = @{@"key1":@"value1"};
|
|
1843
|
-
|
|
1844
|
-
// Set separately for multiple APPID instances
|
|
1845
|
-
self.table1.thinkingAnalyticsViewPropertiesWithAppid = @{@"app1":@{@"tablekey":@"tablevalue"},
|
|
1846
|
-
@"app2":@{@"tablekey2":@"tablevalue2"}
|
|
1847
|
-
};
|
|
1848
|
-
```
|
|
1849
|
-
|
|
1850
|
-
##### 3.5.3 `UITableView` and `UICollectionView` Control Click Event Properties
|
|
1851
|
-
|
|
1852
|
-
For `UITableView` and `UICollectionView`, you need to implement Protocol `<TDUIViewAutoTrackDelegate>` to set custom properties:
|
|
1853
|
-
|
|
1854
|
-
1. First implement Protocol `<TDUIViewAutoTrackDelegate>` in View Controller class
|
|
1855
|
-
|
|
1856
|
-
2. Then set delegate in the class. Recommend setting in `viewDidLoad` method
|
|
1857
|
-
|
|
1858
|
-
```
|
|
1859
|
-
self.table1.thinkingAnalyticsDelegate = self;
|
|
1860
|
-
```
|
|
1861
|
-
|
|
1862
|
-
- `table1` can be replaced with View that needs custom properties
|
|
1863
|
-
|
|
1864
|
-
3. Then implement method according to View Controller type
|
|
1865
|
-
|
|
1866
|
-
- This is the method `UITableView` needs to implement
|
|
1867
|
-
|
|
1868
|
-
```
|
|
1869
|
-
// Set for all APPID instances, set UITableView custom properties
|
|
1870
|
-
-(NSDictionary *) thinkingAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath
|
|
1871
|
-
{
|
|
1872
|
-
return @{@"testProperty":@"test"};
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
/** Set separately for multiple APPID instances
|
|
1876
|
-
* -(NSDictionary *) thinkingAnalyticsWithAppid_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath {
|
|
1877
|
-
* return @{@"app1":@{@"autoPro":@"tablevalue"},
|
|
1878
|
-
* @"app2":@{@"autoPro2":@"tablevalue2"}
|
|
1879
|
-
* };
|
|
1880
|
-
* }
|
|
1881
|
-
*/
|
|
1882
|
-
```
|
|
1883
|
-
|
|
1884
|
-
- This is the method `UICollectionView` needs to implement
|
|
1885
|
-
|
|
1886
|
-
```
|
|
1887
|
-
// Set for all APPID instances, set UICollectionView custom properties
|
|
1888
|
-
-(NSDictionary *) thinkingAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath;
|
|
1889
|
-
{
|
|
1890
|
-
return @{@"testProperty":@"test"};
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
/** Set separately for multiple APPID instances
|
|
1894
|
-
* - (NSDictionary *)thinkingAnalyticsWithAppid_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath {
|
|
1895
|
-
* return @{@"app1":@{@"autoProCOLL":@"tablevalueCOLL"},
|
|
1896
|
-
* @"app2":@{@"autoProCOLL2":@"tablevalueCOLL2"}
|
|
1897
|
-
* };
|
|
1898
|
-
* }
|
|
1899
|
-
*/
|
|
1900
|
-
```
|
|
1901
|
-
|
|
1902
|
-
4. Finally, set `thinkingAnalyticsDelegate` to `nil` in `viewWillDisappear` method in the class
|
|
1903
|
-
|
|
1904
|
-
```
|
|
1905
|
-
-(void)viewWillDisappear:(BOOL)animated
|
|
1906
|
-
{
|
|
1907
|
-
[super viewWillDisappear:animated];
|
|
1908
|
-
self.table1.thinkingAnalyticsDelegate = nil;
|
|
1909
|
-
}
|
|
1910
|
-
```
|
|
1911
|
-
|
|
1912
|
-
- `table1` can be replaced with View that needs custom properties, corresponding to when delegate is set
|
|
1913
|
-
|
|
1914
|
-
#### 3.6 APP Crash Event
|
|
1915
|
-
|
|
1916
|
-
When APP has uncaught exception, APP crash event will be reported
|
|
1917
|
-
|
|
1918
|
-
- Event name: ta_app_crash
|
|
1919
|
-
- Preset properties:
|
|
1920
|
-
- `#app_crashed_reason`, character type, records stack trace when crash occurs
|
|
1921
|
-
|
|
1922
|
-
### IV. Ignore Auto Tracking Events
|
|
1923
|
-
|
|
1924
|
-
You can ignore auto tracking events for certain pages or controls through the following ways
|
|
1925
|
-
|
|
1926
|
-
#### 4.1 Ignore Auto Tracking Events for a Certain Page
|
|
1927
|
-
|
|
1928
|
-
For certain pages (View Controller), if you don't want to transfer auto tracking events (including page browse and control click events), you can ignore through the following method:
|
|
1929
|
-
|
|
1930
|
-
```
|
|
1931
|
-
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
1932
|
-
[array addObject:@"IgnoredViewController"];
|
|
1933
|
-
|
|
1934
|
-
// Ignore auto tracking events for a certain page
|
|
1935
|
-
[TDAnalytics ignoreAutoTrackViewControllers:array];
|
|
1936
|
-
```
|
|
1937
|
-
|
|
1938
|
-
#### 4.2 Ignore Click Events for a Certain Type of Control
|
|
1939
|
-
|
|
1940
|
-
If you need to ignore click events for a certain type of control, you can ignore through the following method
|
|
1941
|
-
|
|
1942
|
-
```
|
|
1943
|
-
// Ignore all controls of a certain type
|
|
1944
|
-
[TDAnalytics ignoreViewType:[IgnoredClass class]];
|
|
1945
|
-
```
|
|
1946
|
-
|
|
1947
|
-
- `ignoredClass` is the control type that needs to be ignored
|
|
1948
|
-
|
|
1949
|
-
#### 4.3 Ignore Click Events for a Certain Element (View)
|
|
1950
|
-
|
|
1951
|
-
If you want to ignore click events for a certain element (View), you can ignore through the following method
|
|
1952
|
-
|
|
1953
|
-
```
|
|
1954
|
-
// Set for all APPID instances
|
|
1955
|
-
self.table1.thinkingAnalyticsIgnoreView = YES;
|
|
1956
|
-
|
|
1957
|
-
// Set separately for multiple APPID instances
|
|
1958
|
-
// self.table2.thinkingAnalyticsIgnoreViewWithAppid = @{@"appid1" : @YES,@"appid2" : @NO};
|
|
1959
|
-
```
|
|
1960
|
-
|
|
1961
|
-
- `table1` can be replaced with View that needs to be ignored
|
|
1962
|
-
|
|
1963
|
-
### V. Auto Tracking Event Preset Properties
|
|
1964
|
-
|
|
1965
|
-
The following preset properties are unique preset properties in each auto tracking event
|
|
1966
|
-
|
|
1967
|
-
- APP Start Event (ta_app_start) Preset Properties
|
|
1968
|
-
**Property Name**
|
|
1969
|
-
|
|
1970
|
-
**Chinese Name**
|
|
1971
|
-
|
|
1972
|
-
**Property Type**
|
|
1973
|
-
|
|
1974
|
-
**Description**
|
|
1975
|
-
|
|
1976
|
-
#resume_from_background
|
|
1977
|
-
|
|
1978
|
-
Whether resumed from background
|
|
1979
|
-
|
|
1980
|
-
Boolean
|
|
1981
|
-
|
|
1982
|
-
Indicates whether APP is opened or woke from background. Value true means woke from background, false means directly opened
|
|
1983
|
-
|
|
1984
|
-
#start_reason
|
|
1985
|
-
|
|
1986
|
-
Start reason
|
|
1987
|
-
|
|
1988
|
-
Text
|
|
1989
|
-
|
|
1990
|
-
Indicates APP start reason. Value is string type. Currently supports collecting deeplink, push, 3dtouch start reasons.
|
|
1991
|
-
|
|
1992
|
-
#background_duration
|
|
1993
|
-
|
|
1994
|
-
Background stay duration
|
|
1995
|
-
|
|
1996
|
-
Numeric
|
|
1997
|
-
|
|
1998
|
-
Unit is seconds
|
|
1999
|
-
|
|
2000
|
-
- APP Close Event (ta_app_end) Preset Properties
|
|
2001
|
-
**Property Name**
|
|
2002
|
-
|
|
2003
|
-
**Chinese Name**
|
|
2004
|
-
|
|
2005
|
-
**Property Type**
|
|
2006
|
-
|
|
2007
|
-
**Description**
|
|
2008
|
-
|
|
2009
|
-
#duration
|
|
2010
|
-
|
|
2011
|
-
Event duration
|
|
2012
|
-
|
|
2013
|
-
Numeric
|
|
2014
|
-
|
|
2015
|
-
Indicates the duration of this APP visit (from start to end), unit is seconds
|
|
2016
|
-
|
|
2017
|
-
- APP Browse Page Event (ta_app_view) Preset Properties
|
|
2018
|
-
**Property Name**
|
|
2019
|
-
|
|
2020
|
-
**Chinese Name**
|
|
2021
|
-
|
|
2022
|
-
**Property Type**
|
|
2023
|
-
|
|
2024
|
-
**Description**
|
|
2025
|
-
|
|
2026
|
-
#title
|
|
2027
|
-
|
|
2028
|
-
Page title
|
|
2029
|
-
|
|
2030
|
-
Text
|
|
2031
|
-
|
|
2032
|
-
Is View Controller title, value is `controller.navigationItem.title` property value
|
|
2033
|
-
|
|
2034
|
-
#screen_name
|
|
2035
|
-
|
|
2036
|
-
Page name
|
|
2037
|
-
|
|
2038
|
-
Text
|
|
2039
|
-
|
|
2040
|
-
Is View Controller class name
|
|
2041
|
-
|
|
2042
|
-
#url
|
|
2043
|
-
|
|
2044
|
-
Page address
|
|
2045
|
-
|
|
2046
|
-
Text
|
|
2047
|
-
|
|
2048
|
-
Current page address, needs to call `getScreenUrl` to set url
|
|
2049
|
-
|
|
2050
|
-
#referrer
|
|
2051
|
-
|
|
2052
|
-
Forward address
|
|
2053
|
-
|
|
2054
|
-
Text
|
|
2055
|
-
|
|
2056
|
-
The address of the page before page jump. The page before jump needs to call `getScreenUrl` to set url
|
|
2057
|
-
|
|
2058
|
-
- APP Control Click Event (ta_app_click) Preset Properties
|
|
2059
|
-
**Property Name**
|
|
2060
|
-
|
|
2061
|
-
**Chinese Name**
|
|
2062
|
-
|
|
2063
|
-
**Property Type**
|
|
2064
|
-
|
|
2065
|
-
**Description**
|
|
2066
|
-
|
|
2067
|
-
#title
|
|
2068
|
-
|
|
2069
|
-
Page title
|
|
2070
|
-
|
|
2071
|
-
Text
|
|
2072
|
-
|
|
2073
|
-
Is View Controller title, value is `controller.navigationItem.title` property value
|
|
2074
|
-
|
|
2075
|
-
#screen_name
|
|
2076
|
-
|
|
2077
|
-
Page name
|
|
2078
|
-
|
|
2079
|
-
Text
|
|
2080
|
-
|
|
2081
|
-
Is View Controller class name
|
|
2082
|
-
|
|
2083
|
-
#element_id
|
|
2084
|
-
|
|
2085
|
-
Element ID
|
|
2086
|
-
|
|
2087
|
-
Text
|
|
2088
|
-
|
|
2089
|
-
Control ID, needs `thinkingAnalyticsViewID` to set
|
|
2090
|
-
|
|
2091
|
-
#element_type
|
|
2092
|
-
|
|
2093
|
-
Element type
|
|
2094
|
-
|
|
2095
|
-
Text
|
|
2096
|
-
|
|
2097
|
-
Control type
|
|
2098
|
-
|
|
2099
|
-
#element_selector
|
|
2100
|
-
|
|
2101
|
-
Element selector
|
|
2102
|
-
|
|
2103
|
-
Text
|
|
2104
|
-
|
|
2105
|
-
Is the concatenation of control's `viewPath`
|
|
2106
|
-
|
|
2107
|
-
#element_position
|
|
2108
|
-
|
|
2109
|
-
Element position
|
|
2110
|
-
|
|
2111
|
-
Text
|
|
2112
|
-
|
|
2113
|
-
Control position information. Only exists when control type is `UITableView` or `UICollectionView`. Indicates the position where control is clicked. Value is `Section:Row`
|
|
2114
|
-
|
|
2115
|
-
#element_content
|
|
2116
|
-
|
|
2117
|
-
Element content
|
|
2118
|
-
|
|
2119
|
-
Text
|
|
2120
|
-
|
|
2121
|
-
Content on control
|
|
2122
|
-
|
|
2123
|
-
- APP Crash Event (ta_app_crash) Preset Properties
|
|
2124
|
-
**Property Name**
|
|
2125
|
-
|
|
2126
|
-
**Chinese Name**
|
|
2127
|
-
|
|
2128
|
-
**Property Type**
|
|
2129
|
-
|
|
2130
|
-
**Description**
|
|
2131
|
-
|
|
2132
|
-
#app_crashed_reason
|
|
2133
|
-
|
|
2134
|
-
Exception information
|
|
2135
|
-
|
|
2136
|
-
Text
|
|
2137
|
-
|
|
2138
|
-
Character type, records stack trace when crash occurs
|
|
2139
|
-
|
|
2140
|
-
### VI. Set Custom Properties for Auto Tracking Events
|
|
2141
|
-
|
|
2142
|
-
You can call `enableAutoTrack:properties:` to enable auto tracking feature and set custom properties
|
|
2143
|
-
|
|
2144
|
-
```
|
|
2145
|
-
// Auto tracking custom properties
|
|
2146
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAll properties:@{@"auto_key1": @"auto_value1"}];
|
|
2147
|
-
```
|
|
2148
|
-
|
|
2149
|
-
You can also call `setAutoTrackProperties:properties:` to set or update custom properties
|
|
2150
|
-
|
|
2151
|
-
```
|
|
2152
|
-
[TDAnalytics setAutoTrackProperties:TDAutoTrackEventTypeAll properties:@{@"auto_key2": @"auto_value2"}];
|
|
2153
|
-
```
|
|
2154
|
-
|
|
2155
|
-
### VII. Auto Tracking Event Callback
|
|
2156
|
-
|
|
2157
|
-
From v2.7.4, auto tracking event callback is supported. You can call `enableAutoTrack:callback:` to enable auto tracking feature. You can add and update properties in callback.
|
|
2158
|
-
|
|
2159
|
-
```
|
|
2160
|
-
[TDAnalytics enableAutoTrack:TDAutoTrackEventTypeAll callback:^NSDictionary * **_Nonnull**(TDAutoTrackEventType eventType, NSDictionary * **_Nonnull** properties) {
|
|
2161
|
-
**if** (eventType == TDAutoTrackEventTypeAppStart) {
|
|
2162
|
-
**return** @{@"addkey":@"addvalue"};
|
|
2163
|
-
}
|
|
2164
|
-
**if** (eventType == TDAutoTrackEventTypeAppEnd) {
|
|
2165
|
-
**return** @{@"updatekey":@"updatevalue"};
|
|
2166
|
-
}
|
|
2167
|
-
**return** @{};
|
|
2168
|
-
}];
|
|
2169
|
-
```
|
|
2170
|
-
|
|
2171
|
-
<!-- unsupported block: 34 -->
|
|
2172
|
-
|
|
2173
|
-
Please do not perform time-consuming operations in this callback, otherwise it will affect normal data storage
|
|
2174
|
-
|
|
2175
|
-
---
|
|
2176
|
-
|
|
2177
|
-
# Preset Properties
|
|
2178
|
-
|
|
2179
|
-
### I. Preset Properties for All Events
|
|
2180
|
-
|
|
2181
|
-
The following preset properties are preset properties that all events in iOS SDK (including auto tracking events) will have
|
|
2182
|
-
|
|
2183
|
-
**Property Name**
|
|
2184
|
-
|
|
2185
|
-
**Chinese Name**
|
|
2186
|
-
|
|
2187
|
-
**Property Type**
|
|
2188
|
-
|
|
2189
|
-
**Collection Time**
|
|
2190
|
-
|
|
2191
|
-
**Description**
|
|
2192
|
-
|
|
2193
|
-
#ip
|
|
2194
|
-
|
|
2195
|
-
IP address
|
|
2196
|
-
|
|
2197
|
-
Text
|
|
2198
|
-
|
|
2199
|
-
Server collection
|
|
2200
|
-
|
|
2201
|
-
User's IP address. TE will use this to get user's geographic location information
|
|
2202
|
-
|
|
2203
|
-
#country
|
|
2204
|
-
|
|
2205
|
-
Country
|
|
2206
|
-
|
|
2207
|
-
Text
|
|
2208
|
-
|
|
2209
|
-
Server collection
|
|
2210
|
-
|
|
2211
|
-
User's country, generated based on IP address
|
|
2212
|
-
|
|
2213
|
-
#country_code
|
|
2214
|
-
|
|
2215
|
-
Country code
|
|
2216
|
-
|
|
2217
|
-
Text
|
|
2218
|
-
|
|
2219
|
-
Server collection
|
|
2220
|
-
|
|
2221
|
-
User's country code (ISO 3166-1 alpha-2, i.e. two uppercase English letters), generated based on IP address
|
|
2222
|
-
|
|
2223
|
-
#province
|
|
2224
|
-
|
|
2225
|
-
Province
|
|
2226
|
-
|
|
2227
|
-
Text
|
|
2228
|
-
|
|
2229
|
-
Server collection
|
|
2230
|
-
|
|
2231
|
-
User's province, generated based on IP address
|
|
2232
|
-
|
|
2233
|
-
#city
|
|
2234
|
-
|
|
2235
|
-
City
|
|
2236
|
-
|
|
2237
|
-
Text
|
|
2238
|
-
|
|
2239
|
-
Server collection
|
|
2240
|
-
|
|
2241
|
-
User's city, generated based on IP address
|
|
2242
|
-
|
|
2243
|
-
#os_version
|
|
2244
|
-
|
|
2245
|
-
Operating system version
|
|
2246
|
-
|
|
2247
|
-
Text
|
|
2248
|
-
|
|
2249
|
-
Collected once at initialization
|
|
2250
|
-
|
|
2251
|
-
Displays operating system version number: 15.6.1
|
|
2252
|
-
|
|
2253
|
-
#manufacturer
|
|
2254
|
-
|
|
2255
|
-
Device manufacturer
|
|
2256
|
-
|
|
2257
|
-
Text
|
|
2258
|
-
|
|
2259
|
-
Collected once at initialization
|
|
2260
|
-
|
|
2261
|
-
User device's manufacturer, such as Apple
|
|
2262
|
-
|
|
2263
|
-
#os
|
|
2264
|
-
|
|
2265
|
-
Operating system
|
|
2266
|
-
|
|
2267
|
-
Text
|
|
2268
|
-
|
|
2269
|
-
Collected once at initialization
|
|
2270
|
-
|
|
2271
|
-
Such as iOS etc.
|
|
2272
|
-
|
|
2273
|
-
#device_id
|
|
2274
|
-
|
|
2275
|
-
Device ID
|
|
2276
|
-
|
|
2277
|
-
Text
|
|
2278
|
-
|
|
2279
|
-
Collected once at initialization
|
|
2280
|
-
|
|
2281
|
-
User's device ID. iOS takes user's IDFV or UUID
|
|
2282
|
-
|
|
2283
|
-
#device_type
|
|
2284
|
-
|
|
2285
|
-
Device type
|
|
2286
|
-
|
|
2287
|
-
Text
|
|
2288
|
-
|
|
2289
|
-
Collected once at initialization
|
|
2290
|
-
|
|
2291
|
-
Device type, such as iPhone, iPad
|
|
2292
|
-
|
|
2293
|
-
#screen_height
|
|
2294
|
-
|
|
2295
|
-
Screen height
|
|
2296
|
-
|
|
2297
|
-
Numeric
|
|
2298
|
-
|
|
2299
|
-
Collected once at initialization
|
|
2300
|
-
|
|
2301
|
-
User device's screen height, such as 667 etc.
|
|
2302
|
-
|
|
2303
|
-
#screen_width
|
|
2304
|
-
|
|
2305
|
-
Screen width
|
|
2306
|
-
|
|
2307
|
-
Numeric
|
|
2308
|
-
|
|
2309
|
-
Collected once at initialization
|
|
2310
|
-
|
|
2311
|
-
User device's screen height, such as 375 etc.
|
|
2312
|
-
|
|
2313
|
-
#device_model
|
|
2314
|
-
|
|
2315
|
-
Device model
|
|
2316
|
-
|
|
2317
|
-
Text
|
|
2318
|
-
|
|
2319
|
-
Collected once at initialization
|
|
2320
|
-
|
|
2321
|
-
User device's model, such as iPhone12,8 etc.
|
|
2322
|
-
|
|
2323
|
-
#app_version
|
|
2324
|
-
|
|
2325
|
-
APP version
|
|
2326
|
-
|
|
2327
|
-
Text
|
|
2328
|
-
|
|
2329
|
-
Collected once at initialization
|
|
2330
|
-
|
|
2331
|
-
Your APP's version
|
|
2332
|
-
|
|
2333
|
-
#bundle_id
|
|
2334
|
-
|
|
2335
|
-
Application unique identifier
|
|
2336
|
-
|
|
2337
|
-
Text
|
|
2338
|
-
|
|
2339
|
-
Collected once at initialization
|
|
2340
|
-
|
|
2341
|
-
Application package name
|
|
2342
|
-
|
|
2343
|
-
#lib
|
|
2344
|
-
|
|
2345
|
-
SDK type
|
|
2346
|
-
|
|
2347
|
-
Text
|
|
2348
|
-
|
|
2349
|
-
Collected when event occurs
|
|
2350
|
-
|
|
2351
|
-
SDK type you integrated, such as Android, iOS etc.
|
|
2352
|
-
|
|
2353
|
-
#lib_version
|
|
2354
|
-
|
|
2355
|
-
SDK version
|
|
2356
|
-
|
|
2357
|
-
Text
|
|
2358
|
-
|
|
2359
|
-
Collected when event occurs
|
|
2360
|
-
|
|
2361
|
-
SDK version you integrated
|
|
2362
|
-
|
|
2363
|
-
#network_type
|
|
2364
|
-
|
|
2365
|
-
Network status
|
|
2366
|
-
|
|
2367
|
-
Text
|
|
2368
|
-
|
|
2369
|
-
Collected once at initialization, collected when network status changes
|
|
2370
|
-
|
|
2371
|
-
Network status when uploading event, such as WIFI, 3G, 4G etc.
|
|
2372
|
-
|
|
2373
|
-
#carrier
|
|
2374
|
-
|
|
2375
|
-
Network carrier
|
|
2376
|
-
|
|
2377
|
-
Text
|
|
2378
|
-
|
|
2379
|
-
Collected once at initialization
|
|
2380
|
-
|
|
2381
|
-
User device's network carrier, such as China Mobile, China Telecom etc. In iOS 16.4 and later system versions, this field will not be collected
|
|
2382
|
-
|
|
2383
|
-
#zone_offset
|
|
2384
|
-
|
|
2385
|
-
Timezone offset
|
|
2386
|
-
|
|
2387
|
-
Numeric
|
|
2388
|
-
|
|
2389
|
-
Collected when event occurs
|
|
2390
|
-
|
|
2391
|
-
Data time offset hours relative to UTC time
|
|
2392
|
-
|
|
2393
|
-
#install_time
|
|
2394
|
-
|
|
2395
|
-
Program installation time
|
|
2396
|
-
|
|
2397
|
-
Time
|
|
2398
|
-
|
|
2399
|
-
Collected once at initialization
|
|
2400
|
-
|
|
2401
|
-
User's application installation time, value comes from system
|
|
2402
|
-
|
|
2403
|
-
#simulator
|
|
2404
|
-
|
|
2405
|
-
Whether is simulator
|
|
2406
|
-
|
|
2407
|
-
Numeric
|
|
2408
|
-
|
|
2409
|
-
Collected once at initialization
|
|
2410
|
-
|
|
2411
|
-
Whether device is simulator true/false
|
|
2412
|
-
|
|
2413
|
-
#ram
|
|
2414
|
-
|
|
2415
|
-
Device running memory status
|
|
2416
|
-
|
|
2417
|
-
Text
|
|
2418
|
-
|
|
2419
|
-
Collected when event occurs
|
|
2420
|
-
|
|
2421
|
-
User device's current remaining memory and total memory, unit GB, such as 1.4/2.4
|
|
2422
|
-
|
|
2423
|
-
#disk
|
|
2424
|
-
|
|
2425
|
-
Device storage space status
|
|
2426
|
-
|
|
2427
|
-
Text
|
|
2428
|
-
|
|
2429
|
-
Collected when event occurs
|
|
2430
|
-
|
|
2431
|
-
User device's current remaining storage space and total storage space, unit GB, such as 30/200
|
|
2432
|
-
|
|
2433
|
-
#fps
|
|
2434
|
-
|
|
2435
|
-
Device FPS
|
|
2436
|
-
|
|
2437
|
-
Numeric
|
|
2438
|
-
|
|
2439
|
-
Collected when event occurs
|
|
2440
|
-
|
|
2441
|
-
User device's current image frames per second, such as 60. (SDK after v3.2.0 does not collect this field by default)
|
|
2442
|
-
|
|
2443
|
-
#system_language
|
|
2444
|
-
|
|
2445
|
-
System language
|
|
2446
|
-
|
|
2447
|
-
Text
|
|
2448
|
-
|
|
2449
|
-
Collected when event occurs
|
|
2450
|
-
|
|
2451
|
-
User device's system language (ISO 639-1, i.e. two lowercase English letters), such as zh, en etc.
|
|
2452
|
-
|
|
2453
|
-
#relaunched_in_background
|
|
2454
|
-
|
|
2455
|
-
Whether app is in background
|
|
2456
|
-
|
|
2457
|
-
Numeric
|
|
2458
|
-
|
|
2459
|
-
Collected when event occurs
|
|
2460
|
-
|
|
2461
|
-
When APP starts in background, this property in collected events is YES.
|
|
2462
|
-
|
|
2463
|
-
When APP starts normally, collected events do not contain this property.
|
|
2464
|
-
|
|
2465
|
-
### II. Auto Tracking Event Preset Properties
|
|
2466
|
-
|
|
2467
|
-
The following preset properties are unique preset properties in each auto tracking event
|
|
2468
|
-
|
|
2469
|
-
- APP Start Event (ta_app_start) Preset Properties
|
|
2470
|
-
**Property Name**
|
|
2471
|
-
|
|
2472
|
-
**Chinese Name**
|
|
2473
|
-
|
|
2474
|
-
**Property Type**
|
|
2475
|
-
|
|
2476
|
-
**Description**
|
|
2477
|
-
|
|
2478
|
-
#resume_from_background
|
|
2479
|
-
|
|
2480
|
-
Whether resumed from background
|
|
2481
|
-
|
|
2482
|
-
Boolean
|
|
2483
|
-
|
|
2484
|
-
Indicates whether APP is opened or woke from background. Value true means woke from background, false means directly opened
|
|
2485
|
-
|
|
2486
|
-
#start_reason
|
|
2487
|
-
|
|
2488
|
-
Application start source
|
|
2489
|
-
|
|
2490
|
-
Text
|
|
2491
|
-
|
|
2492
|
-
Indicates APP start reason. Content is JSON string. Currently supports collecting deeplink, push, 3dtouch start reasons. Data example reference {url:"thinkingdata://","data":{}}
|
|
2493
|
-
|
|
2494
|
-
#backgroud_duration
|
|
2495
|
-
|
|
2496
|
-
Background stay duration
|
|
2497
|
-
|
|
2498
|
-
Numeric
|
|
2499
|
-
|
|
2500
|
-
Records the duration that application stays in background during the interval between two start events, unit is seconds
|
|
2501
|
-
|
|
2502
|
-
- APP Close Event (ta_app_end) Preset Properties
|
|
2503
|
-
**Property Name**
|
|
2504
|
-
|
|
2505
|
-
**Chinese Name**
|
|
2506
|
-
|
|
2507
|
-
**Property Type**
|
|
2508
|
-
|
|
2509
|
-
**Description**
|
|
2510
|
-
|
|
2511
|
-
#duration
|
|
2512
|
-
|
|
2513
|
-
Event duration
|
|
2514
|
-
|
|
2515
|
-
Numeric
|
|
2516
|
-
|
|
2517
|
-
Indicates the duration of this APP visit (from start to end), unit is seconds
|
|
2518
|
-
|
|
2519
|
-
- APP Browse Page Event (ta_app_view) Preset Properties
|
|
2520
|
-
**Property Name**
|
|
2521
|
-
|
|
2522
|
-
**Chinese Name**
|
|
2523
|
-
|
|
2524
|
-
**Property Type**
|
|
2525
|
-
|
|
2526
|
-
**Description**
|
|
2527
|
-
|
|
2528
|
-
#title
|
|
2529
|
-
|
|
2530
|
-
Page title
|
|
2531
|
-
|
|
2532
|
-
Text
|
|
2533
|
-
|
|
2534
|
-
Is View Controller title, value is `controller.navigationItem.title` property value
|
|
2535
|
-
|
|
2536
|
-
#screen_name
|
|
2537
|
-
|
|
2538
|
-
Page name
|
|
2539
|
-
|
|
2540
|
-
Text
|
|
2541
|
-
|
|
2542
|
-
Is View Controller class name
|
|
2543
|
-
|
|
2544
|
-
#url
|
|
2545
|
-
|
|
2546
|
-
Page address
|
|
2547
|
-
|
|
2548
|
-
Text
|
|
2549
|
-
|
|
2550
|
-
Current page address, needs to call `getScreenUrl` to set url
|
|
2551
|
-
|
|
2552
|
-
#referrer
|
|
2553
|
-
|
|
2554
|
-
Forward address
|
|
2555
|
-
|
|
2556
|
-
Text
|
|
2557
|
-
|
|
2558
|
-
The address of the page before page jump. The page before jump needs to call `getScreenUrl` to set url
|
|
2559
|
-
|
|
2560
|
-
- APP Control Click Event (ta_app_click) Preset Properties
|
|
2561
|
-
**Property Name**
|
|
2562
|
-
|
|
2563
|
-
**Chinese Name**
|
|
2564
|
-
|
|
2565
|
-
**Property Type**
|
|
2566
|
-
|
|
2567
|
-
**Description**
|
|
2568
|
-
|
|
2569
|
-
#title
|
|
2570
|
-
|
|
2571
|
-
Page title
|
|
2572
|
-
|
|
2573
|
-
Text
|
|
2574
|
-
|
|
2575
|
-
Is View Controller title, value is `controller.navigationItem.title` property value
|
|
2576
|
-
|
|
2577
|
-
#screen_name
|
|
2578
|
-
|
|
2579
|
-
Page name
|
|
2580
|
-
|
|
2581
|
-
Text
|
|
2582
|
-
|
|
2583
|
-
Is View Controller class name
|
|
2584
|
-
|
|
2585
|
-
#element_id
|
|
2586
|
-
|
|
2587
|
-
Element ID
|
|
2588
|
-
|
|
2589
|
-
Text
|
|
2590
|
-
|
|
2591
|
-
Control ID, needs `thinkingAnalyticsViewID` to set
|
|
2592
|
-
|
|
2593
|
-
#element_type
|
|
2594
|
-
|
|
2595
|
-
Element type
|
|
2596
|
-
|
|
2597
|
-
Text
|
|
2598
|
-
|
|
2599
|
-
Control type
|
|
2600
|
-
|
|
2601
|
-
#element_selector
|
|
2602
|
-
|
|
2603
|
-
Element selector
|
|
2604
|
-
|
|
2605
|
-
Text
|
|
2606
|
-
|
|
2607
|
-
Is the concatenation of control's `viewPath`
|
|
2608
|
-
|
|
2609
|
-
#element_position
|
|
2610
|
-
|
|
2611
|
-
Element position
|
|
2612
|
-
|
|
2613
|
-
Control position information. Only exists when control type is `UITableView` or `UICollectionView`. Indicates the position where control is clicked. Value is `Section Row`
|
|
2614
|
-
|
|
2615
|
-
#element_content
|
|
2616
|
-
|
|
2617
|
-
Element content
|
|
2618
|
-
|
|
2619
|
-
Text
|
|
2620
|
-
|
|
2621
|
-
Content on control
|
|
2622
|
-
|
|
2623
|
-
- APP Crash Event (ta_app_crash) Preset Properties
|
|
2624
|
-
**Property Name**
|
|
2625
|
-
|
|
2626
|
-
**Chinese Name**
|
|
2627
|
-
|
|
2628
|
-
Property Type
|
|
2629
|
-
|
|
2630
|
-
**Description**
|
|
2631
|
-
|
|
2632
|
-
#app_crashed_reason
|
|
2633
|
-
|
|
2634
|
-
Exception information
|
|
2635
|
-
|
|
2636
|
-
Text
|
|
2637
|
-
|
|
2638
|
-
Character type, records stack trace when crash occurs
|
|
2639
|
-
|
|
2640
|
-
### III. Other Preset Properties
|
|
2641
|
-
|
|
2642
|
-
Besides the above mentioned preset properties, some preset properties need to call corresponding interfaces to be recorded:
|
|
2643
|
-
|
|
2644
|
-
**Property Name**
|
|
2645
|
-
|
|
2646
|
-
**Chinese Name**
|
|
2647
|
-
|
|
2648
|
-
Property Type
|
|
2649
|
-
|
|
2650
|
-
**Description**
|
|
2651
|
-
|
|
2652
|
-
#duration
|
|
2653
|
-
|
|
2654
|
-
Event duration
|
|
2655
|
-
|
|
2656
|
-
Numeric
|
|
2657
|
-
|
|
2658
|
-
Need to call timing function interface `timeEvent`, records event occurrence duration, unit is seconds
|
|
2659
|
-
|
|
2660
|
-
#background_duration
|
|
2661
|
-
|
|
2662
|
-
Background stay duration
|
|
2663
|
-
|
|
2664
|
-
Numeric
|
|
2665
|
-
|
|
2666
|
-
Need to call timing function interface `timeEvent`, records the duration that application stays in background during event occurrence interval, unit is seconds
|
|
2667
|
-
|
|
2668
|
-
### IV. Get Preset Properties
|
|
2669
|
-
|
|
2670
|
-
v2.7.0 and later versions can call `getPresetProperties` method to get preset properties.
|
|
2671
|
-
|
|
2672
|
-
When server-side tracking needs some preset properties from App side, you can get App side's preset properties through this method and pass to server side.
|
|
2673
|
-
|
|
2674
|
-
:::: el-tabs
|
|
2675
|
-
|
|
2676
|
-
::: el-tab-pane label=Objective-C
|
|
2677
|
-
|
|
2678
|
-
```
|
|
2679
|
-
// Get property object
|
|
2680
|
-
TDPresetProperties *presetProperties = [TDAnalytics getPresetProperties];
|
|
2681
|
-
|
|
2682
|
-
// Generate event preset properties
|
|
2683
|
-
NSDictionary *properties = [presetProperties toEventPresetProperties];
|
|
2684
|
-
/*
|
|
2685
|
-
{
|
|
2686
|
-
"#carrier": "China Telecom",
|
|
2687
|
-
"#os": "iOS",
|
|
2688
|
-
"#device_id": "A8B1C00B-A6AC-4856-8538-0FBC642C1BAD",
|
|
2689
|
-
"#screen_height": 2264,
|
|
2690
|
-
"#bundle_id": "com.sw.thinkingdatademo",
|
|
2691
|
-
"#manufacturer": "Apple",
|
|
2692
|
-
"#device_model": "iPhone7",
|
|
2693
|
-
"#screen_width": 1080,
|
|
2694
|
-
"#system_language": "zh",
|
|
2695
|
-
"#os_version": "10",
|
|
2696
|
-
"#network_type": "WIFI",
|
|
2697
|
-
"#zone_offset": 8,
|
|
2698
|
-
}
|
|
2699
|
-
*/
|
|
2700
|
-
|
|
2701
|
-
// Get a certain preset property
|
|
2702
|
-
NSString *bundle_id = presetProperties.bundle_id;// Package name
|
|
2703
|
-
NSString *os = presetProperties.os;// os type, such as iOS
|
|
2704
|
-
NSString *system_language = presetProperties.system_language;// Phone system language type
|
|
2705
|
-
NSNumber *screen_width = presetProperties.screen_width;// Screen width
|
|
2706
|
-
NSNumber *screen_height = presetProperties.screen_height;// Screen height
|
|
2707
|
-
NSString *device_model = presetProperties.device_model;// Device model
|
|
2708
|
-
NSString *device_id = presetProperties.device_id;// Device unique identifier
|
|
2709
|
-
NSString *carrier = presetProperties.carrier;// Phone SIM card carrier information. For dual SIM dual standby, takes main card's carrier information
|
|
2710
|
-
NSString *manufacture = presetProperties.manufacturer;// Phone manufacturer such as Apple
|
|
2711
|
-
NSString *network_type = presetProperties.network_type;// Network type
|
|
2712
|
-
NSString *os_version = presetProperties.os_version;// System version number
|
|
2713
|
-
NSNumber *zone_offset = presetProperties.zone_offset;// Timezone offset
|
|
2714
|
-
```
|
|
2715
|
-
|
|
2716
|
-
:::
|
|
2717
|
-
|
|
2718
|
-
::: el-tab-pane label=Swift
|
|
2719
|
-
|
|
2720
|
-
```
|
|
2721
|
-
let presetProperties = TDAnalytics.getPresetProperties();
|
|
2722
|
-
|
|
2723
|
-
// Generate event preset properties
|
|
2724
|
-
let properties = presetProperties.toEventPresetProperties();
|
|
2725
|
-
|
|
2726
|
-
// Get a certain preset property
|
|
2727
|
-
let bundle_id = presetProperties.bundle_id;// Package name
|
|
2728
|
-
let os = presetProperties.os;// os type, such as iOS
|
|
2729
|
-
let system_language = presetProperties.system_language;// Phone system language type
|
|
2730
|
-
let screen_width = presetProperties.screen_width;// Screen width
|
|
2731
|
-
let screen_height = presetProperties.screen_height;// Screen height
|
|
2732
|
-
let device_model = presetProperties.device_model;// Device model
|
|
2733
|
-
let device_id = presetProperties.device_id;// Device unique identifier
|
|
2734
|
-
let carrier = presetProperties.carrier;// Phone SIM card carrier information. For dual SIM dual standby, takes main card's carrier information
|
|
2735
|
-
let manufacture = presetProperties.manufacturer;// Phone manufacturer such as Apple
|
|
2736
|
-
let network_type = presetProperties.network_type;// Network type
|
|
2737
|
-
let os_version = presetProperties.os_version;// System version number
|
|
2738
|
-
let zone_offset = presetProperties.zone_offset;// Timezone offset value
|
|
2739
|
-
```
|
|
2740
|
-
|
|
2741
|
-
:::
|
|
2742
|
-
|
|
2743
|
-
::::
|
|
2744
|
-
|
|
2745
|
-
<!-- unsupported block: 34 -->
|
|
2746
|
-
|
|
2747
|
-
IP, country city information is parsed and generated by server side. Client does not provide interface to get these properties
|
|
2748
|
-
|
|
2749
|
-
### V. Disable Preset Property Collection
|
|
2750
|
-
|
|
2751
|
-
In certain scenarios, out of compliance or actual business needs considerations, you may want to disable collection of certain preset properties. You can add **TDDisPresetProperties** field in the project's info.plist file. Type is Array. Added field's corresponding preset properties will not be uploaded. For example, blocking "#fps", @"#ram", @"#disk", @"#start_reason", @"#simulator" etc. preset properties. Configuration as shown in the figure:
|
|
2752
|
-
|
|
2753
|
-
<!-- unsupported block: 34 -->
|
|
2754
|
-
|
|
2755
|
-
If you block device ID and need to use first-time event, please be sure to fill in first_check_id property
|