@thinkingai/ae-cli 6.1.38 → 6.1.40
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-BWEQIKA3.js → chunk-RW6Z2NN3.js} +5 -5
- package/dist/{chunk-DULCIC67.js → chunk-SQEK6S4X.js} +2 -3
- package/dist/{chunk-VPLRZSMY.js → chunk-STHIGWWC.js} +10 -1
- 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 +35 -33
- 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-NJHSEKGW.js} +8 -6
- 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-HIXOSNJ6.js} +89 -9
- 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-onboarding/SKILL.md +2 -2
- package/skills/ae-onboarding/references/demo-operations.md +3 -2
- package/skills/ae-onboarding/references/onboarding_experiment_launch.md +4 -2
- 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,409 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
code: erlang_sdk_installation
|
|
3
|
-
name: "Erlang"
|
|
4
|
-
wikiToken: FT65wwPGgiXLEpkeW4IcZeEHnCd
|
|
5
|
-
parentWikiToken: O3YxwgHGiiEnvYkHCcIcX51inkf
|
|
6
|
-
updateTime: 1745310923000
|
|
7
|
-
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=erlang_sdk_installation
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Erlang
|
|
11
|
-
|
|
12
|
-
This guide will introduce how to use Erlang SDK to integrate into your project.
|
|
13
|
-
|
|
14
|
-
::: tip Note
|
|
15
|
-
|
|
16
|
-
Before integration, please read the Pre-Integration Guide first.
|
|
17
|
-
|
|
18
|
-
:::
|
|
19
|
-
|
|
20
|
-
**Latest Version**: v2.0.0
|
|
21
|
-
|
|
22
|
-
**Update Date**: 2023-10-08
|
|
23
|
-
|
|
24
|
-
**Download**: Source Code
|
|
25
|
-
|
|
26
|
-
::: warning Note
|
|
27
|
-
|
|
28
|
-
This document applies to v2.0.0 and later versions. For historical versions, please refer to Erlang SDK Integration Guide (V1).
|
|
29
|
-
|
|
30
|
-
:::
|
|
31
|
-
|
|
32
|
-
### 1. SDK Integration
|
|
33
|
-
|
|
34
|
-
1. Your project needs to have rebar3 environment installed.
|
|
35
|
-
2. Modify your `rebar.config` file to add reference to thinkingdata_analytics SDK.
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
{erl_opts, [debug_info,
|
|
39
|
-
%% Required parameter for using lager library
|
|
40
|
-
{parse_transform, lager_transform},
|
|
41
|
-
%% Declare extended sink here, if multiple sinks, write: [ta_logger, ta_logger_xxxx]
|
|
42
|
-
{lager_extra_sinks, [ta_logger]}
|
|
43
|
-
]}.
|
|
44
|
-
|
|
45
|
-
{deps, [
|
|
46
|
-
%% Add ThinkingData SDK
|
|
47
|
-
{thinkingdata_analytics, {git, "https://github.com/ThinkingDataAnalytics/erlang-sdk.git", {tag, "v2.0.0"}}}
|
|
48
|
-
]}.
|
|
49
|
-
|
|
50
|
-
{shell, [
|
|
51
|
-
%% Enable configuration file
|
|
52
|
-
{config, "config/example_sys.config"},
|
|
53
|
-
{apps, [app_name]}
|
|
54
|
-
]}.
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Note: There is an example file `example_sys.config` in the SDK directory that you can refer to for configuration.
|
|
58
|
-
|
|
59
|
-
3. Run command:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
rebar3 compile
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
4. Modify your project's configuration file (e.g., example_sys.config). Add lager library configuration in your configuration file, mainly add the sink used by ThinkingData SDK: `ta_logger_lager_event`. If you need to use multiple instances writing to different log files, you need to add other sinks.
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
[
|
|
69
|
-
%% lager log library configuration
|
|
70
|
-
{lager, [
|
|
71
|
-
{colored, true},
|
|
72
|
-
{log_root, "./log"}, %% Path for storing logs generated during system operation
|
|
73
|
-
%% Add a sink used by ThinkingData SDK here, name is fixed: ta_logger_lager_event
|
|
74
|
-
{extra_sinks,
|
|
75
|
-
[
|
|
76
|
-
{ta_logger_lager_event,
|
|
77
|
-
[{handlers, [
|
|
78
|
-
{lager_file_backend, [
|
|
79
|
-
{file, "LOG_DIRECTORY"}, %% Configure file path and name for data collection
|
|
80
|
-
{level, info},
|
|
81
|
-
{formatter, lager_default_formatter},
|
|
82
|
-
{formatter_config, [message, "\n"]},
|
|
83
|
-
{size, 10485760}, %% Single file rotation size 10Mb
|
|
84
|
-
{rotator, td_lager_rotator} %% Custom log rotation
|
|
85
|
-
]}]},
|
|
86
|
-
{async_threshold, 500},
|
|
87
|
-
{async_threshold_window, 50}
|
|
88
|
-
]
|
|
89
|
-
}]
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
].
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
`LOG_DIRECTORY` is the local folder address for writing. You just need to set LogBus's monitoring folder address to this address to use LogBus for data monitoring and uploading.
|
|
97
|
-
|
|
98
|
-
5. Configure startup parameters in your app project configuration file. Add necessary startup items in `xxxx.app.src` file.
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
{application, app_name,
|
|
102
|
-
[{description, "An OTP application"},
|
|
103
|
-
{vsn, "0.1.0"},
|
|
104
|
-
{registered, []},
|
|
105
|
-
{mod, {app_name_app, []}},
|
|
106
|
-
{applications,
|
|
107
|
-
[kernel,
|
|
108
|
-
stdlib,
|
|
109
|
-
jsone, %% Add startup item here
|
|
110
|
-
lager %% Add startup item here
|
|
111
|
-
]},
|
|
112
|
-
{env,[]},
|
|
113
|
-
{modules, []},
|
|
114
|
-
|
|
115
|
-
{licenses, ["Apache-2.0"]},
|
|
116
|
-
{links, []}
|
|
117
|
-
]}.
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
6. Use SDK:
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
%% A lager sink is provided by default: 'ta_logger'. You could add your own sink
|
|
124
|
-
Consumer = td_log_consumer:init_with_logger(fun(E) -> ta_logger:info(E) end),
|
|
125
|
-
%% init SDK with consumer
|
|
126
|
-
TE_SDK = td_analytics:init_with_consumer(Consumer),
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Windows Platform Note: You need to open command line terminal with **administrator privileges** to run the project, otherwise data writing errors will occur.
|
|
130
|
-
|
|
131
|
-
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.
|
|
132
|
-
|
|
133
|
-
### 2. Initialization
|
|
134
|
-
|
|
135
|
-
Here is sample code for SDK initialization:
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
%% A lager sink is provided by default: 'ta_logger'. You could add your own sink
|
|
139
|
-
Consumer = td_log_consumer:init_with_logger(fun(E) -> ta_logger:info(E) end),
|
|
140
|
-
%% init SDK with consumer
|
|
141
|
-
TE_SDK = td_analytics:init_with_consumer(Consumer),
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 3. Common Features
|
|
145
|
-
|
|
146
|
-
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.
|
|
147
|
-
|
|
148
|
-
#### 3.1 Track Events
|
|
149
|
-
|
|
150
|
-
You can call `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:
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
%% Note: account_id and distinct_id must have at least one set
|
|
154
|
-
%% Set user IP address, TE system will parse user geographic location based on IP, if not set, default not reported
|
|
155
|
-
%% Set event occurrence time, if not set, default uses current time. Note: #time type must be timestamp() type
|
|
156
|
-
|
|
157
|
-
%% Report event
|
|
158
|
-
td_analytics:track_instance(TE_SDK, "account_id_Erlang", "distinct_logbus", "ViewProduct", #{"key_1" => "🚓🦽🦼🚲🚜🚜🦽", "key_2" => 2.2, "key_array" => ["🚌", "🏍", "😚😊"]}),
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
- Event name must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters.
|
|
162
|
-
- 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.
|
|
163
|
-
- Value is the property value, supporting strings, numbers, booleans, dates, objects, object arrays, and arrays.
|
|
164
|
-
|
|
165
|
-
**User property requirements are consistent with event property requirements**
|
|
166
|
-
|
|
167
|
-
#### 3.2 Set User Properties
|
|
168
|
-
|
|
169
|
-
For general user properties, you can call `user_set_instance` 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:
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
%% user properties
|
|
173
|
-
td_analytics:user_set_instance(TE_SDK, "account_id_Erlang", "distinct_id", #{"id" => 12, "key_1" => [1,1,1,1], "key_2" => ["a", "b"], "key_3" => ["chinese", "text"], "key_4" => ["chinese", "list"], "key_5" => "chinese_string", "amount" => 7.123}),
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
#### 3.3 Data Reporting
|
|
177
|
-
|
|
178
|
-
When using `td_analytics:consumer_type_log()`, SDK will write collected data to disk in real-time. No need to call `flush()` method.
|
|
179
|
-
|
|
180
|
-
#### 3.4 Close SDK
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
%% Call when closing SDK
|
|
184
|
-
td_analytics:close_instance(TE_SDK),
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Close and exit the SDK. Please call this interface before shutting down the server to avoid data loss in the cache.
|
|
188
|
-
|
|
189
|
-
### 4. Best Practices
|
|
190
|
-
|
|
191
|
-
The following sample code includes all the above operations. We recommend using it as follows:
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
%% A lager sink is provided by default: 'ta_logger'. You could add your own sink
|
|
195
|
-
Consumer = td_log_consumer:init_with_logger(fun(E) -> ta_logger:info(E) end),
|
|
196
|
-
%% init SDK with consumer
|
|
197
|
-
TE_SDK = td_analytics:init_with_consumer(Consumer),
|
|
198
|
-
|
|
199
|
-
%% ordinary event
|
|
200
|
-
td_analytics:track_instance(TE_SDK, "account_id_Erlang", "distinct_logbus", "ViewProduct", #{"key_1" => "🚓🦽🦼🚲🚜🚜🦽", "key_2" => 2.2, "key_array" => ["🚌", "🏍", "😚😊"]}),
|
|
201
|
-
|
|
202
|
-
td_analytics:close_instance(TE_SDK),
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
# Advanced Guide
|
|
208
|
-
|
|
209
|
-
### 1. Track Events
|
|
210
|
-
|
|
211
|
-
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.
|
|
212
|
-
|
|
213
|
-
#### 1.1 Regular Events
|
|
214
|
-
|
|
215
|
-
You can call `track_instance` 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:
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
%% Note: account_id and distinct_id must have at least one set
|
|
219
|
-
%% Set user IP address, TE system will parse user geographic location based on IP, if not set, default not reported
|
|
220
|
-
%% Set event occurrence time, if not set, default uses current time. Note: #time type must be timestamp() type
|
|
221
|
-
|
|
222
|
-
%% Report event
|
|
223
|
-
td_analytics:track_instance(TE_SDK, "account_id_Erlang", "distinct_logbus", "ViewProduct", #{"key_1" => "🚓🦽🦼🚲🚜🚜🦽", "key_2" => 2.2, "key_array" => ["🚌", "🏍", "😚😊"]}),
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
#### 1.2 First-Time Events
|
|
227
|
-
|
|
228
|
-
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.
|
|
229
|
-
|
|
230
|
-
```
|
|
231
|
-
FirstCheckId = "first_check_id",
|
|
232
|
-
%% First-time event
|
|
233
|
-
td_analytics:track_first_instance(TE_SDK, "account_id_Erlang", "distinct_id", "first_login", FirstCheckId, #{"key1" => "value1", "key2" => "value2"}),
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
Note: Since first-time verification is completed on the server side, first-time events will be delayed by 1 hour before entering the database.
|
|
237
|
-
|
|
238
|
-
#### 1.3 Updateable Events
|
|
239
|
-
|
|
240
|
-
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.
|
|
241
|
-
|
|
242
|
-
```
|
|
243
|
-
EventName = "event_name",
|
|
244
|
-
EventId = "event_id",
|
|
245
|
-
%% After reporting, event property status is 3, price is 100
|
|
246
|
-
td_analytics:track_update_instance(TE_SDK, "account_id_Erlang", "distinct_id", EventName, EventId, #{"price" => 100, "status" => 3}),
|
|
247
|
-
|
|
248
|
-
%% After reporting, event property status is 5, price is 100 unchanged
|
|
249
|
-
td_analytics:track_update_instance(TE_SDK, "account_id_Erlang", "distinct_id", EventName, EventId, #{"status" => 5}),
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
#### 1.4 Overwriteable Events
|
|
253
|
-
|
|
254
|
-
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.
|
|
255
|
-
|
|
256
|
-
```
|
|
257
|
-
EventName = "overWrite_event",
|
|
258
|
-
EventId = "event_id",
|
|
259
|
-
%% After reporting, event property price is 100, status is 5
|
|
260
|
-
td_analytics:track_overwrite_instance(TE_SDK, "account_id_Erlang", "distinct_id", EventName, EventId, #{"price" => 100, "status" => 5}),
|
|
261
|
-
|
|
262
|
-
%% After reporting, event property price is 20, status property is deleted
|
|
263
|
-
td_analytics:track_overwrite_instance(TE_SDK, "account_id_Erlang", "distinct_id", EventName, EventId, #{"price" => 20}),
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### 2. User Properties
|
|
267
|
-
|
|
268
|
-
TE platform supports the following user property setting APIs: `user_set_instance`, `user_set_once_instance`, `user_add_instance`, `user_unset_instance`, `user_del_instance`, `user_append_instance`, `user_unique_append_instance`.
|
|
269
|
-
|
|
270
|
-
#### 2.1 user_set_instance
|
|
271
|
-
|
|
272
|
-
For general user properties, you can call `user_set_instance` 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:
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
%% "name" is "A"
|
|
276
|
-
td_analytics:user_set_instance(TE_SDK, "account_id", "distinct_id", #{"name" => "A", "abc" => ["a", "b", "c"]}),
|
|
277
|
-
%% "name" is "B"
|
|
278
|
-
td_analytics:user_set_instance(TE_SDK, "account_id", "distinct_id", #{"name" => "B", "abc" => ["a", "b", "c"]}),
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
#### 2.2 user_set_once_instance
|
|
282
|
-
|
|
283
|
-
If you want to set a user property only once, you can call `user_set_once_instance`. When the property already has a value, this information will be ignored. Here is another example of setting a username:
|
|
284
|
-
|
|
285
|
-
```
|
|
286
|
-
%% "name" is "A"
|
|
287
|
-
td_analytics:user_set_once_instance(TE_SDK, "account_id", "distinct_id", #{"name" => "A"}),
|
|
288
|
-
%% "name" is still "A"
|
|
289
|
-
td_analytics:user_set_once_instance(TE_SDK, "account_id", "distinct_id", #{"name" => "B"}),
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
#### 2.3 user_add_instance
|
|
293
|
-
|
|
294
|
-
When you want to upload numeric properties, you can call `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:
|
|
295
|
-
|
|
296
|
-
```
|
|
297
|
-
%% "amount" is 30
|
|
298
|
-
td_analytics:user_add_instance(TE_SDK, "account_id", "distinct_id", #{"amount" => 30}),
|
|
299
|
-
%% "amount" is 90
|
|
300
|
-
td_analytics:user_add_instance(TE_SDK, "account_id", "distinct_id", #{"amount" => 60}),
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
The property key must be a string, and Value only allows numeric values.
|
|
304
|
-
|
|
305
|
-
#### 2.4 user_append_instance
|
|
306
|
-
|
|
307
|
-
You can call `user_append_instance` to append array-type user properties.
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
%% "array" is ["arr1", "arr3"]
|
|
311
|
-
td_analytics:user_append_instance(TE_SDK, "account_id", "distinct_id", #{"array" => ["arr1", "arr3"]}),
|
|
312
|
-
%% "array" is ["arr1", "arr3", "arr2", "arr3"]
|
|
313
|
-
td_analytics:user_append_instance(TE_SDK, "account_id", "distinct_id", #{"array" => ["arr2", "arr3"]}),
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
#### 2.5 user_unique_append_instance
|
|
317
|
-
|
|
318
|
-
You can call `user_unique_append_instance` to append array-type user properties. The `user_unique_append_instance` interface will deduplicate appended user properties, while `user_append_instance` interface does not deduplicate, allowing duplicate user properties.
|
|
319
|
-
|
|
320
|
-
```
|
|
321
|
-
%% "array" is ["arr1", "arr3"]
|
|
322
|
-
td_analytics:user_unique_append_instance(TE_SDK, "account_id", "distinct_id", #{"array" => ["arr1", "arr3"]}),
|
|
323
|
-
%% "array" is ["arr1", "arr3", "arr2"]
|
|
324
|
-
td_analytics:user_unique_append_instance(TE_SDK, "account_id", "distinct_id", #{"array" => ["arr2", "arr3"]}),
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
#### 2.6 user_unset_instance
|
|
328
|
-
|
|
329
|
-
When you want to clear user property values, you can call `user_unset_instance` to clear specified properties. If the property has not been created in the cluster, `user_unset_instance` will not create the property.
|
|
330
|
-
|
|
331
|
-
```
|
|
332
|
-
td_analytics:user_unset_instance(TE_SDK, "account_id", "distinct_id", ["age", "abc"]),
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
user_unset_instance: The parameter is the Key value of the property to be cleared.
|
|
336
|
-
|
|
337
|
-
#### 2.7 user_del_instance
|
|
338
|
-
|
|
339
|
-
If you want to delete a user, you can call `user_del_instance` 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.
|
|
340
|
-
|
|
341
|
-
```
|
|
342
|
-
td_analytics:user_del_instance(TE_SDK, "account_id", "distinct_id"),
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
---
|
|
346
|
-
|
|
347
|
-
# Real-time Debugging
|
|
348
|
-
|
|
349
|
-
::: warning Note
|
|
350
|
-
|
|
351
|
-
SDK Debug mode is only for integration debugging. Do not use in production environment.
|
|
352
|
-
|
|
353
|
-
:::
|
|
354
|
-
|
|
355
|
-
During SDK integration, you can use TE's Debug feature for real-time debugging. Enabling Debug feature requires two steps:
|
|
356
|
-
|
|
357
|
-
1. Use DebugConsumer
|
|
358
|
-
Here is sample code using DebugConsumer:
|
|
359
|
-
|
|
360
|
-
```
|
|
361
|
-
%% Configure report address
|
|
362
|
-
ServerUrl = "server_url",
|
|
363
|
-
%% Configure app_id
|
|
364
|
-
AppID = "app_id",
|
|
365
|
-
%% Configure whether to write to database
|
|
366
|
-
IsWrite = true,
|
|
367
|
-
%% Configure device_id, used to view reported data in TE backend in real-time
|
|
368
|
-
DeviceId = "123456789",
|
|
369
|
-
|
|
370
|
-
%% init consumer
|
|
371
|
-
Consumer = td_debug_consumer:init_with_config(ServerUrl, AppID, IsWrite, DeviceId),
|
|
372
|
-
%% init SDK with consumer
|
|
373
|
-
TE_SDK = td_analytics:init_with_consumer(Consumer),
|
|
374
|
-
|
|
375
|
-
AccountId0 = "account_id_Erlang_0",
|
|
376
|
-
|
|
377
|
-
%% ordinary event
|
|
378
|
-
td_analytics:track_instance(TE_SDK, AccountId0, "distinct_logbus", "ViewProduct", #{"#key_1" => "🚓🦽🦼🚲🚜🚜🦽", "key_2" => 2.2, "key_array" => ["🚌", "🏍", "😚😊"]}),
|
|
379
|
-
|
|
380
|
-
%% Call when closing SDK. If closed and need to restart SDK, must re-execute initialization code above.
|
|
381
|
-
td_analytics:close_instance(TE_SDK).
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
2. Add Debug Device in TE Backend
|
|
385
|
-
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.
|
|
386
|
-
|
|
387
|
-
Debug mode may affect data collection quality and App stability. Only use for integration stage data verification, not for online environment.
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
# Preset Properties
|
|
392
|
-
|
|
393
|
-
The following preset properties are included in all events for Erlang SDK.
|
|
394
|
-
|
|
395
|
-
**Property Name** | **Chinese Name** | **Property Type** | **Description**
|
|
396
|
-
|
|
397
|
-
#ip | IP Address | Text | User's IP address, needs to be set manually. TE will use this to obtain user's geographic location information.
|
|
398
|
-
|
|
399
|
-
#country | Country | Text | User's country, generated based on IP address.
|
|
400
|
-
|
|
401
|
-
#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.
|
|
402
|
-
|
|
403
|
-
#province | Province | Text | User's province, generated based on IP address.
|
|
404
|
-
|
|
405
|
-
#city | City | Text | User's city, generated based on IP address.
|
|
406
|
-
|
|
407
|
-
#lib | SDK Type | Text | Type of SDK you integrated, such as Java, etc.
|
|
408
|
-
|
|
409
|
-
#lib_version | SDK Version | Text | Version of SDK you integrated.
|