@thinkingai/ae-cli 6.0.57 → 6.0.60
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 +10 -5
- package/README.zh.md +10 -5
- package/bin/ai-monitor.js +2 -0
- package/dist/ai-monitor-FCXSLHAP.js +32 -0
- package/dist/ai-monitor.js +135 -0
- package/dist/{auth-YEIJLBFY.js → auth-ATK2SLEV.js} +12 -11
- package/dist/{automation-NAR5DDGL.js → automation-FLCPFMN4.js} +5 -5
- package/dist/{capability-P7DD4Q73.js → capability-6KTSOI7L.js} +32 -36
- package/dist/{chunk-JCWM2TYP.js → chunk-2ETRY2CU.js} +16 -16
- package/dist/{chunk-IN7KKL6K.js → chunk-2F64AZYH.js} +1 -1
- package/dist/{chunk-JNVVJ273.js → chunk-4PSTYEG5.js} +5 -10
- package/dist/{chunk-QEMQKVHW.js → chunk-5E7MTTFN.js} +3 -3
- package/dist/{chunk-RJHGDWSC.js → chunk-5M5LBRR3.js} +2 -2
- package/dist/chunk-6M7ZEDT2.js +182 -0
- package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
- package/dist/chunk-AXTO4FTM.js +1285 -0
- package/dist/{chunk-TKVVACEJ.js → chunk-BEYLCUZX.js} +17 -12
- package/dist/chunk-CF6JTT2U.js +64 -0
- package/dist/{chunk-N6XBLRB7.js → chunk-F2VFZUGG.js} +2 -2
- package/dist/{chunk-ZGIYG473.js → chunk-HSZAIPUX.js} +48 -13
- package/dist/{chunk-H3K5UGYC.js → chunk-HTZ2MLYA.js} +48 -22
- package/dist/{chunk-QZUVLFNR.js → chunk-HVMCPKOZ.js} +1 -1
- package/dist/{chunk-7JAVT5TK.js → chunk-KTJXD27G.js} +2 -2
- package/dist/{chunk-TULINOLS.js → chunk-LOR4IA26.js} +565 -315
- package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
- package/dist/{chunk-7ABK2PEJ.js → chunk-SDKW6LYE.js} +88 -36
- package/dist/{chunk-752BSLZC.js → chunk-VJUXKVRE.js} +1 -1
- package/dist/chunk-VRMGHQKE.js +556 -0
- package/dist/{compat-check-PMEGUPZU.js → compat-check-XD2U7PZ2.js} +3 -3
- package/dist/{config-VWVPR4WW.js → config-U3GDWU6E.js} +26 -13
- package/dist/{context-F6FCGTF3.js → context-YAQG6YQC.js} +3 -3
- package/dist/{data-integration-6UAZO4GG.js → data-integration-QE37EQ3A.js} +1 -1
- package/dist/{evaluation-4LO2O4AF.js → evaluation-2JSF4V47.js} +13 -158
- package/dist/index.js +87 -582
- package/dist/{memory-HHPX3NF2.js → memory-WEB27VI6.js} +8 -8
- package/dist/{metadata-HEQQEEG3.js → metadata-7FYE4234.js} +8 -8
- package/dist/{model-7UHGWYVR.js → model-T7H7Q6BG.js} +3 -3
- package/dist/{personal-semantic-preference-V4L6ZWR2.js → personal-semantic-preference-O6VXM74A.js} +7 -7
- package/dist/{project-semantic-NKHKJX6M.js → project-semantic-2GGFJWW6.js} +16 -14
- package/dist/{sync-ZJMXCRIN.js → sync-ULBB7WO5.js} +5 -5
- package/dist/{te-agent-WBKIFEQD.js → te-agent-6RMF7LUV.js} +6 -6
- package/dist/{te-analysis-ADX7RKO4.js → te-analysis-HSYC7GNV.js} +383 -194
- package/dist/{te-community-PREDRXG3.js → te-community-FLKZGQKB.js} +10 -10
- package/dist/{te-dataops-ITWJHO2U.js → te-dataops-OQQGTCUA.js} +5 -5
- package/dist/{te-engage-VE2NUH5V.js → te-engage-RIEBHL5T.js} +10 -10
- package/dist/{te-kb-WSMOW7WS.js → te-kb-4HG2FMHJ.js} +19 -10
- package/dist/{te-system-YM657FKO.js → te-system-AL4B4XZL.js} +3 -3
- package/dist/{te-team-T2WRLOOD.js → te-team-5O4UVUWE.js} +6 -6
- package/dist/{things-6QOMFXOG.js → things-TSJ64GBT.js} +6 -6
- package/dist/{update-I4MOUYOX.js → update-Q5LURAWV.js} +4 -4
- package/dist/{workspace-LYDAP647.js → workspace-FF2HXJGR.js} +5 -5
- package/package.json +8 -6
- package/skills/ae-ai-monitor/SKILL.md +179 -0
- package/skills/ae-ai-monitor/references/read-commands.md +866 -0
- package/skills/ae-analysis/SKILL.md +10 -4
- package/skills/ae-analysis/references/adhoc_export.md +3 -1
- package/skills/ae-analysis/references/ai_models.md +1 -0
- package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
- package/skills/ae-analysis/references/asset_search.md +1 -1
- package/skills/ae-analysis/references/bad_case_begin.md +12 -0
- package/skills/ae-analysis/references/bad_case_get.md +12 -0
- package/skills/ae-analysis/references/bad_case_history.md +12 -0
- package/skills/ae-analysis/references/bad_case_list.md +12 -0
- package/skills/ae-analysis/references/bad_case_review.md +51 -0
- package/skills/ae-analysis/references/bad_case_run.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
- package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
- package/skills/ae-analysis/references/bi_panel_list.md +1 -1
- package/skills/ae-analysis/references/bi_panel_share.md +3 -1
- package/skills/ae-analysis/references/catalog_list.md +2 -0
- package/skills/ae-analysis/references/command_index.md +38 -29
- package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
- package/skills/ae-analysis/references/dashboard_handover.md +3 -1
- package/skills/ae-analysis/references/dashboard_list.md +3 -3
- package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
- package/skills/ae-analysis/references/dashboard_share.md +3 -1
- package/skills/ae-analysis/references/dashboard_update.md +3 -2
- package/skills/ae-analysis/references/filter_value_list.md +2 -0
- package/skills/ae-analysis/references/folder_share.md +8 -2
- package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
- package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
- package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
- package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
- package/skills/ae-analysis/references/project_member_add.md +3 -1
- package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
- package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
- package/skills/ae-analysis/references/project_member_update.md +3 -1
- package/skills/ae-analysis/references/project_owner_update.md +3 -1
- package/skills/ae-analysis/references/project_role_upsert.md +5 -3
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
- package/skills/ae-analysis/references/project_space_share.md +8 -2
- package/skills/ae-analysis/references/property_get.md +2 -0
- package/skills/ae-analysis/references/public_link_list.md +3 -1
- package/skills/ae-analysis/references/query_cancel.md +4 -1
- package/skills/ae-analysis/references/report_data_run.md +1 -1
- package/skills/ae-analysis/references/report_list.md +3 -3
- package/skills/ae-analysis/references/scenario_append.md +2 -2
- package/skills/ae-analysis/references/scenario_collect.md +15 -4
- package/skills/ae-analysis/references/scenario_list.md +2 -1
- package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
- package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
- package/skills/ae-analysis/references/user_tag_create.md +4 -1
- package/skills/ae-analysis/references/user_tag_get.md +2 -0
- package/skills/ae-analysis/references/user_tag_models.md +8 -2
- package/skills/ae-analysis/references/user_tag_update.md +5 -2
- package/skills/ae-analysis/references/virtual_property_create.md +12 -1
- package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
- package/skills/ae-automation/SKILL.md +4 -2
- package/skills/ae-capability/SKILL.md +9 -5
- package/skills/ae-community/SKILL.md +1 -0
- package/skills/ae-dataops/SKILL.md +1 -0
- package/skills/ae-engage/SKILL.md +1 -0
- package/skills/ae-evaluation/SKILL.md +17 -2
- package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
- package/skills/ae-kb/SKILL.md +9 -5
- package/skills/ae-kb/references/analysis-workflow.md +11 -2
- package/skills/ae-kb/references/query-workflow.md +9 -6
- package/skills/ae-kb/references/versions.md +1 -1
- package/skills/ae-kb-discovery/SKILL.md +15 -6
- package/skills/ae-metadata/SKILL.md +1 -0
- package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
- package/skills/ae-team/SKILL.md +1 -1
- package/skills/ae-tracking-matrix/SKILL.md +170 -0
- 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 +12 -0
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
- package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
- package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
- package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
- package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
- package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
- package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
- package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
- package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
- package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
- package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
- package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
- package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
- package/dist/chunk-AMBFK2K3.js +0 -28
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
---
|
|
2
|
+
code: c_sdk_installation
|
|
3
|
+
name: "C"
|
|
4
|
+
wikiToken: SLlQwuOYRifeDVkRAxTc08pVnMg
|
|
5
|
+
parentWikiToken: O3YxwgHGiiEnvYkHCcIcX51inkf
|
|
6
|
+
updateTime: 1745310920000
|
|
7
|
+
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=c_sdk_installation
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# C
|
|
11
|
+
|
|
12
|
+
::: tip Note
|
|
13
|
+
|
|
14
|
+
Before integration, please read the Pre-Integration Guide first.
|
|
15
|
+
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
**Latest Version**: v2.0.0
|
|
19
|
+
|
|
20
|
+
**Update Date**: 2023-11-30
|
|
21
|
+
|
|
22
|
+
**Download**: Source Code
|
|
23
|
+
|
|
24
|
+
::: warning Note
|
|
25
|
+
|
|
26
|
+
This document applies to v2.0.0 and later versions. For historical versions, please refer to C SDK Integration Guide (V1).
|
|
27
|
+
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
### 1. SDK Integration
|
|
31
|
+
|
|
32
|
+
1. Download C SDK source code, modify `CMakeLists.txt` file, use `logconsumer` method to compile .a file
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
cmake_minimum_required(VERSION 3.12)
|
|
36
|
+
project(thinking_data_c)
|
|
37
|
+
message(STATUS "[ThinkingData] CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM} ")
|
|
38
|
+
|
|
39
|
+
include_directories(include)
|
|
40
|
+
|
|
41
|
+
#################################################################
|
|
42
|
+
|
|
43
|
+
# Product Library: logging consumer
|
|
44
|
+
if(WIN32)
|
|
45
|
+
add_compile_definitions(USE_WIN)
|
|
46
|
+
set(CMAKE_C_FLAGS "-std=c89 -pedantic-errors -m64")
|
|
47
|
+
else()
|
|
48
|
+
add_compile_definitions(USE_POSIX)
|
|
49
|
+
set(CMAKE_C_FLAGS "-std=c89")
|
|
50
|
+
endif()
|
|
51
|
+
SET(TE_LIB_NAME thinkingdata)
|
|
52
|
+
add_library(${TE_LIB_NAME} src/thinkingdata.c src/td_json.c src/td_list.c src/td_util.c src/td_logger_consumer.c)
|
|
53
|
+
if(WIN32)
|
|
54
|
+
include_directories(thirdparty/pcre/include)
|
|
55
|
+
link_directories(thirdparty/pcre/lib)
|
|
56
|
+
target_link_libraries(${TE_LIB_NAME} pcre_x64)
|
|
57
|
+
endif()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Compile the project to get the `libthinkingdata.a` file.
|
|
61
|
+
|
|
62
|
+
2. Install LogBus
|
|
63
|
+
We recommend using SDK + LogBus for server-side data collection and reporting. You can refer to the following documentation for LogBus installation: LogBus User Guide.
|
|
64
|
+
|
|
65
|
+
### 2. Initialization
|
|
66
|
+
|
|
67
|
+
Here is sample code for SDK initialization:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
struct TDAnalytics* ta = NULL;
|
|
71
|
+
struct TDConsumer* consumer = NULL;
|
|
72
|
+
|
|
73
|
+
TDConfig* config = td_init_config();
|
|
74
|
+
char* logPath = "LOG_DIRECTORY";
|
|
75
|
+
TD_ASSERT(TD_OK == td_add_string("file_path", logPath, strlen(logPath), config));
|
|
76
|
+
|
|
77
|
+
if (TD_OK != td_init_consumer(&consumer, config)) {
|
|
78
|
+
fprintf(stderr, "Failed to initialize the consumer.");
|
|
79
|
+
}
|
|
80
|
+
td_free_properties(config);
|
|
81
|
+
|
|
82
|
+
if (TD_OK != td_init(consumer, &ta)) {
|
|
83
|
+
fprintf(stderr, "Failed to initialize the SDK.");
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`LOG_DIRECTORY` is the local folder address for writing. You just need to set LogBus's monitoring folder path to this address to use LogBus for data monitoring and uploading.
|
|
89
|
+
|
|
90
|
+
### 3. Common Features
|
|
91
|
+
|
|
92
|
+
To ensure successful binding of visitor ID and account ID, if your game uses both visitor ID and account ID, we strongly recommend uploading both IDs. Otherwise, account matching issues may occur, leading to duplicate user counts. For specific ID binding rules, please refer to the User Identification Rules chapter.
|
|
93
|
+
|
|
94
|
+
#### 3.1 Track Events
|
|
95
|
+
|
|
96
|
+
You can call `td_track` to upload events. We recommend setting event properties and sending conditions based on your previously documented requirements. Here is sample code for tracking events:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
// Generate custom properties
|
|
100
|
+
TDProperties *properties = td_init_properties();
|
|
101
|
+
// Set user IP address, TE system will parse user geographic location based on IP
|
|
102
|
+
TD_ASSERT(TD_OK == td_add_string("#ip", "192.168.1.1", strlen("192.168.1.1"), properties));
|
|
103
|
+
// Add custom properties
|
|
104
|
+
TD_ASSERT(TD_OK == td_add_string("channel", "ta", strlen("ta"), properties));// String
|
|
105
|
+
TD_ASSERT(TD_OK == td_add_int("age", 1, properties)); // Number
|
|
106
|
+
TD_ASSERT(TD_OK == td_add_bool("is_success", TD_TRUE, properties));// Boolean
|
|
107
|
+
TD_ASSERT(TD_OK == td_add_date("birthday", time(NULL), 0, properties));// Date
|
|
108
|
+
// Array
|
|
109
|
+
TD_ASSERT(TD_OK == td_append_array("arr", "value", strlen("value"), properties));
|
|
110
|
+
TD_ASSERT(TD_OK == td_append_array("arr", "value1", strlen("value1"), properties));
|
|
111
|
+
// Object
|
|
112
|
+
TDProperties *object = td_init_custom_properties("object");
|
|
113
|
+
TD_ASSERT(TD_OK == td_add_string("key", "value", strlen("value"), object));
|
|
114
|
+
TD_ASSERT(TD_OK == td_add_property(object, properties));
|
|
115
|
+
// Object Array
|
|
116
|
+
TDProperties *object1 = td_init_custom_properties("object1");
|
|
117
|
+
TD_ASSERT(TD_OK == td_add_string("key", "value", strlen("value"), object1));
|
|
118
|
+
TD_ASSERT(TD_OK == td_append_properties("object_arr", object1, properties));
|
|
119
|
+
// Report event with custom properties, account_id and distinct_id must have at least one set
|
|
120
|
+
TD_ASSERT(TD_OK == td_track("account_id", "distinct_id", "payment", properties, ta));
|
|
121
|
+
td_free_properties(properties);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- Event name must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters.
|
|
125
|
+
- Key is the property name, must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters. Case-insensitive, TE will convert to lowercase.
|
|
126
|
+
- Value is the property value, supporting strings, numbers, booleans, dates, objects, object arrays, and arrays.
|
|
127
|
+
|
|
128
|
+
**User property requirements are consistent with event property requirements**
|
|
129
|
+
|
|
130
|
+
#### 3.2 Set User Properties
|
|
131
|
+
|
|
132
|
+
For general user properties, you can call `td_user_set` to set them. Properties uploaded via this interface will overwrite existing property values. If the user property does not exist previously, a new user property will be created with the same type as the uploaded property. Here is an example of setting a username:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
// At this point, username is "TA"
|
|
136
|
+
// account_id and distinct_id must have at least one set
|
|
137
|
+
TDProperties *user_properties = td_init_properties();
|
|
138
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TA", strlen("TA"), user_properties));
|
|
139
|
+
TD_ASSERT(TD_OK == td_user_set(account_id, distinct_id, user_properties,ta));
|
|
140
|
+
td_free_properties(user_properties);
|
|
141
|
+
|
|
142
|
+
// At this point, userName is "TE"
|
|
143
|
+
TDProperties *user_properties2 = td_init_properties();
|
|
144
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TE", strlen("TE"), user_properties2));
|
|
145
|
+
TD_ASSERT(TD_OK == td_user_set(account_id, distinct_id, user_properties2,ta));
|
|
146
|
+
td_free_properties(user_properties2);
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### 3.3 Data Reporting
|
|
150
|
+
|
|
151
|
+
When initializing SDK using `td_init_consumer()` method, SDK will write collected data to disk in real-time.
|
|
152
|
+
|
|
153
|
+
The `td_flush()` function internally synchronizes the default memory cache in the file system to disk in real-time. Generally, no need to call manually.
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
td_flush(ta);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### 3.4 Close SDK
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
td_free(ta);
|
|
163
|
+
td_consumer_free(consumer);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Close and exit the SDK. Please call this interface before shutting down the server to avoid data loss in the cache.
|
|
167
|
+
|
|
168
|
+
### 4. Best Practices
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
struct TDAnalytics* ta = NULL;
|
|
172
|
+
struct TDConsumer* consumer = NULL;
|
|
173
|
+
|
|
174
|
+
TDConfig* config = td_init_config();
|
|
175
|
+
char* logPath = "LOG_DIRECTORY";
|
|
176
|
+
TD_ASSERT(TD_OK == td_add_string("file_path", logPath, strlen(logPath), config));
|
|
177
|
+
|
|
178
|
+
if (TD_OK != td_init_consumer(&consumer, config)) {
|
|
179
|
+
fprintf(stderr, "Failed to initialize the consumer.");
|
|
180
|
+
}
|
|
181
|
+
td_free_properties(config);
|
|
182
|
+
|
|
183
|
+
if (TD_OK != td_init(consumer, &ta)) {
|
|
184
|
+
fprintf(stderr, "Failed to initialize the SDK.");
|
|
185
|
+
return 1;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Generate custom properties
|
|
189
|
+
TDProperties *properties = td_init_properties();
|
|
190
|
+
// Set user IP address, TE system will parse user geographic location based on IP
|
|
191
|
+
TD_ASSERT(TD_OK == td_add_string("#ip", "192.168.1.1", strlen("192.168.1.1"), properties));
|
|
192
|
+
// Add custom properties
|
|
193
|
+
TD_ASSERT(TD_OK == td_add_string("channel", "ta", strlen("ta"), properties));// String
|
|
194
|
+
TD_ASSERT(TD_OK == td_add_int("age", 1, properties)); // Number
|
|
195
|
+
TD_ASSERT(TD_OK == td_add_bool("is_success", TD_TRUE, properties));// Boolean
|
|
196
|
+
TD_ASSERT(TD_OK == td_add_date("birthday", time(NULL), 0, properties));// Date
|
|
197
|
+
// Array
|
|
198
|
+
TD_ASSERT(TD_OK == td_append_array("arr", "value", strlen("value"), properties));
|
|
199
|
+
TD_ASSERT(TD_OK == td_append_array("arr", "value1", strlen("value1"), properties));
|
|
200
|
+
// Object
|
|
201
|
+
TDProperties *object = td_init_custom_properties("object");
|
|
202
|
+
TD_ASSERT(TD_OK == td_add_string("key", "value", strlen("value"), object));
|
|
203
|
+
TD_ASSERT(TD_OK == td_add_property(object, properties));
|
|
204
|
+
// Object Array
|
|
205
|
+
TDProperties *object1 = td_init_custom_properties("object1");
|
|
206
|
+
TD_ASSERT(TD_OK == td_add_string("key", "value", strlen("value"), object1));
|
|
207
|
+
TD_ASSERT(TD_OK == td_append_properties("object_arr", object1, properties));
|
|
208
|
+
// Report event with custom properties, account_id and distinct_id must have at least one set
|
|
209
|
+
TD_ASSERT(TD_OK == td_track("account_id", "distinct_id", "payment", properties, ta));
|
|
210
|
+
td_free_properties(properties);
|
|
211
|
+
|
|
212
|
+
// At this point, username is "TA"
|
|
213
|
+
// account_id and distinct_id must have at least one set
|
|
214
|
+
TDProperties *user_properties = td_init_properties();
|
|
215
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TA", strlen("TA"), user_properties));
|
|
216
|
+
TD_ASSERT(TD_OK == td_user_set("account_id", "distinct_id", user_properties,ta));
|
|
217
|
+
td_free_properties(user_properties);
|
|
218
|
+
|
|
219
|
+
// At this point, userName is "TE"
|
|
220
|
+
TDProperties *user_properties2 = td_init_properties();
|
|
221
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TE", strlen("TE"), user_properties2));
|
|
222
|
+
TD_ASSERT(TD_OK == td_user_set("account_id", "distinct_id", user_properties2,ta));
|
|
223
|
+
td_free_properties(user_properties2);
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
# Advanced Guide
|
|
229
|
+
|
|
230
|
+
### 1. Track Events
|
|
231
|
+
|
|
232
|
+
After SDK initialization, you can perform data tracking to collect user behavior information. Generally, regular events can meet business scenario requirements. You can also use first-time events, updateable events, etc. based on your actual business scenarios.
|
|
233
|
+
|
|
234
|
+
#### 1.1 Regular Events
|
|
235
|
+
|
|
236
|
+
You can call `td_track` to upload events. We recommend setting event properties and sending conditions based on your previously documented requirements. Here is an example of a user purchasing a product:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
// Set event properties
|
|
240
|
+
TDProperties *properties = td_init_properties();
|
|
241
|
+
TD_ASSERT(TD_OK == td_add_string("product_name", "goods_name", strlen("goods_name"), properties));
|
|
242
|
+
// Report event with custom properties, account_id and distinct_id must have at least one set
|
|
243
|
+
TD_ASSERT(TD_OK == td_track("account_id", "distinct_id", "product_buy", properties, ta));
|
|
244
|
+
td_free_properties(properties);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### 1.2 First-Time Events
|
|
248
|
+
|
|
249
|
+
First-time events are events that are recorded only once for a specific device or other dimensional ID. For example, in some scenarios, you may want to record an activation event on a specific device, which can be reported using a first-time event.
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
TD_ASSERT(TD_OK == td_track_first_event("account_id", "distinct_id", "device_activation", "first_id", properties, ta));
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Note: Since first-time verification is completed on the server side, first-time events will be delayed by 1 hour before entering the database.
|
|
256
|
+
|
|
257
|
+
#### 1.3 Updateable Events
|
|
258
|
+
|
|
259
|
+
You can implement the need to modify event data in specific scenarios through updateable events. Updateable events need to specify an ID that identifies the event and pass it when creating the updateable event object. TE backend will determine the data to be updated based on the event name and event ID.
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
// Report updateable event, event name is UPDATABLE_EVENT, event ID is event_id
|
|
263
|
+
// After reporting, event property status is 3, price is 100
|
|
264
|
+
TDProperties *properties = td_init_properties();
|
|
265
|
+
TD_ASSERT(TD_OK == td_add_int("price",100,properties));
|
|
266
|
+
TD_ASSERT(TD_OK == td_add_int("status",3,properties));
|
|
267
|
+
TD_ASSERT(TD_OK == td_track_update("account_id", "distinct_id", "UPDATABLE_EVENT", "event_id",properties, ta));
|
|
268
|
+
td_free_properties(properties);
|
|
269
|
+
// After reporting, same event property status is updated to 5, price unchanged
|
|
270
|
+
TDProperties *new_properties = td_init_properties();
|
|
271
|
+
TD_ASSERT(TD_OK == td_add_int("status",5,new_properties));
|
|
272
|
+
TD_ASSERT(TD_OK == td_track_update("account_id", "distinct_id", "UPDATABLE_EVENT", "event_id",new_properties, ta));
|
|
273
|
+
td_free_properties(new_properties);
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### 1.4 Overwriteable Events
|
|
277
|
+
|
|
278
|
+
Overwriteable events are similar to updateable events, except that overwriteable events will completely overwrite historical data with the latest data. Effectively, this is equivalent to deleting the previous data and inserting the latest data. TE backend will determine the data to be updated based on the event name and event ID.
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
// Report overwriteable event, event name is OVERWRITE_EVENT, event ID is event_id
|
|
282
|
+
// After reporting, event property status is 3, price is 100
|
|
283
|
+
TDProperties *properties = td_init_properties();
|
|
284
|
+
TD_ASSERT(TD_OK == td_add_int("price",100,properties));
|
|
285
|
+
TD_ASSERT(TD_OK == td_add_int("status",3,properties));
|
|
286
|
+
TD_ASSERT(TD_OK == td_track_overwrite("account_id", "distinct_id", "OVERWRITE_EVENT", "event_id",properties, ta));
|
|
287
|
+
td_free_properties(properties);
|
|
288
|
+
// After reporting, same event property status is updated to 5, price property is deleted
|
|
289
|
+
TDProperties *new_properties = td_init_properties();
|
|
290
|
+
TD_ASSERT(TD_OK == td_add_int("status",5,new_properties));
|
|
291
|
+
TD_ASSERT(TD_OK == td_track_overwrite("account_id", "distinct_id", "OVERWRITE_EVENT", "event_id",new_properties, ta));
|
|
292
|
+
td_free_properties(new_properties);
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### 2. User Properties
|
|
296
|
+
|
|
297
|
+
TE platform supports the following user property setting APIs: `td_user_set`, `td_user_setOnce`, `td_user_add`, `td_user_unset`, `td_user_delete`, `td_user_append`, `td_user_uniq_append`.
|
|
298
|
+
|
|
299
|
+
#### 2.1 td_user_set
|
|
300
|
+
|
|
301
|
+
For general user properties, you can call `td_user_set` to set them. Properties uploaded via this interface will overwrite existing property values. If the user property does not exist previously, a new user property will be created with the same type as the uploaded property. Here is an example of setting a username:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
// At this point, username is "TA"
|
|
305
|
+
TDProperties *user_properties = td_init_properties();
|
|
306
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TA", strlen("TA"), user_properties));
|
|
307
|
+
TD_ASSERT(TD_OK == td_user_set("account_id", "distinct_id", user_properties,ta));
|
|
308
|
+
td_free_properties(user_properties);
|
|
309
|
+
|
|
310
|
+
// At this point, userName is "TE"
|
|
311
|
+
TDProperties *user_properties2 = td_init_properties();
|
|
312
|
+
TD_ASSERT(TD_OK == td_add_string("user_name", "TE", strlen("TE"), user_properties2));
|
|
313
|
+
TD_ASSERT(TD_OK == td_user_set("account_id", "distinct_id", user_properties2,ta));
|
|
314
|
+
td_free_properties(user_properties2);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### 2.2 td_user_setOnce
|
|
318
|
+
|
|
319
|
+
If you want to set a user property only once, you can call `td_user_setOnce`. When the property already has a value, this information will be ignored. Here is another example of setting a username:
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
// first_payment_time is 2018-01-01 01:23:45.678
|
|
323
|
+
TDProperties *user_properties = td_init_properties();
|
|
324
|
+
TD_ASSERT(TD_OK == td_add_string("first_payment_time", "2018-01-01 01:23:45.678", strlen("2018-01-01 01:23:45.678"), user_properties));
|
|
325
|
+
TD_ASSERT(TD_OK == td_user_setOnce("account_id", "distinct_id", user_properties,ta));
|
|
326
|
+
td_free_properties(user_properties);
|
|
327
|
+
|
|
328
|
+
// first_payment_time is still 2018-01-01 01:23:45.678
|
|
329
|
+
TDProperties *user_properties2 = td_init_properties();
|
|
330
|
+
TD_ASSERT(TD_OK == td_add_string("first_payment_time", "2018-12-31 01:23:45.678", strlen("2018-12-31 01:23:45.678"), user_properties2));
|
|
331
|
+
TD_ASSERT(TD_OK == td_user_setOnce("account_id", "distinct_id", user_properties2,ta));
|
|
332
|
+
td_free_properties(user_properties2);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### 2.3 td_user_add
|
|
336
|
+
|
|
337
|
+
When you want to upload numeric properties, you can call `td_user_add` to accumulate the property. If the property has not been set, it will be assigned 0 before calculation. Negative values can be passed, equivalent to subtraction. Here is an example of accumulating total payment amount:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
// Upload user property, at this point "total_revenue" value is 30
|
|
341
|
+
TDProperties *user_properties = td_init_properties();
|
|
342
|
+
TD_ASSERT(TD_OK == td_add_int("total_revenue", 30, user_properties));
|
|
343
|
+
TD_ASSERT(TD_OK == td_user_add("account_id", "distinct_id", user_properties, ta));
|
|
344
|
+
td_free_properties(user_properties);
|
|
345
|
+
|
|
346
|
+
// Upload user property, at this point "total_revenue" value is 678
|
|
347
|
+
TDProperties *new_user_properties = td_init_properties();
|
|
348
|
+
TD_ASSERT(TD_OK == td_add_int("total_revenue",648 , new_user_properties));
|
|
349
|
+
TD_ASSERT(TD_OK == td_user_add("account_id", "distinct_id", new_user_properties, ta));
|
|
350
|
+
td_free_properties(new_user_properties);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
The property key must be a string, and Value only allows numeric values.
|
|
354
|
+
|
|
355
|
+
#### 2.4 td_user_append
|
|
356
|
+
|
|
357
|
+
You can call `td_user_append` to append array-type user properties.
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
// At this point, user_list property value is ["apple", "ball"]
|
|
361
|
+
TDProperties *array_properties = td_init_properties();
|
|
362
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "apple", strlen("apple"), array_properties));
|
|
363
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "ball", strlen("ball"), array_properties));
|
|
364
|
+
TD_ASSERT(TD_OK == td_user_append("account_id", "distinct_id", array_properties, ta));
|
|
365
|
+
td_free_properties(array_properties);
|
|
366
|
+
|
|
367
|
+
// At this point, user_list property value is ["apple","apple","ball","cube"]
|
|
368
|
+
TDProperties *new_array_properties = td_init_properties();
|
|
369
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "apple", strlen("apple"), new_array_properties));
|
|
370
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "cube", strlen("cube"), new_array_properties));
|
|
371
|
+
TD_ASSERT(TD_OK == td_user_append("account_id", "distinct_id", new_array_properties, ta));
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
#### 2.5 td_user_uniq_append
|
|
375
|
+
|
|
376
|
+
You can call `td_user_uniq_append` to append array-type user properties. The `td_user_uniq_append` interface will deduplicate appended user properties, while `td_user_append` interface does not deduplicate, allowing duplicate user properties.
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
// At this point, user_list property value is ["apple", "ball"]
|
|
380
|
+
TDProperties *array_properties = td_init_properties();
|
|
381
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "apple", strlen("apple"), array_properties));
|
|
382
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "ball", strlen("ball"), array_properties));
|
|
383
|
+
TD_ASSERT(TD_OK == td_user_append("account_id", "distinct_id", array_properties, ta));
|
|
384
|
+
td_free_properties(array_properties);
|
|
385
|
+
|
|
386
|
+
// At this point, user_list property value is ["apple", "ball","cube"]
|
|
387
|
+
TDProperties *new_array_properties = td_init_properties();
|
|
388
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "apple", strlen("apple"), new_array_properties));
|
|
389
|
+
TD_ASSERT(TD_OK == td_append_array("user_list", "cube", strlen("cube"), new_array_properties));
|
|
390
|
+
TD_ASSERT(TD_OK == td_user_uniq_append("account_id","distinct_id", new_array_properties, ta));
|
|
391
|
+
td_free_properties(new_array_properties);
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### 2.6 td_user_unset
|
|
395
|
+
|
|
396
|
+
When you want to clear user property values, you can call `td_user_unset` to clear specified properties. If the property has not been created in the cluster, `td_user_unset` will not create the property.
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
TD_ASSERT(TD_OK == td_user_unset("account_id", "distinct_id", "test", ta));
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
td_user_unset: The parameter is the Key value of the property to be cleared.
|
|
403
|
+
|
|
404
|
+
#### 2.7 td_user_delete
|
|
405
|
+
|
|
406
|
+
If you want to delete a user, you can call `td_user_delete` to delete the user. You will no longer be able to query the user's properties, but events generated by the user can still be queried. This operation may have irreversible consequences, please use with caution.
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
TD_ASSERT(TD_OK == td_user_delete("account_id", "distinct_id", ta));
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 3. Other Features
|
|
413
|
+
|
|
414
|
+
#### 3.1 BatchConsumer
|
|
415
|
+
|
|
416
|
+
::: warning Note
|
|
417
|
+
|
|
418
|
+
When data volume is large or network is abnormal, there is a risk of data loss. Not recommended for production environments.
|
|
419
|
+
|
|
420
|
+
:::
|
|
421
|
+
|
|
422
|
+
Batch real-time data transmission to TE server without requiring transmission tools. Cache buffer size can be set, default 20, meaning maximum cached data count is 20 (20 is batch value for each upload, configurable).
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
// First: Modify CMakeList.txt file, package TDBatchConsumer type library file
|
|
426
|
+
|
|
427
|
+
struct TDAnalytics* ta = NULL;
|
|
428
|
+
struct TDConsumer* consumer = NULL;
|
|
429
|
+
|
|
430
|
+
// Generate config
|
|
431
|
+
TDConfig *config = td_init_config();
|
|
432
|
+
// Configure appid and url
|
|
433
|
+
char* appid = "APPID";
|
|
434
|
+
char* serverURL = "SERVER_URL";
|
|
435
|
+
TD_ASSERT(TD_OK == td_add_string("push_url", serverURL, strlen(serverURL), config));
|
|
436
|
+
TD_ASSERT(TD_OK == td_add_string("appid", appid, strlen(appid), config));
|
|
437
|
+
|
|
438
|
+
// Generate SDK instance
|
|
439
|
+
if (TD_OK != td_init_consumer(&consumer, config)) {
|
|
440
|
+
fprintf(stderr, "Failed to initialize the consumer.");
|
|
441
|
+
return 1;
|
|
442
|
+
}
|
|
443
|
+
td_free_properties(config);
|
|
444
|
+
if (TD_OK != td_init(consumer, &ta)) {
|
|
445
|
+
fprintf(stderr, "Failed to initialize the SDK.");
|
|
446
|
+
return 1;
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Parameter Description:
|
|
451
|
+
|
|
452
|
+
- `APPID`: Your project's APPID, can be obtained from TE backend project management page
|
|
453
|
+
- `SERVER_URL`: Data upload URL
|
|
454
|
+
- If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
455
|
+
- If you use private deployment version, please bind domain for data collection address and configure HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
# Real-time Debugging
|
|
460
|
+
|
|
461
|
+
::: warning Note
|
|
462
|
+
|
|
463
|
+
SDK Debug mode is only for integration debugging. Do not use in production environment.
|
|
464
|
+
|
|
465
|
+
:::
|
|
466
|
+
|
|
467
|
+
### Enable Log Printing
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
td_enableLog(1);
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Use DebugConsumer
|
|
474
|
+
|
|
475
|
+
During SDK integration, you can use TE's Debug feature for real-time debugging. Enabling Debug feature requires two steps:
|
|
476
|
+
|
|
477
|
+
1. Use DebugConsumer
|
|
478
|
+
|
|
479
|
+
- Package .a file including debugConsumer functionality, `CMakeLists.txt` modification example:
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
# Debug Library: debug consumer
|
|
483
|
+
if(WIN32)
|
|
484
|
+
add_compile_definitions(USE_WIN)
|
|
485
|
+
set(CMAKE_C_FLAGS "-std=c99 -pedantic-errors -m64")
|
|
486
|
+
else()
|
|
487
|
+
add_compile_definitions(USE_POSIX)
|
|
488
|
+
set(CMAKE_C_FLAGS "-std=c99")
|
|
489
|
+
endif()
|
|
490
|
+
SET(TE_LIB_NAME thinkingDataDebug)
|
|
491
|
+
add_library(${TE_LIB_NAME} src/thinkingdata.c src/td_json.c src/td_list.c src/td_util.c src/td_debug_consumer.c src/td_http_client.c)
|
|
492
|
+
if(WIN32)
|
|
493
|
+
add_compile_definitions(BUILDING_LIBCURL)
|
|
494
|
+
include_directories(thirdparty/pcre/include thirdparty/curl/include)
|
|
495
|
+
link_directories(thirdparty/pcre/lib thirdparty/curl/lib)
|
|
496
|
+
target_link_libraries(${TE_LIB_NAME} pcre_x64 libcurl)
|
|
497
|
+
else()
|
|
498
|
+
target_link_libraries(${TE_LIB_NAME} curl)
|
|
499
|
+
endif()
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
- Here is sample code using DebugConsumer:
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
struct TDAnalytics* ta = NULL;
|
|
506
|
+
struct TDConsumer* consumer = NULL;
|
|
507
|
+
/*
|
|
508
|
+
* DebugConsumer: Data is reported one by one. When problems occur, users are notified via logs and exceptions. Not recommended for production environment.
|
|
509
|
+
*/
|
|
510
|
+
TDConfig *config = td_init_config();
|
|
511
|
+
// debug_mode, 0 means write to database, otherwise no write
|
|
512
|
+
TD_ASSERT(TD_OK == td_add_int("debug_mode", 0, config));
|
|
513
|
+
// TE backend test device ID: 123456789
|
|
514
|
+
TD_ASSERT(TD_OK == td_add_string("device_id", "123456789", strlen("123456789"), config));
|
|
515
|
+
// Configure appid and url
|
|
516
|
+
char* appid = "APPID";
|
|
517
|
+
char* serverURL = "SERVER_URL";
|
|
518
|
+
TD_ASSERT(TD_OK == td_add_string("push_url", serverURL, strlen(serverURL), config));
|
|
519
|
+
TD_ASSERT(TD_OK == td_add_string("appid", appid, strlen(appid), config));
|
|
520
|
+
|
|
521
|
+
// Generate SDK instance
|
|
522
|
+
if (TD_OK != td_init_consumer(&consumer, config)) {
|
|
523
|
+
fprintf(stderr, "Failed to initialize the consumer.");
|
|
524
|
+
return 1;
|
|
525
|
+
}
|
|
526
|
+
td_free_properties(config);
|
|
527
|
+
if (TD_OK != td_init(consumer, &ta)) {
|
|
528
|
+
fprintf(stderr, "Failed to initialize the SDK.");
|
|
529
|
+
return 1;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Generate custom properties
|
|
533
|
+
TDProperties *properties = td_init_properties();
|
|
534
|
+
// Add device ID property, device ID value is td_device_id
|
|
535
|
+
TD_ASSERT(TD_OK == td_add_string("#device_id", "td_device_id", strlen("td_device_id"), properties));
|
|
536
|
+
// Report event with custom properties, account_id and distinct_id must have at least one set
|
|
537
|
+
TD_ASSERT(TD_OK == td_track("account_id", "distinct_id", "test", properties, ta));
|
|
538
|
+
td_free_properties(properties);
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
2. Add Debug Device in TE Backend
|
|
542
|
+
To prevent Debug mode from going live in production environment, only specified devices can enable Debug mode. Debug mode can only be enabled when Debug mode is turned on in the client and the device ID is configured in TE backend's "Tracking Management" page under "Debug Data" section.
|
|
543
|
+
|
|
544
|
+
Debug mode may affect data collection quality and App stability. Only use for integration stage data verification, not for online environment.
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
548
|
+
# Preset Properties
|
|
549
|
+
|
|
550
|
+
The following preset properties are included in all events for C SDK.
|
|
551
|
+
|
|
552
|
+
**Property Name** | **Chinese Name** | **Property Type** | **Description**
|
|
553
|
+
|
|
554
|
+
#ip | IP Address | Text | User's IP address, needs to be set manually. TE will use this to obtain user's geographic location information.
|
|
555
|
+
|
|
556
|
+
#country | Country | Text | User's country, generated based on IP address.
|
|
557
|
+
|
|
558
|
+
#country_code | Country Code | Text | User's country code (ISO 3166-1 alpha-2, i.e., two uppercase English letters), generated based on IP address.
|
|
559
|
+
|
|
560
|
+
#province | Province | Text | User's province, generated based on IP address.
|
|
561
|
+
|
|
562
|
+
#city | City | Text | User's city, generated based on IP address.
|
|
563
|
+
|
|
564
|
+
#lib | SDK Type | Text | Type of SDK you integrated, such as Java, etc.
|
|
565
|
+
|
|
566
|
+
#lib_version | SDK Version | Text | Version of SDK you integrated.
|