@thinkingai/ae-cli 6.1.38 → 6.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/dist/{ai-monitor-UL2O7J4X.js → ai-monitor-DST4NDOK.js} +5 -5
- package/dist/ai-monitor.js +7 -7
- package/dist/{auth-ERWVKQDG.js → auth-BD3NIY3T.js} +3 -3
- package/dist/{automation-OQ647CSW.js → automation-IMDCJUML.js} +85 -9
- package/dist/{capability-HPP6E3ZX.js → capability-3NJOQHZQ.js} +3 -3
- package/dist/{chunk-DKOGWIYQ.js → chunk-24DCOJBJ.js} +2 -2
- package/dist/{chunk-SHB7A2JE.js → chunk-2RORKIF6.js} +2 -2
- package/dist/{chunk-HBI7IQH3.js → chunk-6NJZSWUT.js} +3 -28
- package/dist/{chunk-QPUPWGZ3.js → chunk-DTODOQ6T.js} +1 -1
- package/dist/{chunk-PCQTBRPT.js → chunk-FRJUB66C.js} +1 -1
- package/dist/{chunk-ZLJZPPPV.js → chunk-IY5G42YY.js} +2 -2
- package/dist/{chunk-JRXSLFCA.js → chunk-KBJHBVO7.js} +1 -1
- package/dist/{chunk-CYZV5AXW.js → chunk-KE5WGBXS.js} +2 -1
- package/dist/chunk-N2MAYIRU.js +32 -0
- package/dist/{chunk-DULCIC67.js → chunk-SQEK6S4X.js} +2 -3
- package/dist/{chunk-VPLRZSMY.js → chunk-STHIGWWC.js} +10 -1
- package/dist/{chunk-BWEQIKA3.js → chunk-TVSGS5QB.js} +5 -5
- package/dist/{chunk-LXRALNNA.js → chunk-UK7HQ4IL.js} +1 -1
- package/dist/{chunk-NDX4VJO7.js → chunk-VXKKTUU2.js} +2 -2
- package/dist/{chunk-E5CJI7L3.js → chunk-WRYXVIJP.js} +1 -1
- package/dist/{compat-check-WRPEFB5N.js → compat-check-7VBBE7KO.js} +1 -1
- package/dist/{config-IS33K45R.js → config-LFRZBPH5.js} +3 -3
- package/dist/{context-Y2A6QIS3.js → context-WJQGJD6F.js} +1 -1
- package/dist/{data-integration-EIF5QHYF.js → data-integration-KMJWYAKK.js} +2 -1
- package/dist/index.js +34 -32
- package/dist/{memory-6QMZS4HF.js → memory-VPOPSU52.js} +3 -3
- package/dist/{metadata-TMAXVLOL.js → metadata-AR64J76Z.js} +5 -5
- package/dist/{model-LEYRQKOS.js → model-2F2354QP.js} +1 -1
- package/dist/{personal-semantic-preference-RMZEDRCJ.js → personal-semantic-preference-BCOSI4DO.js} +4 -4
- package/dist/{project-semantic-UD3OAZ6K.js → project-semantic-DJLXAXLD.js} +4 -4
- package/dist/{sync-GVF3OI2U.js → sync-4TUIQ2PZ.js} +3 -3
- package/dist/{te-agent-S7UH657Z.js → te-agent-EMDWA3M6.js} +4 -4
- package/dist/{te-analysis-SJIE5OZY.js → te-analysis-XHAMRMTQ.js} +5 -5
- package/dist/{te-community-VNHJDEID.js → te-community-JSUSZEYH.js} +4 -4
- package/dist/{te-dataops-AO4OQBQV.js → te-dataops-I264BUTI.js} +2 -2
- package/dist/{te-engage-EZJRFG3Q.js → te-engage-XNMQYO5N.js} +68 -16
- package/dist/{te-experiment-R2MNSAKV.js → te-experiment-5SCHMYVO.js} +4 -4
- package/dist/{te-kb-C44A4BHM.js → te-kb-QQ53TNRZ.js} +44 -13
- package/dist/{te-system-DB5Z3LLF.js → te-system-Z4VEB6PL.js} +1 -1
- package/dist/{te-team-J52STTEZ.js → te-team-V6BBI52R.js} +87 -6
- package/dist/{things-G2QFXDK7.js → things-THHGDSEC.js} +4 -4
- package/dist/{update-GEKOZMHU.js → update-53ZUXWV5.js} +2 -2
- package/dist/{web-runtime-5M7PRY7R.js → web-runtime-ZJHOIPKX.js} +4 -4
- package/dist/{workspace-RZESYB6T.js → workspace-W5ZPVWJS.js} +3 -3
- package/package.json +3 -3
- package/skills/ae-automation/SKILL.md +6 -2
- package/skills/ae-automation/references/cli.md +9 -3
- package/skills/ae-engage/SKILL.md +6 -1
- package/skills/ae-engage/references/common-metric.md +47 -1
- package/skills/ae-engage/references/flow-metric-update.md +1 -1
- package/skills/ae-engage/references/task-metric-update.md +1 -1
- package/skills/ae-experiment/SKILL.md +1 -1
- package/skills/ae-experiment/references/save_experiment.md +1 -1
- package/skills/ae-kb/SKILL.md +8 -6
- package/skills/ae-kb/references/query-workflow.md +5 -1
- package/skills/ae-team/SKILL.md +7 -3
- package/skills/ae-team/references/copy-to-personal.md +7 -0
- package/skills/ae-team/references/promote.md +7 -0
- package/skills/ae-team/references/update.md +3 -3
- package/skills/ae-tracking-matrix/SKILL.md +0 -170
- package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
- package/skills/ae-tracking-matrix/i18n.yaml +0 -12
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
- package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
- package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
- package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
- package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
- package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
- package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
- package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
- package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
- package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
- package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
- package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
- package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
|
@@ -1,827 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
code: client_cpp_sdk_installation
|
|
3
|
-
name: "C++"
|
|
4
|
-
wikiToken: E8ekwJ170iMfb8ktBPfcYxE4nq0
|
|
5
|
-
parentWikiToken: FTcTwinIOi3OiRkK4MPc2Ex7neg
|
|
6
|
-
updateTime: 1760169183000
|
|
7
|
-
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=client_cpp_sdk_installation
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# C++
|
|
11
|
-
|
|
12
|
-
::: tip Note
|
|
13
|
-
|
|
14
|
-
Before integration, please read the Pre-installation Guide first.
|
|
15
|
-
|
|
16
|
-
You can get the C++ SDK source code on GitHub.
|
|
17
|
-
|
|
18
|
-
C++ SDK supports running on Mac and Windows platforms, supports C++ 11 and above, and is approximately 144KB in size.
|
|
19
|
-
|
|
20
|
-
:::
|
|
21
|
-
|
|
22
|
-
**Latest Version:** v1.5.3
|
|
23
|
-
|
|
24
|
-
**Update Time:** 2025-10-11
|
|
25
|
-
|
|
26
|
-
**Resource Download:** SDK Source Code
|
|
27
|
-
|
|
28
|
-
### I. SDK Integration
|
|
29
|
-
|
|
30
|
-
#### 1.1 Download SDK
|
|
31
|
-
|
|
32
|
-
Download the SDK source code, unzip it and enter the cpp-client/cpp folder.
|
|
33
|
-
|
|
34
|
-
The `include` folder contains the SDK header files, `src` contains the SDK source code files, and `thirdparty` contains the dependent third-party libraries.
|
|
35
|
-
|
|
36
|
-
#### 1.2 Add Dependencies
|
|
37
|
-
|
|
38
|
-
C++ SDK depends on sqlite, curl, zlib, and openssl libraries. Due to platform differences, the library formats also vary. You can use the pre-compiled libraries from ThinkingData or compile the libraries yourself.
|
|
39
|
-
|
|
40
|
-
##### 1.2.1 Use Pre-compiled Libraries from ThinkingData
|
|
41
|
-
|
|
42
|
-
The libraries are compiled using a compiler on the Windows platform. Configure the compiled libraries in the thirdparty folder into your project. (.dll is dynamic library, .lib is static library)
|
|
43
|
-
|
|
44
|
-
##### 1.2.2 Self-compile
|
|
45
|
-
|
|
46
|
-
Here is an example for Windows platform:
|
|
47
|
-
|
|
48
|
-
Download curl library from https://github.com/curl/curl/releases/tag/curl-7_61_1, unzip it, switch to the winbuild directory, and compile. The compilation command is as follows, and the compilation result is in the builds folder under the curl directory.
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
nmake /f Makefile.vc mode=static ENABLE_IDN=no
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Download zlib library from https://github.com/madler/zlib/releases/tag/v1.2.11, unzip it, and execute the compilation command. The compilation result is in the zlib directory.
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
nmake -f win32/Makefile.msc
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Download sqlite library from https://www.sqlite.org/download.html, and select the library for your specified platform.
|
|
61
|
-
|
|
62
|
-
<!-- unsupported block: 19 -->
|
|
63
|
-
|
|
64
|
-
Besides using command line, you can also use IDEs (Integrated Development Environments) such as Visual Studio or Clion to generate libraries for specific platforms.
|
|
65
|
-
|
|
66
|
-
Download openssl library from https://github.com/openssl/openssl, and compile the library for your specified platform yourself.
|
|
67
|
-
|
|
68
|
-
#### 1.3 Integrate SDK
|
|
69
|
-
|
|
70
|
-
##### 1.3.1 Integration using CMake
|
|
71
|
-
|
|
72
|
-
Use CMake to integrate the C++ SDK. Copy the cpp folder to your project, and add the following configuration for Windows and Mac in the `CMakeLists.txt` file:
|
|
73
|
-
|
|
74
|
-
Set C++ version:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
set(CMAKE_CXX_STANDARD 11)
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Include header files:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
include_directories(cpp/include)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Add Windows platform configuration:
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
if(WIN32)
|
|
90
|
-
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # x64 platform
|
|
91
|
-
include_directories(cpp/thirdparty/x64/curl/include cpp/thirdparty/x64/zlib/include cpp/thirdparty/x64/sqlite/include cpp/thirdparty/x64/openssl/include)
|
|
92
|
-
link_directories(cpp/thirdparty/x64/curl/lib cpp/thirdparty/x64/zlib/lib cpp/thirdparty/x64/sqlite/lib cpp/thirdparty/x64/openssl/lib)
|
|
93
|
-
else() # Win32 platform
|
|
94
|
-
include_directories(cpp/thirdparty/x86/curl/include cpp/thirdparty/x86/zlib/include cpp/thirdparty/x86/sqlite/include cpp/thirdparty/x86/openssl/include)
|
|
95
|
-
link_directories(cpp/thirdparty/x86/curl/lib cpp/thirdparty/x86/zlib/lib cpp/thirdparty/x86/sqlite/lib cpp/thirdparty/x86/openssl/lib)
|
|
96
|
-
endif()
|
|
97
|
-
add_library(thinkingdata SHARED cpp/src/ta_analytics_sdk.cpp cpp/src/ta_cpp_helper.cpp cpp/src/ta_cpp_network.cpp cpp/src/ta_cpp_utils.cpp cpp/src/ta_sqlite.cpp cpp/src/ta_timer.cpp cpp/src/ta_event_task.cpp cpp/src/ta_cpp_send.cpp cpp/src/ta_json_object.cpp cpp/src/ta_cJSON.c cpp/src/ta_encrypt.cpp cpp/src/ta_calibrated_time.cpp cpp/src/ta_flush_task.cpp)
|
|
98
|
-
target_link_libraries(thinkingdata libcurl sqlite3 zlibwapi libssl libcrypto)
|
|
99
|
-
endif()
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Add Mac platform configuration:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
if (CMAKE_HOST_APPLE)
|
|
106
|
-
find_library(COCOA Cocoa)
|
|
107
|
-
find_library(IOKIT IOKit)
|
|
108
|
-
find_package(OpenSSL REQUIRED)
|
|
109
|
-
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
110
|
-
link_directories(${OPENSSL_LIBRARIES})
|
|
111
|
-
add_library(thinkingdata SHARED cpp/src/ta_analytics_sdk.cpp cpp/src/ta_cpp_helper.cpp cpp/src/ta_cpp_network.cpp cpp/src/ta_cpp_utils.cpp cpp/src/ta_sqlite.cpp cpp/src/ta_timer.cpp cpp/src/ta_event_task.cpp cpp/src/ta_cpp_send.cpp cpp/src/ta_json_object.cpp cpp/src/ta_cJSON.c cpp/src/ta_mac_tool.mm cpp/src/ta_encrypt.cpp cpp/src/ta_calibrated_time.cpp cpp/src/ta_flush_task.cpp)
|
|
112
|
-
target_link_libraries(thinkingdata curl z sqlite3 ${OPENSSL_LIBRARIES} ${COCOA} ${IOKIT})
|
|
113
|
-
endif()
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
##### 1.3.2 Self-compile
|
|
117
|
-
|
|
118
|
-
You can use IDE (Integrated Development Environment) to compile ThinkingData libraries yourself
|
|
119
|
-
|
|
120
|
-
1. Download the SDK code, cd to the cmakelist file directory
|
|
121
|
-
1. Execute the following commands
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
//windows platform using Visual Studio to compile
|
|
125
|
-
//x86
|
|
126
|
-
cmake -S . -B build -G "Visual Studio 17 2022" -A Win32
|
|
127
|
-
//x64
|
|
128
|
-
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
//Mac platform
|
|
133
|
-
// arm64 platform m1
|
|
134
|
-
arch -arm64 cmake -B build
|
|
135
|
-
arch -arm64 cmake --build build
|
|
136
|
-
|
|
137
|
-
//x86_64 platform intel
|
|
138
|
-
arch -x86_64 cmake -B build
|
|
139
|
-
arch -x86_64 cmake --build build
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
##### 1.3.3 Integration using Source Code
|
|
143
|
-
|
|
144
|
-
After completing the third-party dependency configuration in step 1.2, add the include and src folders to your project.
|
|
145
|
-
|
|
146
|
-
##### 1.3.4 Use Pre-compiled Libraries
|
|
147
|
-
|
|
148
|
-
SDK Download
|
|
149
|
-
|
|
150
|
-
After downloading and unzipping, you can find the corresponding dll files for x64 and x86 platforms, which can be used directly.
|
|
151
|
-
|
|
152
|
-
### II. Initialize SDK
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
#include "ta_analytics_sdk.h"
|
|
156
|
-
#include "ta_json_object.h"
|
|
157
|
-
|
|
158
|
-
using namespace thinkingdata;
|
|
159
|
-
|
|
160
|
-
ThinkingAnalyticsAPI::Init(SERVER_URL, APPID);
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Parameter description:
|
|
164
|
-
|
|
165
|
-
- `APPID`: Your project's APPID, which can be obtained from the TE backend project management page
|
|
166
|
-
- `SERVER_URL`: The URL for data upload
|
|
167
|
-
- If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
168
|
-
- If you are using a privately deployed version, please bind a domain name for the data collection address and configure an HTTPS certificate: https://your-data-collection-domain
|
|
169
|
-
|
|
170
|
-
### III. Common Features
|
|
171
|
-
|
|
172
|
-
Before using common features, we recommend that you first understand the user identification rules; SDK will generate a random number as a visitor ID by default, and persistently store the visitor ID locally; before the user logs in, the visitor ID will be used as the identity identification ID. Note: The visitor ID will change when the user reinstalls the App or changes the device.
|
|
173
|
-
|
|
174
|
-
#### 3.1 Set Account ID
|
|
175
|
-
|
|
176
|
-
When a user logs in, you can call `Login` to set the user's account ID. The TE platform will use the account ID as the identity identification ID, and the set account ID will be retained until `Logout` is called. Calling `Login` multiple times will override the previous account ID.
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
// The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
|
|
180
|
-
ThinkingAnalyticsAPI::Login("TA");
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
`Login` can be called multiple times. Each call will determine whether the passed account ID is consistent with the previously saved ID. If consistent, the call will be ignored; if inconsistent, the previous ID will be overridden.
|
|
184
|
-
|
|
185
|
-
<!-- unsupported block: 34 -->
|
|
186
|
-
|
|
187
|
-
**This method will not upload a login event**
|
|
188
|
-
|
|
189
|
-
#### 3.2 Send Event
|
|
190
|
-
|
|
191
|
-
You can call `track` to upload events. It is recommended that you set event properties and conditions for sending information based on your previously documented tracking requirements. Here is an example of a user purchasing a product:
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
TDJSONObject event_properties;
|
|
195
|
-
event_properties.SetString("name1", "name1");//string
|
|
196
|
-
event_properties.SetNumber("test_number_int", 3);//number
|
|
197
|
-
event_properties.SetBool("test_bool", true);//bool
|
|
198
|
-
event_properties.SetDateTime("test_time1", time(NULL), 0);//time
|
|
199
|
-
std::vector<std::string> test_list;
|
|
200
|
-
test_list.push_back("item11");
|
|
201
|
-
test_list.push_back("item21");
|
|
202
|
-
event_properties.SetList("test_list1", test_list);//array
|
|
203
|
-
ThinkingAnalyticsAPI::Track("CPP_event", event_properties);
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
- The event name is a string type, can only start with a letter, can contain numbers, letters and underscores "\_", with a maximum length of 50 characters.
|
|
207
|
-
- Event properties are of `TDJSONObject` type, where each element represents a property;
|
|
208
|
-
- Event property `Key` is the property name, is a string type, and can only start with a letter, contain numbers, letters and underscores "\_", with a maximum length of 50 characters, and is case-insensitive for letters;
|
|
209
|
-
- Property values support string, number, boolean, array, and time types.
|
|
210
|
-
<!-- unsupported block: 34 -->
|
|
211
|
-
|
|
212
|
-
**User property requirements are the same as event property requirements**
|
|
213
|
-
|
|
214
|
-
#### 3.3 Set User Properties
|
|
215
|
-
|
|
216
|
-
For general user properties, you can call `UserSet` to set them. Properties uploaded using this interface will override existing property values. If the user property did not exist before, it will be created with the same type as the uploaded property. Here is an example of setting the username:
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
TDJSONObject userProperties;
|
|
220
|
-
userProperties.SetString("user_name", "TA");
|
|
221
|
-
ThinkingAnalyticsAPI::UserSet(userProperties);
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### IV. Best Practices
|
|
225
|
-
|
|
226
|
-
The following example code includes all the above operations. We recommend following these steps:
|
|
227
|
-
|
|
228
|
-
```
|
|
229
|
-
#include "ta_analytics_sdk.h"
|
|
230
|
-
using namespace thinkingdata;
|
|
231
|
-
//Initialize SDK
|
|
232
|
-
ThinkingAnalyticsAPI::Init(SERVER_URL, APPID);
|
|
233
|
-
//If the user has logged in, you can set the user's account ID as the unique identifier
|
|
234
|
-
ThinkingAnalyticsAPI::Login("TA");
|
|
235
|
-
//Send event
|
|
236
|
-
TDJSONObject event_properties;
|
|
237
|
-
event_properties.SetString("name1", "name1");//string
|
|
238
|
-
event_properties.SetNumber("test_number_int", 3);//number
|
|
239
|
-
event_properties.SetBool("test_bool", true);//bool
|
|
240
|
-
event_properties.SetDateTime("test_time1", time(NULL), 0);//time
|
|
241
|
-
std::vector<std::string> test_list;
|
|
242
|
-
test_list.push_back("item11");
|
|
243
|
-
test_list.push_back("item21");
|
|
244
|
-
event_properties.SetList("test_list1", test_list);//array
|
|
245
|
-
ThinkingAnalyticsAPI::Track("CPP_event", event_properties);;
|
|
246
|
-
//Set user properties
|
|
247
|
-
TDJSONObject userProperties;
|
|
248
|
-
userProperties1.SetString("user_name", "TA");
|
|
249
|
-
ThinkingAnalyticsAPI::UserSet(userProperties);
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
# Advanced Guide
|
|
255
|
-
|
|
256
|
-
### I. Set User ID
|
|
257
|
-
|
|
258
|
-
The SDK instance defaults to using a random number as the default visitor ID for each user, which will serve as the identity identification ID for users in an unauthenticated state. Note that the visitor ID will change when the user reinstalls the application or changes the device.
|
|
259
|
-
|
|
260
|
-
#### 1.1 Set Visitor ID
|
|
261
|
-
|
|
262
|
-
::: tip Note
|
|
263
|
-
|
|
264
|
-
Generally, you do not need to customize the visitor ID. Please ensure you understand the user identification rules before setting the visitor ID.
|
|
265
|
-
|
|
266
|
-
If you need to replace the visitor ID, you should call it immediately after initializing the SDK. Do not call it multiple times to avoid creating unnecessary accounts.
|
|
267
|
-
|
|
268
|
-
:::
|
|
269
|
-
|
|
270
|
-
If your App has its own visitor ID management system for each user, you can call `Identify` to set the visitor ID:
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
// Set the visitor ID to "Thinker"
|
|
274
|
-
ThinkingAnalyticsAPI::Identify("Thinker");
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
If you need to get the current visitor ID, you can call `DistinctID()`:
|
|
278
|
-
|
|
279
|
-
```
|
|
280
|
-
//Return visitor ID
|
|
281
|
-
ThinkingAnalyticsAPI::DistinctID().c_str()
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
#### 1.2 Set Account ID
|
|
285
|
-
|
|
286
|
-
When a user logs in, you can call `Login` to set the user's account ID. The TE platform will use the account ID as the identity identification ID, and the set account ID will be retained until `Logout` is called. Calling `Login` multiple times will override the previous account ID
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
// The user's unique login identifier, this data corresponds to #account_id in the reported data, at this time #account_id is "TA"
|
|
290
|
-
ThinkingAnalyticsAPI::Login("TA");
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
<!-- unsupported block: 34 -->
|
|
294
|
-
|
|
295
|
-
**This method will not upload a login event**
|
|
296
|
-
|
|
297
|
-
#### 1.3 Clear Account ID
|
|
298
|
-
|
|
299
|
-
After a user logs out, you can call `LogOut` to clear the account ID. Before calling `Login` again, the visitor ID will be used as the identity identification ID.
|
|
300
|
-
|
|
301
|
-
```
|
|
302
|
-
ThinkingAnalyticsAPI::LogOut();
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
We recommend that you call `LogOut` only when there is an explicit logout behavior, such as when the user actively cancels their account, rather than when the App is closed.
|
|
306
|
-
|
|
307
|
-
<!-- unsupported block: 34 -->
|
|
308
|
-
|
|
309
|
-
**This method will not upload a logout event**
|
|
310
|
-
|
|
311
|
-
### II. Send Events
|
|
312
|
-
|
|
313
|
-
After the SDK initialization is complete, you can perform data tracking and collect user behavior information. Generally, ordinary events can meet business scenario requirements. You can also use first-time events, updatable events, etc. according to your actual business scenarios.
|
|
314
|
-
|
|
315
|
-
#### 2.1 Ordinary Events
|
|
316
|
-
|
|
317
|
-
You can call `Track` to upload events. We recommend that you set event properties and conditions for sending events based on your previously documented tracking requirements. Here is an example of a user purchasing a product:
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
//Store purchase event
|
|
321
|
-
TDJSONObject event_properties;
|
|
322
|
-
event_properties.SetString("product_name", "Product Name");
|
|
323
|
-
ThinkingAnalyticsAPI::Track("product_buy", event_properties);
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
#### 2.2 First-time Event
|
|
327
|
-
|
|
328
|
-
First-time events refer to events that will only be recorded once for a certain device or other dimensional ID. For example, in some scenarios, you may want to record an activation event on a certain device, then you can use first-time events to report the data.
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
TDJSONObject jsonObject1;
|
|
332
|
-
jsonObject1.SetString("test","test");
|
|
333
|
-
TDFirstEvent *firstEvent = new TDFirstEvent("device_activation",jsonObject1);
|
|
334
|
-
ThinkingAnalyticsAPI::Track(firstEvent);
|
|
335
|
-
delete firstEvent;
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
If you want to determine whether it is the first time based on other dimensions other than the device, you can customize the first_check_id for the first-time event:
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
//Set the user ID as the first_check_id of the first-time event to implement the collection of user first activation event
|
|
342
|
-
TDJSONObject jsonObject1;
|
|
343
|
-
jsonObject1.SetString("test","test");
|
|
344
|
-
TDFirstEvent *firstEvent = new TDFirstEvent("account_activation",jsonObject1);
|
|
345
|
-
firstEvent->setFirstCheckId("TA");
|
|
346
|
-
ThinkingAnalyticsAPI::Track(firstEvent);
|
|
347
|
-
delete firstEvent;
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
<!-- unsupported block: 34 -->
|
|
351
|
-
|
|
352
|
-
Note: Since the verification of whether it is the first time is completed on the server side, first-time events will be delayed by 1 hour before entering the database by default.
|
|
353
|
-
|
|
354
|
-
#### 2.3 Updatable Events
|
|
355
|
-
|
|
356
|
-
You can implement the need to modify event data in specific scenarios through updatable events. Updatable events need to specify an ID that identifies the event, and pass it when creating the updatable event object. The TE backend will determine the data to be updated based on the event name and event ID.
|
|
357
|
-
|
|
358
|
-
```
|
|
359
|
-
// Example: Report an event that can be updated, assuming the event name is UPDATABLE_EVENT
|
|
360
|
-
// After reporting, the event property status is 3, price is 100
|
|
361
|
-
TDJSONObject jsonObject;
|
|
362
|
-
jsonObject.SetNumber("status", 3);
|
|
363
|
-
jsonObject.SetNumber("price", 100);
|
|
364
|
-
TDUpdatableEvent *updatableEvent = new TDUpdatableEvent("UPDATABLE_EVENT",jsonObject,"test_event_id");
|
|
365
|
-
ThinkingAnalyticsAPI::Track(updatableEvent);
|
|
366
|
-
delete updatableEvent;
|
|
367
|
-
|
|
368
|
-
// After reporting, the event property status is updated to 5, price remains unchanged
|
|
369
|
-
TDJSONObject jsonObject1;
|
|
370
|
-
jsonObject1.SetNumber("status", 5);
|
|
371
|
-
TDUpdatableEvent *updatableEvent1 = new TDUpdatableEvent("UPDATABLE_EVENT",jsonObject1,"test_event_id");
|
|
372
|
-
ThinkingAnalyticsAPI::Track(updatableEvent1);
|
|
373
|
-
delete updatableEvent1;
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
#### 2.4 Overwritable Events
|
|
377
|
-
|
|
378
|
-
Overwritable events are similar to updatable events, the difference is that overwritable events will completely overwrite historical data with the latest data, which effectively is equivalent to deleting the previous data and storing the latest data. The TE backend will determine the data to be updated based on the event name and event ID.
|
|
379
|
-
|
|
380
|
-
```
|
|
381
|
-
// Example: Report an event that can be overwritten, assuming the event name is OVERWRITE_EVENT
|
|
382
|
-
// After reporting, the event property status is 3, price is 100
|
|
383
|
-
TDJSONObject jsonObject;
|
|
384
|
-
jsonObject.SetNumber("status", 3);
|
|
385
|
-
jsonObject.SetNumber("price", 100);
|
|
386
|
-
TDOverWritableEvent *event = new TDOverWritableEvent("OVERWRITE_EVENT",jsonObject,"test_event_id");
|
|
387
|
-
ThinkingAnalyticsAPI::Track(event);
|
|
388
|
-
delete event;
|
|
389
|
-
|
|
390
|
-
// After reporting, the event property status is updated to 5, price property is deleted
|
|
391
|
-
TDJSONObject jsonObject1;
|
|
392
|
-
jsonObject1.SetNumber("status", 5);
|
|
393
|
-
TDOverWritableEvent *event1 = new TDOverWritableEvent("OVERWRITE_EVENT",jsonObject1,"test_event_id");
|
|
394
|
-
ThinkingAnalyticsAPI::Track(event1);
|
|
395
|
-
delete event;
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
#### 2.5 Public Event Properties
|
|
399
|
-
|
|
400
|
-
Public event properties refer to properties that will be uploaded with every event.
|
|
401
|
-
|
|
402
|
-
##### 2.5.1 Static Public Event Properties
|
|
403
|
-
|
|
404
|
-
Static public event properties are properties that change infrequently and are present in every event, such as user membership level. After setting static public event properties through `setSuperProperties`, the SDK will obtain the set public event properties as event properties when collecting events.
|
|
405
|
-
|
|
406
|
-
```
|
|
407
|
-
TDJSONObject superProperties;
|
|
408
|
-
superProperties.SetNumber("vip_level",2);
|
|
409
|
-
ThinkingAnalyticsAPI::SetSuperProperty(superProperties);
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
Static public event properties will be saved to the cache and do not need to be called every time the App starts. If the property already exists, the newly set property will override the original property value; if the property did not exist before, a new property will be created. Besides setting properties, we also provide other APIs to manage static public event properties to meet daily business needs.
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
//Clear a specific public event property
|
|
416
|
-
TDAnalytics.unsetSuperProperty("Channel");
|
|
417
|
-
//Clear all public event properties
|
|
418
|
-
ThinkingAnalyticsAPI::ClearSuperProperties();
|
|
419
|
-
//Get all public event properties
|
|
420
|
-
TDJSONObject superJson;
|
|
421
|
-
ThinkingAnalyticsAPI::GetSuperProperties(superJson);
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
##### 2.5.2 Dynamic Public Event Properties
|
|
425
|
-
|
|
426
|
-
Dynamic public event properties are properties that change frequently and are present in every event, such as the number of gold coins a user has. After setting the dynamic public property class through `SetDynamicSuperProperties`, the SDK will automatically obtain the properties during event collection and add them to the triggered event.
|
|
427
|
-
|
|
428
|
-
```
|
|
429
|
-
TDJSONObject GetDynamicSuperProperties(){
|
|
430
|
-
TDJSONObject json;
|
|
431
|
-
json.SetNumber("coin",10);
|
|
432
|
-
return json;
|
|
433
|
-
}
|
|
434
|
-
ThinkingAnalyticsAPI::Init(config);
|
|
435
|
-
ThinkingAnalyticsAPI::SetDynamicSuperProperties(GetDynamicSuperProperties);
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
#### 2.6 Record Event Duration
|
|
439
|
-
|
|
440
|
-
If you need to record the duration of an event, you can call `timeEvent` to start timing. Configure the event name you want to time. When you upload that event, a `#duration` property will automatically be added to your event properties to represent the recorded duration in seconds. Note that only one timing task can exist for the same event name.
|
|
441
|
-
|
|
442
|
-
```
|
|
443
|
-
//The following example completes the statistics of the user's stay duration on a certain product page
|
|
444
|
-
try {
|
|
445
|
-
//User enters the product page, start timing
|
|
446
|
-
ThinkingAnalyticsAPI::TimeEvent("stay_shop");
|
|
447
|
-
/**do someting
|
|
448
|
-
.......
|
|
449
|
-
**/
|
|
450
|
-
//User leaves the product page, timing ends, the "stay_shop" event will have a property #duration representing the event duration
|
|
451
|
-
ThinkingAnalyticsAPI::TimeEvent("stay_shop");
|
|
452
|
-
} catch (JSONException e) {
|
|
453
|
-
e.printStackTrace();
|
|
454
|
-
}
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### III. User Properties
|
|
458
|
-
|
|
459
|
-
The user property setting interfaces currently supported by TE platform are: `UserSet`, `UserSetOnce`, `UserAdd`, `UserUnset`, `UserDelete`, `UserAppend`.
|
|
460
|
-
|
|
461
|
-
#### 3.1 UserSet
|
|
462
|
-
|
|
463
|
-
For general user properties, you can call `UserSet` to set them. Properties uploaded using this interface will override existing property values. If the user property did not exist before, it will be created with the same type as the uploaded property. Here is an example of setting the username:
|
|
464
|
-
|
|
465
|
-
```
|
|
466
|
-
TDJSONObject userProperties;
|
|
467
|
-
userProperties.SetString("username", "TA");
|
|
468
|
-
ThinkingAnalyticsAPI::UserSet(userProperties);
|
|
469
|
-
//At this time userName is TE
|
|
470
|
-
TDJSONObject userProperties1;
|
|
471
|
-
userProperties1.SetString("username", "TE");
|
|
472
|
-
ThinkingAnalyticsAPI::UserSet(userProperties1)
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
#### 3.2 UserSetOnce
|
|
476
|
-
|
|
477
|
-
If you need to upload user properties that should only be set once, you can call `UserSetOnce` to set them. When the property already has a value, this information will be ignored. Here is an example of setting the first payment time:
|
|
478
|
-
|
|
479
|
-
```
|
|
480
|
-
//first_payment_time is 2018-01-01 01:23:45.678
|
|
481
|
-
TDJSONObject userProperties;
|
|
482
|
-
userProperties.SetString("first_payment_time","2018-01-01 01:23:45.678");
|
|
483
|
-
ThinkingAnalyticsAPI::UserSetOnce(userProperties);
|
|
484
|
-
|
|
485
|
-
//first_payment_time is still 2018-01-01 01:23:45.678
|
|
486
|
-
TDJSONObject userProperties1;
|
|
487
|
-
userProperties1.SetString("first_pay_time","2018-12-31 01:23:45.678");
|
|
488
|
-
ThinkingAnalyticsAPI::UserSetOnce(userProperties1);
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
#### 3.3 UserAdd
|
|
492
|
-
|
|
493
|
-
When you need to upload numeric properties, you can call `UserAdd` to perform an accumulation operation on the property. If the property has not been set, it will be assigned 0 before calculation. Negative values can be passed, which is equivalent to a subtraction operation. Here is an example of accumulating total payment amount:
|
|
494
|
-
|
|
495
|
-
```
|
|
496
|
-
//At this time total_revenue is 30
|
|
497
|
-
TDJSONObject userProperties;
|
|
498
|
-
userProperties.SetNumber("total_revenue",30;
|
|
499
|
-
ThinkingAnalyticsAPI::UserAdd(userProperties);
|
|
500
|
-
//At this time total_revenue is 678
|
|
501
|
-
TDJSONObject userProperties1;
|
|
502
|
-
userProperties1.SetNumber("total_revenue",648);
|
|
503
|
-
ThinkingAnalyticsAPI::UserAdd(userProperties1);
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
<!-- unsupported block: 34 -->
|
|
507
|
-
|
|
508
|
-
The property key is a string, and Value only allows numeric values.
|
|
509
|
-
|
|
510
|
-
#### 3.4 UserUnset
|
|
511
|
-
|
|
512
|
-
If you need to reset a user's property, you can call `UserUnset` to clear the value of a specified user property. This interface supports passing string or list type parameters:
|
|
513
|
-
|
|
514
|
-
```
|
|
515
|
-
ThinkingAnalyticsAPI::UserUnset("userUnset_key");
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
<!-- unsupported block: 34 -->
|
|
519
|
-
|
|
520
|
-
The passed value is the Key of the property to be cleared.
|
|
521
|
-
|
|
522
|
-
#### 3.5 UserDelete
|
|
523
|
-
|
|
524
|
-
If you need to delete a user, you can call `UserDelete` to delete that user. You will no longer be able to query that user's user properties, but the events generated by that user can still be queried.
|
|
525
|
-
|
|
526
|
-
```
|
|
527
|
-
ThinkingAnalyticsAPI::UserDelete();
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
#### 3.6 UserAppend
|
|
531
|
-
|
|
532
|
-
You can call `UserAppend` to append elements to `List` type user properties:
|
|
533
|
-
|
|
534
|
-
```
|
|
535
|
-
TDJSONObject userProperties;
|
|
536
|
-
vector<string> listValue;
|
|
537
|
-
listValue.push_back("apple");
|
|
538
|
-
listValue.push_back("ball");
|
|
539
|
-
userProperties.SetList("user_list",listValue);
|
|
540
|
-
ThinkingAnalyticsAPI::UserAppend(userProperties);
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
#### 3.7 UserUniqAppend
|
|
544
|
-
|
|
545
|
-
You can call `UserUniqAppend` to append elements to array type user properties. Calling `UserUniqAppend` interface will deduplicate the appended user properties, while `UserAppend` interface does not deduplicate, so user properties may contain duplicates.
|
|
546
|
-
|
|
547
|
-
```
|
|
548
|
-
//At this time user_list property value is ["apple", "ball"]
|
|
549
|
-
TDJSONObject userProperties1;
|
|
550
|
-
vector<string> listValue1;
|
|
551
|
-
listValue1.push_back("apple");
|
|
552
|
-
listValue1.push_back("ball");
|
|
553
|
-
userProperties1.SetList("user_list",listValue1);
|
|
554
|
-
ThinkingAnalyticsAPI::UserAppend(userProperties1);
|
|
555
|
-
|
|
556
|
-
//At this time user_list property value is ["apple", "apple", "ball", "cube"]
|
|
557
|
-
TDJSONObject userProperties2;
|
|
558
|
-
vector<string> listValue1;
|
|
559
|
-
listValue2.push_back("apple");
|
|
560
|
-
listValue2.push_back("cube");
|
|
561
|
-
userProperties2.SetList("user_list",listValue2);
|
|
562
|
-
ThinkingAnalyticsAPI::UserAppend(userProperties2);
|
|
563
|
-
|
|
564
|
-
//At this time user_list property value is ["apple", "ball", "cube"]
|
|
565
|
-
ThinkingAnalyticsAPI::UserUniqAppend(userProperties2);
|
|
566
|
-
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
### IV. Encryption Function
|
|
570
|
-
|
|
571
|
-
Starting from version v1.3.7, SDK supports using AES+RSA to encrypt data. The data encryption function requires client and server to work together. Please consult your customer success manager for specific usage.
|
|
572
|
-
|
|
573
|
-
```
|
|
574
|
-
TDConfig config;
|
|
575
|
-
config.appid = appid;
|
|
576
|
-
config.server_url = server_url;
|
|
577
|
-
config.EnableEncrypt(1,"publickKey");
|
|
578
|
-
ThinkingAnalyticsAPI::Init(config);
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### V. Other Features
|
|
582
|
-
|
|
583
|
-
#### 5.1 Print SDK Logs
|
|
584
|
-
|
|
585
|
-
You can enable SDK log printing through the EnableLog interface. After enabling, the reported data will be printed in the IDE console.
|
|
586
|
-
|
|
587
|
-
```
|
|
588
|
-
ThinkingAnalyticsAPI::EnableLog(true);
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
#### 5.2 Preset Properties Description
|
|
592
|
-
|
|
593
|
-
**Property Name**
|
|
594
|
-
|
|
595
|
-
**Chinese Name**
|
|
596
|
-
|
|
597
|
-
**Property Type**
|
|
598
|
-
|
|
599
|
-
**Description**
|
|
600
|
-
|
|
601
|
-
#ip
|
|
602
|
-
|
|
603
|
-
IP Address
|
|
604
|
-
|
|
605
|
-
Text
|
|
606
|
-
|
|
607
|
-
User's IP address, TE will use this to obtain user's geographic location information
|
|
608
|
-
|
|
609
|
-
#country
|
|
610
|
-
|
|
611
|
-
Country
|
|
612
|
-
|
|
613
|
-
Text
|
|
614
|
-
|
|
615
|
-
User's country, generated based on IP address
|
|
616
|
-
|
|
617
|
-
#country_code
|
|
618
|
-
|
|
619
|
-
Country Code
|
|
620
|
-
|
|
621
|
-
Text
|
|
622
|
-
|
|
623
|
-
User's country code (ISO 3166-1 alpha-2, i.e., two uppercase English letters), generated based on IP address
|
|
624
|
-
|
|
625
|
-
#province
|
|
626
|
-
|
|
627
|
-
Province
|
|
628
|
-
|
|
629
|
-
Text
|
|
630
|
-
|
|
631
|
-
User's province, generated based on IP address
|
|
632
|
-
|
|
633
|
-
#city
|
|
634
|
-
|
|
635
|
-
City
|
|
636
|
-
|
|
637
|
-
Text
|
|
638
|
-
|
|
639
|
-
User's city, generated based on IP address
|
|
640
|
-
|
|
641
|
-
#os
|
|
642
|
-
|
|
643
|
-
Operating System
|
|
644
|
-
|
|
645
|
-
Text
|
|
646
|
-
|
|
647
|
-
Such as MacOS, Windows, etc.
|
|
648
|
-
|
|
649
|
-
#device_id
|
|
650
|
-
|
|
651
|
-
Device ID
|
|
652
|
-
|
|
653
|
-
Text
|
|
654
|
-
|
|
655
|
-
User's device ID
|
|
656
|
-
|
|
657
|
-
#lib
|
|
658
|
-
|
|
659
|
-
SDK Type
|
|
660
|
-
|
|
661
|
-
Text
|
|
662
|
-
|
|
663
|
-
The type of SDK you integrated, such as Android, iOS, etc.
|
|
664
|
-
|
|
665
|
-
#lib_version
|
|
666
|
-
|
|
667
|
-
SDK Version
|
|
668
|
-
|
|
669
|
-
Text
|
|
670
|
-
|
|
671
|
-
The version of SDK you integrated
|
|
672
|
-
|
|
673
|
-
#### 5.3 Calibrate Time
|
|
674
|
-
|
|
675
|
-
By default, SDK uses the local time as the event occurrence time. If users manually modify the device time, it will affect your business analysis. At this time, you can ensure the accuracy of event occurrence time through time calibration operations. We provide two time calibration methods: `timestamp` and `automatic`.
|
|
676
|
-
|
|
677
|
-
- You can use the current timestamp obtained from the server to calibrate SDK time. After that, all calls without specified time, including event data and user property setting operations, will use the calibrated time as the occurrence time.
|
|
678
|
-
|
|
679
|
-
```
|
|
680
|
-
// 1585633785954 is the current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
681
|
-
ThinkingAnalyticsAPI::CalibrateTime(1585633785954);
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
- You can also set automatic time calibration. After that, SDK will attempt to obtain the current time from the config interface and calibrate SDK time. If the correct return result is not obtained, the local time will be used to report data subsequently.
|
|
685
|
-
|
|
686
|
-
```
|
|
687
|
-
TDConfig config;
|
|
688
|
-
config.appid = appid;
|
|
689
|
-
config.server_url = server_url;
|
|
690
|
-
config.enableAutoCalibrated = true;
|
|
691
|
-
ThinkingAnalyticsAPI::Init(config);
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
#### 5.4 Flush Data Immediately
|
|
695
|
-
|
|
696
|
-
In some business scenarios, if you expect data to be reported to the TE server immediately, you can complete it by calling the `flush` interface
|
|
697
|
-
|
|
698
|
-
```
|
|
699
|
-
ThinkingAnalyticsAPI::Flush();
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
#### 5.5 Get Device ID
|
|
703
|
-
|
|
704
|
-
You can get the device ID by calling `getDeviceId`:
|
|
705
|
-
|
|
706
|
-
```
|
|
707
|
-
ThinkingAnalyticsAPI::GetDeviceId();
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
#### 5.6 Set Default Timezone
|
|
711
|
-
|
|
712
|
-
By default, SDK uses the device's local time at the time of the interface call as the event occurrence time for reporting. You can also set a default timezone through the interface so that all events will be aligned to the event time according to the timezone you set:
|
|
713
|
-
|
|
714
|
-
```
|
|
715
|
-
TDConfig config;
|
|
716
|
-
config.appid = appid;
|
|
717
|
-
config.server_url = server_url;
|
|
718
|
-
config.zoneOffset = 5;
|
|
719
|
-
ThinkingAnalyticsAPI::Init(config);
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
<!-- unsupported block: 34 -->
|
|
723
|
-
|
|
724
|
-
Note: Aligning event time with a specified timezone will lose the device's local timezone information. If you need to preserve the device's local timezone information, you currently need to add relevant properties to the event yourself.
|
|
725
|
-
|
|
726
|
-
---
|
|
727
|
-
|
|
728
|
-
# Real-time Debugging
|
|
729
|
-
|
|
730
|
-
During SDK integration, you can perform real-time debugging by viewing SDK logs in the IDE console or using TE's Debug feature.
|
|
731
|
-
|
|
732
|
-
### I. Print SDK Logs
|
|
733
|
-
|
|
734
|
-
```
|
|
735
|
-
TDAnalytics.EnableLogType(TDLogType.LogTxt);
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
<!-- unsupported block: 34 -->
|
|
739
|
-
|
|
740
|
-
After enabling logs, you can filter ThinkingAnalytics related logs in the IDE to observe SDK data reporting.
|
|
741
|
-
|
|
742
|
-
### II. Enable Debug Mode
|
|
743
|
-
|
|
744
|
-
Enabling Debug mode requires the following two steps:
|
|
745
|
-
|
|
746
|
-
1. Enable Debug mode on the client side
|
|
747
|
-
The following is an example code for enabling Debug mode on the client side:
|
|
748
|
-
|
|
749
|
-
```
|
|
750
|
-
// Get TDConfig instance
|
|
751
|
-
TDConfig config = new TDConfig();
|
|
752
|
-
config.appid = TA_APP_ID;
|
|
753
|
-
config.server_url = TA_SERVER_URL;
|
|
754
|
-
/*
|
|
755
|
-
Set the running mode to Debug mode
|
|
756
|
-
NORMAL mode: Data will be stored in cache and reported according to a certain cache strategy. Default is NORMAL mode; recommended for production environment
|
|
757
|
-
Debug mode: Data is reported one by one. When problems occur, users will be prompted with logs and exceptions; not recommended for production environment
|
|
758
|
-
DebugOnly mode: Only validates data, will not be stored in database; not recommended for production environment
|
|
759
|
-
*/
|
|
760
|
-
config.mode = TDMode.Debug;
|
|
761
|
-
// Initialize SDK
|
|
762
|
-
TDAnalytics.Init(config);
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
1. Add Debug device in TE backend
|
|
766
|
-
To prevent Debug mode from being launched in production environments, only specified devices can enable Debug mode. Debug mode can only be enabled if Debug mode is enabled on the client side and the device ID is configured in the "Debug Data" section of the "Tracking Management" page in TE backend.
|
|
767
|
-
|
|
768
|
-
Device ID can be obtained through the following three ways:
|
|
769
|
-
|
|
770
|
-
- The #device_id property in event data in TE platform
|
|
771
|
-
- Client logs: SDK will print device DeviceId after initialization completes
|
|
772
|
-
- Through instance interface call: Get Device ID
|
|
773
|
-
<!-- unsupported block: 34 -->
|
|
774
|
-
|
|
775
|
-
Debug mode may affect data collection quality and App stability, it is only used for data verification during integration stage, do not use it in production environment.
|
|
776
|
-
|
|
777
|
-
---
|
|
778
|
-
|
|
779
|
-
# Real-time Debugging
|
|
780
|
-
|
|
781
|
-
During SDK integration, you can perform real-time debugging by viewing SDK logs in the IDE console or using TE's Debug feature.
|
|
782
|
-
|
|
783
|
-
### I. Print SDK Logs
|
|
784
|
-
|
|
785
|
-
```
|
|
786
|
-
ThinkingAnalyticsAPI::EnableLogType(LOGCONSOLE);//Print logs to console
|
|
787
|
-
ThinkingAnalyticsAPI::EnableLogType(LOGTXT);//Output logs to local file
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
<!-- unsupported block: 34 -->
|
|
791
|
-
|
|
792
|
-
After enabling logs, you can filter ThinkingAnalytics related logs in the IDE to observe SDK data reporting.
|
|
793
|
-
|
|
794
|
-
### II. Enable Debug Mode
|
|
795
|
-
|
|
796
|
-
Enabling Debug mode requires the following two steps:
|
|
797
|
-
|
|
798
|
-
1. Enable Debug mode on the client side
|
|
799
|
-
The following is an example code for enabling Debug mode on the client side:
|
|
800
|
-
|
|
801
|
-
```
|
|
802
|
-
// Get TDConfig instance
|
|
803
|
-
TDConfig config;
|
|
804
|
-
config.appid = TA_APP_ID;
|
|
805
|
-
config.server_url = TA_SERVER_URL;
|
|
806
|
-
/*
|
|
807
|
-
Set the running mode to Debug mode
|
|
808
|
-
NORMAL mode: Data will be stored in cache and reported according to a certain cache strategy. Default is NORMAL mode; recommended for production environment
|
|
809
|
-
Debug mode: Data is reported one by one. When problems occur, users will be prompted with logs and exceptions; not recommended for production environment
|
|
810
|
-
DebugOnly mode: Only validates data, will not be stored in database; not recommended for production environment
|
|
811
|
-
*/
|
|
812
|
-
config.mode = TDMode.TD_DEBUG;
|
|
813
|
-
// Initialize SDK
|
|
814
|
-
ThinkingAnalyticsAPI::Init(config);
|
|
815
|
-
```
|
|
816
|
-
|
|
817
|
-
1. Add Debug device in TE backend
|
|
818
|
-
To prevent Debug mode from being launched in production environments, only specified devices can enable Debug mode. Debug mode can only be enabled if Debug mode is enabled on the client side and the device ID is configured in the "Debug Data" section of the "Tracking Management" page in TE backend.
|
|
819
|
-
|
|
820
|
-
Device ID can be obtained through the following three ways:
|
|
821
|
-
|
|
822
|
-
- The #device_id property in event data in TE platform
|
|
823
|
-
- Client logs: SDK will print device DeviceId after initialization completes
|
|
824
|
-
- Through instance interface call: Get Device ID
|
|
825
|
-
<!-- unsupported block: 34 -->
|
|
826
|
-
|
|
827
|
-
Debug mode may affect data collection quality and App stability, it is only used for data verification during integration stage, do not use it in production environment.
|