@thinkingai/ae-cli 6.0.61 → 6.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/dist/{ai-monitor-NUKSJPLE.js → ai-monitor-X5GL44JT.js} +5 -5
- package/dist/ai-monitor.js +7 -7
- package/dist/{auth-MVAEBGBP.js → auth-SPQ46XQ3.js} +3 -3
- package/dist/{automation-6L6IAYRK.js → automation-7XC3VBZI.js} +85 -9
- package/dist/{capability-74N7AN5X.js → capability-JZP4KXZC.js} +3 -3
- package/dist/{chunk-SVNED423.js → chunk-2VKMHNUU.js} +4 -4
- package/dist/{chunk-JZY6WWAP.js → chunk-6HOM2FOJ.js} +10 -1
- package/dist/{chunk-COOMXFUG.js → chunk-AAN6KBUK.js} +2 -2
- package/dist/{chunk-H35VDOAE.js → chunk-E457FREE.js} +2 -2
- package/dist/{chunk-VLOGOM7N.js → chunk-ETQXIZFP.js} +2 -1
- package/dist/{chunk-XZDKAR4N.js → chunk-F36ORPI6.js} +3 -28
- package/dist/{chunk-7WBCSJL6.js → chunk-F7TCQPQX.js} +1 -1
- package/dist/{chunk-HRFYYEXR.js → chunk-FGGEF7MI.js} +2 -2
- package/dist/chunk-N2MAYIRU.js +32 -0
- package/dist/{chunk-RB26WNLM.js → chunk-PRCHMOWT.js} +1 -1
- package/dist/{chunk-LPKIMGIU.js → chunk-RYY5NJK3.js} +2 -2
- package/dist/{chunk-OTZ4JQDU.js → chunk-VR2D54AA.js} +1 -1
- package/dist/{chunk-THTROEGD.js → chunk-YIG3L4RC.js} +1 -1
- package/dist/{chunk-XPARQSYS.js → chunk-YJYC5PLL.js} +2 -3
- package/dist/{chunk-HIMOBNEY.js → chunk-ZVUXAHEV.js} +1 -1
- package/dist/{compat-check-W4XC27RG.js → compat-check-JD5D77ET.js} +1 -1
- package/dist/{config-264GB6C7.js → config-IIMRATTP.js} +3 -3
- package/dist/{context-SOQDFZIB.js → context-BXHIPIIX.js} +1 -1
- package/dist/{data-integration-UNJ7EPW2.js → data-integration-VRJQ3HVK.js} +2 -1
- package/dist/index.js +33 -31
- package/dist/{memory-ZLTTULZK.js → memory-B44LY27L.js} +3 -3
- package/dist/{metadata-EN2IWCDI.js → metadata-ZVPG2MIA.js} +5 -5
- package/dist/{model-NAKQWK4W.js → model-ANZBYVST.js} +1 -1
- package/dist/{personal-semantic-preference-UGN67KTN.js → personal-semantic-preference-YNCV4QG3.js} +4 -4
- package/dist/{project-semantic-5OP3YPZD.js → project-semantic-E7ZAQL5S.js} +4 -4
- package/dist/{sync-LDJQZRQH.js → sync-Y4OZRQAY.js} +3 -3
- package/dist/{te-agent-WNNAD4AJ.js → te-agent-RKAUTYJZ.js} +4 -4
- package/dist/{te-analysis-KIMH6AGU.js → te-analysis-7N5VC4JB.js} +5 -5
- package/dist/{te-community-P7NNBVCS.js → te-community-SIA2UHTS.js} +4 -4
- package/dist/{te-dataops-ZRKSG4R7.js → te-dataops-5MJQCODU.js} +2 -2
- package/dist/{te-engage-PVBVNRSU.js → te-engage-ZTLOMKO3.js} +68 -16
- package/dist/{te-kb-W7PRC7QN.js → te-kb-LDL3MF2Y.js} +44 -13
- package/dist/{te-system-F4ZU2HRQ.js → te-system-473I5O53.js} +1 -1
- package/dist/{te-team-5ONMRGKF.js → te-team-JOWHCMZA.js} +87 -6
- package/dist/{things-PFENSIF4.js → things-DOQ2L3O2.js} +4 -4
- package/dist/{update-EUZ4GNND.js → update-KUS6TCPB.js} +2 -2
- package/dist/{workspace-Z7L33OBQ.js → workspace-MJFPIV7C.js} +3 -3
- package/package.json +3 -3
- package/skills/ae-automation/SKILL.md +6 -2
- package/skills/ae-automation/references/cli.md +9 -3
- package/skills/ae-engage/SKILL.md +6 -1
- package/skills/ae-engage/references/common-metric.md +47 -1
- package/skills/ae-engage/references/flow-metric-update.md +1 -1
- package/skills/ae-engage/references/task-metric-update.md +1 -1
- package/skills/ae-kb/SKILL.md +8 -6
- package/skills/ae-kb/references/query-workflow.md +5 -1
- package/skills/ae-team/SKILL.md +7 -3
- package/skills/ae-team/references/copy-to-personal.md +7 -0
- package/skills/ae-team/references/promote.md +7 -0
- package/skills/ae-team/references/update.md +3 -3
- package/skills/ae-tracking-matrix/SKILL.md +0 -170
- package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
- package/skills/ae-tracking-matrix/i18n.yaml +0 -12
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
- package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
- package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
- package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
- package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
- package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
- package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
- package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
- package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
- package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
- package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
- package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
- package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
code: ruby_sdk_installation
|
|
3
|
-
name: "Ruby"
|
|
4
|
-
wikiToken: JQwMwwgRviGugBklAUJcBSSjnng
|
|
5
|
-
parentWikiToken: O3YxwgHGiiEnvYkHCcIcX51inkf
|
|
6
|
-
updateTime: 1745310924000
|
|
7
|
-
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=ruby_sdk_installation
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Ruby
|
|
11
|
-
|
|
12
|
-
This guide will introduce how to use Ruby SDK to integrate into your project.
|
|
13
|
-
|
|
14
|
-
**Latest Version**: v2.0.0
|
|
15
|
-
|
|
16
|
-
**Update Date**: 2023-10-08
|
|
17
|
-
|
|
18
|
-
**Download**: Source Code
|
|
19
|
-
|
|
20
|
-
::: warning Note
|
|
21
|
-
|
|
22
|
-
This document applies to v2.0.0 and later versions. For historical versions, please refer to Ruby SDK Integration Guide (V1).
|
|
23
|
-
|
|
24
|
-
:::
|
|
25
|
-
|
|
26
|
-
### 1. SDK Integration
|
|
27
|
-
|
|
28
|
-
1. Use `gem` command to integrate SDK package
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
# Get SDK
|
|
32
|
-
gem install thinkingdata-ruby
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2. Install LogBus
|
|
36
|
-
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.
|
|
37
|
-
|
|
38
|
-
### 2. Initialization
|
|
39
|
-
|
|
40
|
-
Here is sample code for SDK initialization:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
require 'thinkingdata-ruby'
|
|
44
|
-
|
|
45
|
-
consumer = ThinkingData::TDLoggerConsumer.new("LOG_DIRECTORY")
|
|
46
|
-
ta = ThinkingData::TDAnalytics.new(consumer)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
`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.
|
|
50
|
-
|
|
51
|
-
### 3. Common Features
|
|
52
|
-
|
|
53
|
-
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.
|
|
54
|
-
|
|
55
|
-
#### 3.1 Track Events
|
|
56
|
-
|
|
57
|
-
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:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
DEMO_ACCOUNT_ID = '123'
|
|
61
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
62
|
-
|
|
63
|
-
properties = {
|
|
64
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
65
|
-
prop_date: Time.now,
|
|
66
|
-
prop_double: 134.1,
|
|
67
|
-
prop_string: 'hello world',
|
|
68
|
-
prop_bool: true,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: properties)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
- Event name must be a string type, starting with a letter, containing numbers, letters, and underscores "\_", with maximum length of 50 characters.
|
|
75
|
-
- 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.
|
|
76
|
-
- Value is the property value, supporting strings, numbers, booleans, dates, objects, object arrays, and arrays.
|
|
77
|
-
|
|
78
|
-
**User property requirements are consistent with event property requirements**
|
|
79
|
-
|
|
80
|
-
#### 3.2 Set User Properties
|
|
81
|
-
|
|
82
|
-
For general user properties, you can call `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:
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
DEMO_ACCOUNT_ID = '123'
|
|
86
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
87
|
-
|
|
88
|
-
user_data = {
|
|
89
|
-
array: ["str1", 11, 22.22],
|
|
90
|
-
prop_date: Time.now,
|
|
91
|
-
prop_double: 134.12,
|
|
92
|
-
prop_string: 'hello',
|
|
93
|
-
prop_int: 666,
|
|
94
|
-
}
|
|
95
|
-
ta.user_set(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_data)
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### 3.3 Data Reporting
|
|
99
|
-
|
|
100
|
-
When using TDLoggerConsumer, SDK will write collected data to disk in real-time. No need to call `flush()` method.
|
|
101
|
-
|
|
102
|
-
#### 3.4 Close SDK
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
# Close and exit SDK
|
|
106
|
-
ta.close
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Close and exit the SDK. Please call this interface before shutting down the server to avoid data loss in the cache.
|
|
110
|
-
|
|
111
|
-
### 4. Best Practices
|
|
112
|
-
|
|
113
|
-
The following sample code includes all the above operations. We recommend using it as follows:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
ThinkingData::set_stringent(false)
|
|
117
|
-
ThinkingData::set_enable_log(false)
|
|
118
|
-
|
|
119
|
-
consumer = ThinkingData::TDLoggerConsumer.new( 'LOG_DIRECTORY', 'hourly')
|
|
120
|
-
ta = ThinkingData::TDAnalytics.new(consumer, my_error_handler, uuid: true)
|
|
121
|
-
|
|
122
|
-
DEMO_ACCOUNT_ID = '123'
|
|
123
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
124
|
-
|
|
125
|
-
properties = {
|
|
126
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
127
|
-
prop_date: Time.now,
|
|
128
|
-
prop_double: 134.1,
|
|
129
|
-
prop_string: 'hello world',
|
|
130
|
-
prop_bool: true,
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: properties)
|
|
134
|
-
|
|
135
|
-
user_data = {
|
|
136
|
-
array: ["str1", 11, 22.22],
|
|
137
|
-
prop_date: Time.now,
|
|
138
|
-
prop_double: 134.12,
|
|
139
|
-
prop_string: 'hello',
|
|
140
|
-
prop_int: 666,
|
|
141
|
-
}
|
|
142
|
-
ta.user_set(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_data)
|
|
143
|
-
|
|
144
|
-
user_append_data = {
|
|
145
|
-
array: %w[33 44]
|
|
146
|
-
}
|
|
147
|
-
ta.user_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_append_data)
|
|
148
|
-
|
|
149
|
-
user_uniq_append_data = {
|
|
150
|
-
array: %w[44 55]
|
|
151
|
-
}
|
|
152
|
-
ta.user_uniq_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_uniq_append_data)
|
|
153
|
-
|
|
154
|
-
user_set_once_data = {
|
|
155
|
-
prop_int_new: 888,
|
|
156
|
-
}
|
|
157
|
-
ta.user_set_once(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_set_once_data)
|
|
158
|
-
|
|
159
|
-
ta.user_add(distinct_id: DEMO_DISTINCT_ID, properties: {prop_int: 10, prop_double: 15.88})
|
|
160
|
-
|
|
161
|
-
ta.user_unset(distinct_id: DEMO_DISTINCT_ID, property: [:prop_string, :prop_int])
|
|
162
|
-
|
|
163
|
-
ta.user_del(distinct_id: DEMO_DISTINCT_ID)
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
# Advanced Guide
|
|
169
|
-
|
|
170
|
-
### 1. Track Events
|
|
171
|
-
|
|
172
|
-
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.
|
|
173
|
-
|
|
174
|
-
#### 1.1 Regular Events
|
|
175
|
-
|
|
176
|
-
You can call `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:
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
DEMO_ACCOUNT_ID = '123'
|
|
180
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
181
|
-
|
|
182
|
-
properties = {
|
|
183
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
184
|
-
prop_date: Time.now,
|
|
185
|
-
prop_double: 134.1,
|
|
186
|
-
prop_string: 'hello world',
|
|
187
|
-
prop_bool: true,
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: properties)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
#### 1.2 First-Time Events
|
|
194
|
-
|
|
195
|
-
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.
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
DEMO_ACCOUNT_ID = '123'
|
|
199
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
200
|
-
|
|
201
|
-
properties = {
|
|
202
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
203
|
-
prop_date: Time.now,
|
|
204
|
-
prop_double: 134.1,
|
|
205
|
-
prop_string: 'hello world',
|
|
206
|
-
prop_bool: true,
|
|
207
|
-
}
|
|
208
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, first_check_id:'first_id', properties: properties)
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Note: Since first-time verification is completed on the server side, first-time events will be delayed by 1 hour before entering the database.
|
|
212
|
-
|
|
213
|
-
#### 1.3 Updateable Events
|
|
214
|
-
|
|
215
|
-
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.
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
DEMO_ACCOUNT_ID = '123'
|
|
219
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
220
|
-
|
|
221
|
-
properties = {
|
|
222
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
223
|
-
prop_date: Time.now,
|
|
224
|
-
prop_double: 134.1,
|
|
225
|
-
prop_string: 'hello world',
|
|
226
|
-
prop_bool: true,
|
|
227
|
-
}
|
|
228
|
-
ta.track_update(event_name: 'update', event_id: 'id123', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties:properties)
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
#### 1.4 Overwriteable Events
|
|
232
|
-
|
|
233
|
-
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.
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
DEMO_ACCOUNT_ID = '123'
|
|
237
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
238
|
-
|
|
239
|
-
properties = {
|
|
240
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
241
|
-
prop_date: Time.now,
|
|
242
|
-
prop_double: 134.1,
|
|
243
|
-
prop_string: 'hello world',
|
|
244
|
-
prop_bool: true,
|
|
245
|
-
}
|
|
246
|
-
ta.track_overwrite(event_name: 'update', event_id: 'id123', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties:properties)
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### 2. User Properties
|
|
250
|
-
|
|
251
|
-
TE platform supports the following user property setting APIs: `user_set`, `user_set_once`, `user_add`, `user_unset`, `user_del`, `user_append`, `user_uniq_append`.
|
|
252
|
-
|
|
253
|
-
#### 2.1 user_set
|
|
254
|
-
|
|
255
|
-
For general user properties, you can call `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:
|
|
256
|
-
|
|
257
|
-
```
|
|
258
|
-
DEMO_ACCOUNT_ID = '123'
|
|
259
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
260
|
-
|
|
261
|
-
user_data = {
|
|
262
|
-
array: ["str1", 11, 22.22],
|
|
263
|
-
prop_double: 134.12,
|
|
264
|
-
prop_string: 'hello',
|
|
265
|
-
prop_int: 666,
|
|
266
|
-
}
|
|
267
|
-
ta.user_set(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_data)
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
#### 2.2 user_set_once
|
|
271
|
-
|
|
272
|
-
If you want to set a user property only once, you can call `user_set_once`. When the property already has a value, this information will be ignored. Here is another example of setting a username:
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
user_set_once_data = {
|
|
276
|
-
prop_int_new: 888,
|
|
277
|
-
}
|
|
278
|
-
ta.user_set_once(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_set_once_data)
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
#### 2.3 user_add
|
|
282
|
-
|
|
283
|
-
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:
|
|
284
|
-
|
|
285
|
-
```
|
|
286
|
-
# Accumulate numeric type properties
|
|
287
|
-
ta.user_add(distinct_id: DEMO_DISTINCT_ID, properties: {prop_int: 10, prop_double: 15.88})
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
The property key must be a string, and Value only allows numeric values.
|
|
291
|
-
|
|
292
|
-
#### 2.4 user_append
|
|
293
|
-
|
|
294
|
-
You can call `user_append` to append array-type user properties.
|
|
295
|
-
|
|
296
|
-
```
|
|
297
|
-
user_append_data = {
|
|
298
|
-
array: %w[33 44]
|
|
299
|
-
}
|
|
300
|
-
ta.user_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_append_data)
|
|
301
|
-
|
|
302
|
-
user_append_data_new = {
|
|
303
|
-
array: %w[44 55]
|
|
304
|
-
}
|
|
305
|
-
ta.user_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_append_data_new)
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
#### 2.5 user_uniq_append
|
|
309
|
-
|
|
310
|
-
You can call `user_uniq_append` to append array-type user properties. The `user_uniq_append` interface will deduplicate appended user properties, while `user_append` interface does not deduplicate, allowing duplicate user properties.
|
|
311
|
-
|
|
312
|
-
```
|
|
313
|
-
user_append_data = {
|
|
314
|
-
array: %w[33 44]
|
|
315
|
-
}
|
|
316
|
-
ta.user_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_append_data)
|
|
317
|
-
|
|
318
|
-
user_uniq_append_data = {
|
|
319
|
-
array: %w[44 55]
|
|
320
|
-
}
|
|
321
|
-
ta.user_uniq_append(distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: user_uniq_append_data)
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
#### 2.6 user_unset
|
|
325
|
-
|
|
326
|
-
When you want to clear user property values, you can call `user_unset` to clear specified properties. If the property has not been created in the cluster, `user_unset` will not create the property.
|
|
327
|
-
|
|
328
|
-
```
|
|
329
|
-
ta.user_unset(distinct_id: DEMO_DISTINCT_ID, property: [:prop_string, :prop_int])
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
user_unset: The parameter is the Key value of the property to be cleared.
|
|
333
|
-
|
|
334
|
-
#### 2.7 user_del
|
|
335
|
-
|
|
336
|
-
If you want to delete a user, you can call `user_del` 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.
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
ta.user_del(distinct_id: DEMO_DISTINCT_ID)
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
### 3. Other Features
|
|
343
|
-
|
|
344
|
-
#### 3.1 TDBatchConsumer
|
|
345
|
-
|
|
346
|
-
::: warning Note
|
|
347
|
-
|
|
348
|
-
When data volume is large or network is abnormal, there is a risk of data loss. Not recommended for production environments.
|
|
349
|
-
|
|
350
|
-
:::
|
|
351
|
-
|
|
352
|
-
Batch real-time data transmission to TE server without requiring transmission tools.
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
consumer = ThinkingData::TDBatchConsumer.new('SERVER_URL', 'APPID', 30)
|
|
356
|
-
ta = ThinkingData::TDAnalytics.new(consumer)
|
|
357
|
-
|
|
358
|
-
DEMO_ACCOUNT_ID = '123'
|
|
359
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
360
|
-
|
|
361
|
-
properties = {
|
|
362
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
363
|
-
prop_date: Time.now,
|
|
364
|
-
prop_double: 134.1,
|
|
365
|
-
prop_string: 'hello world',
|
|
366
|
-
prop_bool: true,
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: properties)
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
Parameter Description:
|
|
373
|
-
|
|
374
|
-
- `APPID`: Your project's APP ID, can be obtained from TE backend project management page
|
|
375
|
-
- `SERVER_URL`: Data upload URL
|
|
376
|
-
- If you are connecting to cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
377
|
-
- If you use private deployment version, please bind domain for data collection address and configure HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
# Real-time Debugging
|
|
382
|
-
|
|
383
|
-
::: warning Note
|
|
384
|
-
|
|
385
|
-
SDK Debug mode is only for integration debugging. Do not use in production environment.
|
|
386
|
-
|
|
387
|
-
:::
|
|
388
|
-
|
|
389
|
-
### Enable Log Printing
|
|
390
|
-
|
|
391
|
-
```
|
|
392
|
-
ThinkingData::set_enable_log(true)
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Debug Mode Data Validation
|
|
396
|
-
|
|
397
|
-
During SDK integration, you can use TE's Debug feature for real-time debugging. Enabling Debug feature requires two steps:
|
|
398
|
-
|
|
399
|
-
1. Use TDDebugConsumer
|
|
400
|
-
Here is sample code using TDDebugConsumer:
|
|
401
|
-
|
|
402
|
-
```
|
|
403
|
-
consumer = ThinkingData::TDDebugConsumer.new('SERVER_URL', 'APPID', device_id: "123456789")
|
|
404
|
-
te = ThinkingData::TDAnalytics.new(consumer)
|
|
405
|
-
|
|
406
|
-
DEMO_ACCOUNT_ID = '123'
|
|
407
|
-
DEMO_DISTINCT_ID = 'aaa'
|
|
408
|
-
|
|
409
|
-
properties = {
|
|
410
|
-
array: ["str1", "11", Time.now, "2020-02-11 17:02:52.415"],
|
|
411
|
-
prop_date: Time.now,
|
|
412
|
-
prop_double: 134.1,
|
|
413
|
-
prop_string: 'hello world',
|
|
414
|
-
prop_bool: true,
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
ta.track(event_name: 'test_event', distinct_id: DEMO_DISTINCT_ID, account_id: DEMO_ACCOUNT_ID, properties: properties)
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
Debug mode may affect data collection quality and App stability. Only use for integration stage data verification, not for online environment.
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
# Preset Properties
|
|
425
|
-
|
|
426
|
-
The following preset properties are included in all events for Ruby SDK.
|
|
427
|
-
|
|
428
|
-
**Property Name** | **Chinese Name** | **Property Type** | **Description**
|
|
429
|
-
|
|
430
|
-
#ip | IP Address | Text | User's IP address, needs to be set manually. TE will use this to obtain user's geographic location information.
|
|
431
|
-
|
|
432
|
-
#country | Country | Text | User's country, generated based on IP address.
|
|
433
|
-
|
|
434
|
-
#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.
|
|
435
|
-
|
|
436
|
-
#province | Province | Text | User's province, generated based on IP address.
|
|
437
|
-
|
|
438
|
-
#city | City | Text | User's city, generated based on IP address.
|
|
439
|
-
|
|
440
|
-
#lib | SDK Type | Text | Type of SDK you integrated, such as Java, etc.
|
|
441
|
-
|
|
442
|
-
#lib_version | SDK Version | Text | Version of SDK you integrated.
|