@thinkingai/ae-cli 6.0.58 → 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-A5OO4VS4.js → auth-ATK2SLEV.js} +10 -9
- package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
- package/dist/{capability-SKI4GHF4.js → capability-6KTSOI7L.js} +31 -35
- package/dist/{chunk-UYJMEHAF.js → chunk-2ETRY2CU.js} +15 -15
- package/dist/{chunk-QWSA3EOD.js → chunk-5E7MTTFN.js} +2 -2
- package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
- 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-HQCY3QCA.js → chunk-BEYLCUZX.js} +17 -12
- package/dist/chunk-CF6JTT2U.js +64 -0
- package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
- package/dist/{chunk-K2Z7QHDR.js → chunk-HSZAIPUX.js} +47 -12
- package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
- package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
- package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
- package/dist/{chunk-GBSACKFB.js → chunk-LOR4IA26.js} +564 -314
- package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
- package/dist/{chunk-EEARZNHE.js → chunk-SDKW6LYE.js} +88 -36
- package/dist/{chunk-WMDO53YK.js → chunk-VJUXKVRE.js} +1 -1
- package/dist/chunk-VRMGHQKE.js +556 -0
- package/dist/{compat-check-WFEKVLTH.js → compat-check-XD2U7PZ2.js} +2 -2
- package/dist/{config-U4I7X25P.js → config-U3GDWU6E.js} +25 -12
- package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
- package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
- package/dist/index.js +84 -579
- package/dist/{memory-SNFR5M23.js → memory-WEB27VI6.js} +7 -7
- package/dist/{metadata-6QM6EED5.js → metadata-7FYE4234.js} +7 -7
- package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
- package/dist/{personal-semantic-preference-7VXQPP2N.js → personal-semantic-preference-O6VXM74A.js} +6 -6
- package/dist/{project-semantic-PSEPYH2L.js → project-semantic-2GGFJWW6.js} +15 -13
- package/dist/{sync-22ACDK5Z.js → sync-ULBB7WO5.js} +4 -4
- package/dist/{te-agent-BJ36B4QI.js → te-agent-6RMF7LUV.js} +5 -5
- package/dist/{te-analysis-WQ6D6YG4.js → te-analysis-HSYC7GNV.js} +382 -193
- package/dist/{te-community-VRWMFGI6.js → te-community-FLKZGQKB.js} +9 -9
- package/dist/{te-dataops-YTLFTTW7.js → te-dataops-OQQGTCUA.js} +3 -3
- package/dist/{te-engage-V2QW7TIC.js → te-engage-RIEBHL5T.js} +9 -9
- package/dist/{te-kb-4AQLISDR.js → te-kb-4HG2FMHJ.js} +18 -9
- package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
- package/dist/{te-team-6ELNGBWT.js → te-team-5O4UVUWE.js} +5 -5
- package/dist/{things-HFWLGCUH.js → things-TSJ64GBT.js} +5 -5
- package/dist/{update-3CRVVHV5.js → update-Q5LURAWV.js} +3 -3
- package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
- 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 +5 -3
- package/skills/ae-kb/references/analysis-workflow.md +11 -2
- package/skills/ae-kb/references/query-workflow.md +3 -1
- package/skills/ae-kb/references/versions.md +1 -1
- 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,763 @@
|
|
|
1
|
+
---
|
|
2
|
+
code: rn_sdk_support
|
|
3
|
+
name: "React Native"
|
|
4
|
+
wikiToken: BNJxwC9F9i9i9MkJyYQcbUs2nAf
|
|
5
|
+
parentWikiToken: EaDPwgIujiz2GKk0rWxct8ZNn4g
|
|
6
|
+
updateTime: 1764555635000
|
|
7
|
+
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=rn_sdk_support
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# React Native
|
|
11
|
+
|
|
12
|
+
This guide will introduce how to use SDK features in React Native.
|
|
13
|
+
|
|
14
|
+
**Latest Version: **v3.2.0
|
|
15
|
+
|
|
16
|
+
**Update Time:** 2025-12-01
|
|
17
|
+
|
|
18
|
+
**Resource Download: **Source code
|
|
19
|
+
|
|
20
|
+
::: warning Note
|
|
21
|
+
|
|
22
|
+
This document applies to v3.0.0 and later versions. For historical versions, please refer to ReactNative Integration Guide (V2)
|
|
23
|
+
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
### 1. SDK Integration
|
|
27
|
+
|
|
28
|
+
react-native-thinking-data has two integration methods: automatic and manual. We recommend using automatic integration.
|
|
29
|
+
|
|
30
|
+
#### 1.1 Automatic Integration
|
|
31
|
+
|
|
32
|
+
Add react-native-thinking-data in package.json file
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"react-native-thinking-data": "3.2.0"
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. SDK Initialization
|
|
41
|
+
|
|
42
|
+
Here is the sample code for SDK initialization:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
import TDAnalytics,{TDAutoTrackEventType} from "react-native-thinking-data";
|
|
46
|
+
TDAnalytics.init({
|
|
47
|
+
appId: "xxx",
|
|
48
|
+
serverUrl: "https://xxx"
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Parameter Description:
|
|
53
|
+
|
|
54
|
+
- `appId`: Your project's APPID, which can be obtained from the TE backend project management page
|
|
55
|
+
- `serverUrl`: Data upload URL
|
|
56
|
+
- If you are using cloud service, enter: https://global-receiver-ta.thinkingdata.cn
|
|
57
|
+
- If you are using a private deployment version, please bind a domain to the data collection address and configure an HTTPS certificate: https://YOUR_DATA_COLLECTION_DOMAIN
|
|
58
|
+
<!-- unsupported block: 34 -->
|
|
59
|
+
|
|
60
|
+
Since Android 9.0+ restricts HTTP requests by default, please make sure to use HTTPS protocol
|
|
61
|
+
|
|
62
|
+
### 3. Common Features
|
|
63
|
+
|
|
64
|
+
Before using common features, we recommend you first understand the user identification rules. SDK will generate a random number as the visitor ID by default and persistently store it locally. Before user login, the visitor ID will be used as the identity identification ID. Note: Visitor ID will change when user reinstalls the App or changes device.
|
|
65
|
+
|
|
66
|
+
#### 3.1 Setting Account ID
|
|
67
|
+
|
|
68
|
+
When user logs in, you can call `login` to set the user's account ID. TE platform will use account ID as the identity identification ID, and the set account ID will be retained until `logout` is called. Multiple calls to `login` will overwrite the previous account ID.
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
TDAnalytics.login("TA")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`login` can be called multiple times. Each call will check whether the passed account ID is the same as the previously saved ID. If same, the call will be ignored. If different, it will overwrite the previous ID.
|
|
75
|
+
|
|
76
|
+
<!-- unsupported block: 34 -->
|
|
77
|
+
|
|
78
|
+
**This method will not upload a login event**
|
|
79
|
+
|
|
80
|
+
#### 3.2 Setting Common Event Properties
|
|
81
|
+
|
|
82
|
+
Common event properties refer to properties that every event will have. You can call `setSuperProperties` to set common event properties. We recommend you set common event properties before sending events. For some important properties, such as user's membership level, source channel, etc., these properties need to be set in every event. In this case, you can set these properties as common event properties.
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
TDAnalytics.setSuperProperties({
|
|
86
|
+
'channel': 'ta',//string
|
|
87
|
+
'age': 1,//number
|
|
88
|
+
'isSuccess': true,//boolean
|
|
89
|
+
'birthday': new Date(),//time
|
|
90
|
+
'object': {
|
|
91
|
+
'key': 'value'
|
|
92
|
+
},//object
|
|
93
|
+
'object_arr': [
|
|
94
|
+
{ 'key': 'value' }
|
|
95
|
+
],//object array
|
|
96
|
+
'arr': ['value']//array
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Common event properties will be saved to cache and don't need to be called every time the App starts. If `setSuperProperties` is called to upload a previously set common event property, it will overwrite the previous property.
|
|
101
|
+
|
|
102
|
+
- Key is the property name, string type, must start with a letter, contain numbers, letters and underscore "\_", maximum 50 characters, case insensitive, TE will convert to lowercase
|
|
103
|
+
- Value is the property value, supports string, number, boolean, time, object, object array, array
|
|
104
|
+
<!-- unsupported block: 34 -->
|
|
105
|
+
|
|
106
|
+
**Event property and user property requirements are consistent with common event properties**
|
|
107
|
+
|
|
108
|
+
#### 3.3 Enabling Auto-tracking
|
|
109
|
+
|
|
110
|
+
The following sample code enables auto-tracking for install, start, and end events. If you want to learn more about auto-tracking events, you can read the auto-tracking feature introduction
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_INSTALL)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### 3.4 Sending Events
|
|
117
|
+
|
|
118
|
+
You can call `track` to upload events. We recommend you set event properties and sending conditions according to your previously prepared tracking document. Here is an example of user purchasing a product:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
TDAnalytics.track({
|
|
122
|
+
eventName:"product_buy",
|
|
123
|
+
properties:{
|
|
124
|
+
'product_name':'product name'
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### 3.5 Setting User Properties
|
|
130
|
+
|
|
131
|
+
For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
//username is TA
|
|
135
|
+
TDAnalytics.userSet({ username:"TA"})
|
|
136
|
+
//username is TE
|
|
137
|
+
TDAnalytics.userSet({ username:"TE"})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 4. Best Practices
|
|
141
|
+
|
|
142
|
+
The following sample code includes all the above operations. We recommend using the following steps:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
import TDAnalytics,{TDAutoTrackEventType} from "react-native-thinking-data";
|
|
146
|
+
if (privacy policy authorized)
|
|
147
|
+
{
|
|
148
|
+
//SDK initialization
|
|
149
|
+
TDAnalytics.init({appId: "xxx",serverUrl: "https://xxx",});
|
|
150
|
+
//enable auto-tracking
|
|
151
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_INSTALL)
|
|
152
|
+
//if user is logged in, you can set user's account ID as unique identity
|
|
153
|
+
TDAnalytics.login("TA")
|
|
154
|
+
//after setting common event properties, every event will have common event properties
|
|
155
|
+
TDAnalytics.setSuperProperties({
|
|
156
|
+
'channel': 'ta',//string
|
|
157
|
+
'age': 1,//number
|
|
158
|
+
'isSuccess': true,//boolean
|
|
159
|
+
'birthday': new Date(),//time
|
|
160
|
+
'object': {'key': 'value'},//object
|
|
161
|
+
'object_arr': [{ 'key': 'value'}],//object array
|
|
162
|
+
'arr': ['value']//array
|
|
163
|
+
})
|
|
164
|
+
//send event
|
|
165
|
+
TDAnalytics.track({
|
|
166
|
+
eventName:"product_buy",
|
|
167
|
+
properties:{
|
|
168
|
+
'product_name':'product name'
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
//set user properties
|
|
172
|
+
TDAnalytics.userSet({ username:"TE"})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
# Advanced Guide
|
|
180
|
+
|
|
181
|
+
### 1. Setting User ID
|
|
182
|
+
|
|
183
|
+
SDK instance will use random UUID as the default visitor ID for each user by default. This ID will be used as the identity identification ID when user is not logged in. Note that visitor ID will change when user reinstalls App or changes device.
|
|
184
|
+
|
|
185
|
+
#### 1.1 Setting Visitor ID
|
|
186
|
+
|
|
187
|
+
::: tip Tip
|
|
188
|
+
|
|
189
|
+
Generally, you don't need to customize visitor ID. Please make sure you understand the user identification rules before setting visitor ID.
|
|
190
|
+
|
|
191
|
+
If you need to replace visitor ID, you should call it immediately after SDK initialization is completed. Do not call it multiple times to avoid generating useless accounts.
|
|
192
|
+
|
|
193
|
+
:::
|
|
194
|
+
|
|
195
|
+
If your App has its own visitor ID management system for each user, you can call `setDistinctId` to set visitor ID:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
// Set visitor ID to Thinker
|
|
199
|
+
TDAnalytics.setDistinctId("Thinker");
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
If you need to get the current visitor ID, you can call `getDistinctId`:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
//return visitor ID
|
|
206
|
+
async () => {
|
|
207
|
+
var distinct_id = await TDAnalytics.getDistinctId()
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### 1.2 Setting Account ID
|
|
212
|
+
|
|
213
|
+
When user logs in, you can call `login` to set the user's account ID. TE platform will use account ID as the identity identification ID, and the set account ID will be retained until `logout` is called. Multiple calls to `login` will overwrite the previous account ID.
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
// User's login unique identifier, this data corresponds to #account_id in the reported data, now #account_id is TA
|
|
217
|
+
TDAnalytics.login("TA");
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
<!-- unsupported block: 34 -->
|
|
221
|
+
|
|
222
|
+
**This method will not upload a login event**
|
|
223
|
+
|
|
224
|
+
#### 1.3 Clearing Account ID
|
|
225
|
+
|
|
226
|
+
After user logs out, you can call `logout` to clear account ID. Before the next `login` call, visitor ID will be used as the identity identification ID.
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
TDAnalytics.logout();
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
We recommend you call `logout` at explicit logout events, such as when user performs account deregistration action, rather than when closing App.
|
|
233
|
+
|
|
234
|
+
<!-- unsupported block: 34 -->
|
|
235
|
+
|
|
236
|
+
**This method will not upload a logout event**
|
|
237
|
+
|
|
238
|
+
### 2. Sending Events
|
|
239
|
+
|
|
240
|
+
#### 2.1 Regular Events
|
|
241
|
+
|
|
242
|
+
After SDK initialization is completed, you can perform data tracking and collect user behavior information. Regular events can generally meet business scenario requirements. You can also use first-time, updatable events according to your actual business scenarios.
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
//store purchase event
|
|
246
|
+
TDAnalytics.track({
|
|
247
|
+
eventName:"product_buy",
|
|
248
|
+
properties:{
|
|
249
|
+
'product_name':'product name'
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### 2.2 First-time Events
|
|
255
|
+
|
|
256
|
+
First-time events refer to events that will only be recorded once for a certain device or other dimension ID. For example, in some scenarios, you may want to record an activation event on a certain device, you can use first-time events to report data.
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
// Example: report device first-time event, assuming event name is DEVICE_FIRST
|
|
260
|
+
TDAnalytics.trackFirst({
|
|
261
|
+
eventName:'device_activation',
|
|
262
|
+
properties: {
|
|
263
|
+
KEY_NUMBER: 1.02,
|
|
264
|
+
KEY_STRING: "name",
|
|
265
|
+
KEY_LIST: [1, 2, 3],
|
|
266
|
+
KEY_BOOL: true,
|
|
267
|
+
KEY_DateTime: "2020-05-12 06:27:18.371"
|
|
268
|
+
},
|
|
269
|
+
eventId:'YOUR_ACCOUNT_ID'
|
|
270
|
+
})
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
If you want to use other dimensions other than device to judge whether it's first-time, you can customize first_check_id for first-time events:
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
// Set user ID as first_check_id for first-time event, to collect user first-time activation event
|
|
277
|
+
TDAnalytics.trackFirst({
|
|
278
|
+
eventName:'device_activation',
|
|
279
|
+
properties: {
|
|
280
|
+
KEY_NUMBER: 1.02,
|
|
281
|
+
KEY_STRING: "name",
|
|
282
|
+
KEY_LIST: [1, 2, 3],
|
|
283
|
+
KEY_BOOL: true,
|
|
284
|
+
KEY_DateTime: "2020-05-12 06:27:18.371"
|
|
285
|
+
},
|
|
286
|
+
eventId:'TA'
|
|
287
|
+
})
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
<!-- unsupported block: 34 -->
|
|
291
|
+
|
|
292
|
+
Note: Since the verification of whether it's first-time is completed on the server side, first-time events will be delayed by 1 hour before being stored in database.
|
|
293
|
+
|
|
294
|
+
#### 2.3 Updatable Events
|
|
295
|
+
|
|
296
|
+
You can use updatable events to implement the need to modify event data in specific scenarios. Updatable events need to specify an ID that identifies the event, and pass it when creating the updatable event object. TE backend will determine the data to be updated based on event name and event ID.
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
// Example: report updatable event, assuming event name is UPDATABLE_EVENT
|
|
300
|
+
// After reporting, event property status is 3, price is 100
|
|
301
|
+
TDAnalytics.trackUpdate({
|
|
302
|
+
eventName:'UPDATABLE_EVENT',
|
|
303
|
+
properties: { status: 3, price: 100},
|
|
304
|
+
eventId:'test_event_id'
|
|
305
|
+
})
|
|
306
|
+
// After reporting, event property status is updated to 5, price remains unchanged
|
|
307
|
+
TDAnalytics.trackUpdate({
|
|
308
|
+
eventName:'UPDATABLE_EVENT',
|
|
309
|
+
properties: { status: 5},
|
|
310
|
+
eventId:'test_event_id'
|
|
311
|
+
})
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### 2.4 Overwritable Events
|
|
315
|
+
|
|
316
|
+
Overwritable events are similar to updatable events, the difference is that overwritable events will completely overwrite previous data with the latest data. From the effect, it's equivalent to deleting the previous data and storing the latest data. TE backend will determine the data to be updated based on event name and event ID.
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
// Example: report overwritable event, assuming event name is OVERWRITE_EVENT
|
|
320
|
+
// After reporting, event property status is 3, price is 100
|
|
321
|
+
TDAnalytics.trackOverwrite({
|
|
322
|
+
eventName:'OVERWRITE_EVENT',
|
|
323
|
+
properties: { status: 3, price: 100},
|
|
324
|
+
eventId:'test_event_id'
|
|
325
|
+
})
|
|
326
|
+
// After reporting, event property status is updated to 5, price property is deleted
|
|
327
|
+
TDAnalytics.trackOverwrite({
|
|
328
|
+
eventName:'OVERWRITE_EVENT',
|
|
329
|
+
properties: { status: 5},
|
|
330
|
+
eventId:'test_event_id'
|
|
331
|
+
})
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### 2.5 Common Event Properties
|
|
335
|
+
|
|
336
|
+
Common event properties refer to properties that every event will upload. Based on property update frequency, common event properties are divided into `static common event properties` and `dynamic common event properties`. You can choose different common event property setting methods according to your specific business scenario requirements; we recommend you set common event properties before sending events. For the same event, when common event property, event custom property, preset property have the same Key, we will assign values according to the following priority: `custom property>dynamic common event property>static common event property>preset property`.
|
|
337
|
+
|
|
338
|
+
##### 2.5.1 Setting Static Common Event Properties
|
|
339
|
+
|
|
340
|
+
Static common event properties are low-frequency changing properties that every event will have, such as user membership level. After setting static common event properties via `setSuperProperties`, SDK will get the set common event properties as event properties when collecting events.
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
TDAnalytics.setSuperProperties({ vip_level: 2})
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Static common event properties will be saved to cache and don't need to be called every time the App starts. If the property already exists, the newly set property will overwrite the original property value. If the property did not exist before, it will create a new property. Besides property setting, we also provide other APIs to operate static common event properties to meet daily business needs.
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
//clear a common event property
|
|
350
|
+
TDAnalytics.unsetSuperProperty("superKey")
|
|
351
|
+
//clear all common event properties
|
|
352
|
+
TDAnalytics.clearSuperProperties()
|
|
353
|
+
//get all common event properties
|
|
354
|
+
async () => {
|
|
355
|
+
var properties = await TDAnalytics.getSuperProperties()
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
##### 2.5.2 Setting Dynamic Common Event Properties
|
|
360
|
+
|
|
361
|
+
Dynamic common event properties are high-frequency changing properties that every event will have, such as user's coin count. After setting dynamic common property class via `setDynamicSuperPropertiesTracker`, SDK will automatically get the properties from `getDynamicSuperProperties` when collecting events and add them to the triggered event.
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
var coin = 0;
|
|
365
|
+
TDAnalytics.setDynamicSuperProperties(function () {
|
|
366
|
+
return { coin: coin++ }
|
|
367
|
+
})
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### 2.6 Recording Event Duration
|
|
371
|
+
|
|
372
|
+
If you need to record the duration of an event, you can call `timeEvent` to start timing. Configure the event name you want to time. When you upload the event, `#duration` property will be automatically added to your event properties to represent the recorded duration, in seconds. Note that the same event name can only have one timing task.
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
//The following example completes the statistics of user staying time on a product page
|
|
376
|
+
//User enters product page, start timing
|
|
377
|
+
TDAnalytics.timeEvent("stay_shop")
|
|
378
|
+
/**do someting
|
|
379
|
+
.......
|
|
380
|
+
**/
|
|
381
|
+
//User leaves product page, timing ends, "stay_shop" event will have #duration property representing event duration
|
|
382
|
+
TDAnalytics.track({eventName:"stay_shop"})
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### 3. User Properties
|
|
386
|
+
|
|
387
|
+
TE platform currently supports the following user property setting interfaces: `userSet`, `userSetOnce`, `userAdd`, `userUnset`, `userDelete`, `userAppend`, `userUniqAppend`
|
|
388
|
+
|
|
389
|
+
#### 4.1 userSet
|
|
390
|
+
|
|
391
|
+
For general user properties, you can call `userSet` to set them. Properties uploaded using this interface will overwrite previous property values. If the user property did not exist before, it will create a new user property. The type will be consistent with the uploaded property type. Here is an example of setting username:
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
// username is TA
|
|
395
|
+
TDAnalytics.userSet({ username: "TA" });
|
|
396
|
+
//username is TE
|
|
397
|
+
TDAnalytics.userSet({ username: "TE" });
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### 4.2 userSetOnce
|
|
401
|
+
|
|
402
|
+
If you want to upload a user property that only needs to be set once, you can call `userSetOnce` to set it. When the property already has a value, this information will be ignored. Here is an example of setting first payment time:
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
//first_payment_time is 2018-01-01 01:23:45.678
|
|
406
|
+
TDAnalytics.userSetOnce({first_payment_time: "2018-01-01 01:23:45.678" });
|
|
407
|
+
//first_payment_time remains 2018-01-01 01:23:45.678
|
|
408
|
+
TDAnalytics.userSetOnce({first_payment_time: "2018-12-31 01:23:45.678" });
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### 4.3 userAdd
|
|
412
|
+
|
|
413
|
+
When you want to upload numeric properties, you can call `userAdd` to perform cumulative operations on the property. If the property has not been set, it will be assigned 0 before calculation. Negative values can be passed, equivalent to subtraction operation. Here is an example of cumulative payment amount:
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
//total_revenue is 30
|
|
417
|
+
TDAnalytics.userAdd({ total_revenue: 30 });
|
|
418
|
+
//total_revenue is 678
|
|
419
|
+
TDAnalytics.userAdd({ total_revenue: 648 });
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
<!-- unsupported block: 34 -->
|
|
423
|
+
|
|
424
|
+
The property key must be a string, and Value must be a number.
|
|
425
|
+
|
|
426
|
+
#### 4.4 userUnset
|
|
427
|
+
|
|
428
|
+
When you want to clear a user's user property value, you can call `userUnset` to clear the specified property. If the property has not been created in the cluster, `userUnset` will **not** create the property
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
TDAnalytics.userUnset("usersetkey")
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
<!-- unsupported block: 34 -->
|
|
435
|
+
|
|
436
|
+
userUnset parameter is the user property name, type is string or string array, supports variable-length parameter form.
|
|
437
|
+
|
|
438
|
+
#### 4.5 userDelete
|
|
439
|
+
|
|
440
|
+
If you want to delete a user, you can call `userDelete` to delete the user. You will no longer be able to query this user's user properties, but the events generated by this user can still be queried.
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
TDAnalytics.userDelete()
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
#### 4.6 userAppend
|
|
447
|
+
|
|
448
|
+
You can call `userAppend` to append elements to Array type user properties.
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
TDAnalytics.userAppend({ user_list: ["apple", "ball"] });
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
#### 4.7 userUniqAppend
|
|
455
|
+
|
|
456
|
+
You can call `userUniqAppend` to append unique elements to Array (List) type user data. Calling `userUniqAppend` interface will deduplicate the appended user properties, `userAppend` interface does not deduplicate, user properties can have duplicates.
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
//user_list property value is ["apple", "ball"]
|
|
460
|
+
TDAnalytics.userAppend({ user_list: ["apple", "ball"] });
|
|
461
|
+
//user_list property value is ["apple","apple","ball","cube"]
|
|
462
|
+
TDAnalytics.userAppend({ user_list: ["apple", "cube"] });
|
|
463
|
+
//user_list property value is ["apple", "ball","cube"]
|
|
464
|
+
TDAnalytics.userUniqAppend({ user_list: ["apple", "cube"] });
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### 4. Encryption Feature
|
|
468
|
+
|
|
469
|
+
SDK supports encryption feature. Client supports AES + RSA to encrypt data, then server decrypts the data. Encryption and decryption capabilities need to be coordinated between client and server. Please consult customer success personnel for details.
|
|
470
|
+
|
|
471
|
+
Set `enableEncrypt` property to true, and set default version number and public key.
|
|
472
|
+
|
|
473
|
+
```
|
|
474
|
+
import TDAnalytics, { TDAutoTrackEventType,TDThirdPartyType,TDTrackStatus} from "react-native-thinking-data";
|
|
475
|
+
TDAnalytics.init({
|
|
476
|
+
appId: "xxx",
|
|
477
|
+
serverUrl: "https://xxx",
|
|
478
|
+
enableEncrypt: true,// enable data transmission encryption
|
|
479
|
+
secretKey: {
|
|
480
|
+
publicKey: "xxx",// encryption public key
|
|
481
|
+
version: 1,// key version number
|
|
482
|
+
symmetricEncryption: "AES",
|
|
483
|
+
asymmetricEncryption: "RSA"
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### 5. Enabling Integration with H5 Pages
|
|
489
|
+
|
|
490
|
+
If you need to integrate with JavaScript SDK that collects H5 page data, please call the following interface. For details, please refer to H5 and APP SDK Integration section
|
|
491
|
+
|
|
492
|
+
```
|
|
493
|
+
<WebView
|
|
494
|
+
ref={webViewRef}
|
|
495
|
+
source={localHtmlFile}
|
|
496
|
+
onMessage={ event => {
|
|
497
|
+
console.log(event.nativeEvent.data);
|
|
498
|
+
TDAnalytics.h5ClickHandler(event.nativeEvent.data);
|
|
499
|
+
}}
|
|
500
|
+
javaScriptEnabled={true}
|
|
501
|
+
injectedJavaScript='window.ThinkingData_APP_ReactNative_Bridge = function(data) { window.ReactNativeWebView.postMessage(data); };'
|
|
502
|
+
/>
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### 6. Other Features
|
|
506
|
+
|
|
507
|
+
#### 6.1 Getting Device ID
|
|
508
|
+
|
|
509
|
+
You can call `getDeviceId` to get device ID:
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
async () => {
|
|
513
|
+
var device_id = await TDAnalytics.getDeviceId()
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
#### 6.2 Time Calibration
|
|
518
|
+
|
|
519
|
+
SDK will use local time as event occurrence time by default. If user manually modifies device time, it will affect your business analysis. In this case, you can use time calibration operation to ensure the accuracy of event occurrence time. We provide `timestamp, NTP` two time calibration methods.
|
|
520
|
+
|
|
521
|
+
- You can use the current timestamp obtained from server to calibrate SDK time. After that, all calls without specified time, including event data and user property setting operations, will use the calibrated time as occurrence time.
|
|
522
|
+
|
|
523
|
+
```
|
|
524
|
+
// 1585633785954 is current unix timestamp in milliseconds, corresponding to Beijing time 2020-03-31 13:49:45
|
|
525
|
+
TDAnalytics.calibrateTime(1585633785954);
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
- You can also set NTP server address, then SDK will try to get current time from the passed NTP service address and calibrate SDK time. If correct result is not obtained within default timeout (3 seconds), local time will be used for data reporting.
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
// Use Apple's NTP service for time calibration
|
|
532
|
+
TDAnalytics.calibrateTimeWithNtp("time.apple.com");
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
<!-- unsupported block: 34 -->
|
|
536
|
+
|
|
537
|
+
1. Using NTP service for time calibration has some uncertainty, we recommend you prefer using timestamp calibration method
|
|
538
|
+
|
|
539
|
+
2. You need to carefully choose your NTP server address to ensure that user devices can quickly get server time under good network conditions
|
|
540
|
+
|
|
541
|
+
#### 6.3 Immediately Upload Data
|
|
542
|
+
|
|
543
|
+
In certain business scenarios, if you expect data to be immediately uploaded to TE server, you can call `flush` interface
|
|
544
|
+
|
|
545
|
+
```
|
|
546
|
+
TDAnalytics.flush();
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
# Real-time Debugging
|
|
552
|
+
|
|
553
|
+
During SDK integration, you can view SDK logs in IDE console or use TE's Debug feature for real-time debugging.
|
|
554
|
+
|
|
555
|
+
### 1. Printing SDK Logs
|
|
556
|
+
|
|
557
|
+
You can set enableLog to true during SDK initialization to enable SDK log switch. After enabling, data uploaded will be printed in IDE console.
|
|
558
|
+
|
|
559
|
+
```
|
|
560
|
+
TDAnalytics.init({
|
|
561
|
+
appId: "xxx",
|
|
562
|
+
serverUrl: "https://xxx",
|
|
563
|
+
enableLog: true
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
<!-- unsupported block: 34 -->
|
|
568
|
+
|
|
569
|
+
After enabling logs, you can filter ThinkingAnalytics related logs in IDE to observe SDK data reporting.
|
|
570
|
+
|
|
571
|
+
### 2. Enabling Debug Mode
|
|
572
|
+
|
|
573
|
+
Enabling Debug mode requires two steps:
|
|
574
|
+
|
|
575
|
+
1. Enable Debug mode on client
|
|
576
|
+
Here is sample code for enabling Debug mode on client:
|
|
577
|
+
|
|
578
|
+
```
|
|
579
|
+
/*
|
|
580
|
+
Set running mode to Debug mode
|
|
581
|
+
normal mode: data will be cached and uploaded according to certain caching strategy, default is NORMAL mode; recommended for production environment
|
|
582
|
+
debug mode: data is uploaded one by one. When problems occur, it will alert users via logs and exceptions; not recommended for production environment
|
|
583
|
+
debugOnly mode: only validate data, will not store; not recommended for production environment
|
|
584
|
+
*/
|
|
585
|
+
TDAnalytics.init({
|
|
586
|
+
appId: "xxx",
|
|
587
|
+
serverUrl: "https://xxx",
|
|
588
|
+
mode:"debug"
|
|
589
|
+
});
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
2. Add Debug device in TE backend
|
|
593
|
+
To avoid Debug mode going live in production environment, only specified devices can enable Debug mode. Debug mode can only be enabled when Debug mode is enabled on client and device ID is configured in TE backend's "Tracking Management" page's "Debug Data" section.
|
|
594
|
+
|
|
595
|
+
Device ID can be obtained through three ways:
|
|
596
|
+
|
|
597
|
+
- #device_id property in event data on TE platform
|
|
598
|
+
- Client log: Device DeviceId will be printed after SDK initialization completes
|
|
599
|
+
- Instance interface call: Get Device ID
|
|
600
|
+
<!-- unsupported block: 34 -->
|
|
601
|
+
|
|
602
|
+
Debug mode may affect data collection quality and App stability, only use for integration stage data verification, do not use in production environment.
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
# Auto-tracking
|
|
607
|
+
|
|
608
|
+
### 1. Enabling Auto-tracking Events
|
|
609
|
+
|
|
610
|
+
You can call `enableAutoTrack` and pass a `TDAutoTrackEventType` type to enable auto-tracking. Currently supports six types:
|
|
611
|
+
|
|
612
|
+
- `ta_app_start`: App enters foreground, corresponding type is `TDAutoTrackEventType.APP_START`
|
|
613
|
+
- `ta_app_end`: App enters background, corresponding type is `TDAutoTrackEventType.APP_END`
|
|
614
|
+
- `ta_app_install`: First open after installation, corresponding type is `TDAutoTrackEventType.APP_INSTALL`
|
|
615
|
+
- `ta_app_crash`: App crashes due to uncaught exception, corresponding type is `TDAutoTrackEventType.APP_CRASH`
|
|
616
|
+
- `ta_app_view`: Triggered when APP uses Navigator route navigation, corresponding type is `TDAutoTrackEventType.APP_VIEW_SCREEN` (supported in 3.2.0 and later versions)
|
|
617
|
+
- `ta_app_click`: APP control click event triggered when user clicks control, corresponding type is `TDAutoTrackEventType.APP_CLICK` (supported in 3.2.0 and later versions)
|
|
618
|
+
Notes about auto-tracking events:
|
|
619
|
+
|
|
620
|
+
1. Auto-tracking events are implemented in native SDK, so dynamic common properties currently cannot be added to auto-tracking events.
|
|
621
|
+
1. If you need to set visitor ID or common properties, please complete setting before enabling auto-tracking events.
|
|
622
|
+
Sample code for enabling auto-tracking:
|
|
623
|
+
|
|
624
|
+
```
|
|
625
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START | TDAutoTrackEventType.APP_END | TDAutoTrackEventType.APP_INSTALL| TDAutoTrackEventType.APP_CRASH | TDAutoTrackEventType.APP_CLICK | TDAutoTrackEventType.APP_VIEW_SCREEN);
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### 2. Detailed Introduction
|
|
629
|
+
|
|
630
|
+
#### 2.1 Page View Events
|
|
631
|
+
|
|
632
|
+
App page view events support React Navigation ^2.0 ~ ^6.0
|
|
633
|
+
|
|
634
|
+
Triggered when APP uses navigation route navigation. Detailed event introduction:
|
|
635
|
+
|
|
636
|
+
- Event name: ta_app_view
|
|
637
|
+
- Preset properties:
|
|
638
|
+
`#screen_name`: string type, page name
|
|
639
|
+
|
|
640
|
+
`#title`: string type, page title
|
|
641
|
+
|
|
642
|
+
`#referrer`: string type, previous address
|
|
643
|
+
|
|
644
|
+
- Enable method:
|
|
645
|
+
- Call `enableAutoTrack`, pass `TDAutoTrackEventType.APP_VIEW_SCREEN`
|
|
646
|
+
|
|
647
|
+
```
|
|
648
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_VIEW_SCREEN);
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
- Execute script
|
|
652
|
+
|
|
653
|
+
```
|
|
654
|
+
node node_modules/react-native-thinking-data/ThinkingDataRNHook.js -run
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
- Set page custom properties: When navigating via Navigation, you can add custom properties in params. SDK will automatically use the settings in params to supplement or overwrite App page view event properties.
|
|
658
|
+
|
|
659
|
+
```
|
|
660
|
+
navigation.navigate('PageB', {
|
|
661
|
+
thinkingdataparams: {
|
|
662
|
+
name: 'name_A',
|
|
663
|
+
'#title': 'Second Page',
|
|
664
|
+
'#screen_name': "page_B"
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
If you need to customize #title and #screen_name, you can pass them in thinkingdataparams parameter.
|
|
670
|
+
|
|
671
|
+
- Ignore single page view event: When TDIgnoreViewScreen property with value true is added in thinkingdataparams, this page view event will be ignored
|
|
672
|
+
|
|
673
|
+
```
|
|
674
|
+
navigation.navigate('PageB', {
|
|
675
|
+
thinkingdataparams: {
|
|
676
|
+
name: 'name_A',
|
|
677
|
+
'#title': 'Second Page',
|
|
678
|
+
'#screen_name': "page_B",
|
|
679
|
+
TDIgnoreViewScreen: true
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
#### 2.2 Element Click Events
|
|
685
|
+
|
|
686
|
+
App element click events support React Native 0.23 ~ 0.70.0
|
|
687
|
+
|
|
688
|
+
APP control click event triggered when user clicks control
|
|
689
|
+
|
|
690
|
+
- Event name: ta_app_click
|
|
691
|
+
- Preset properties:
|
|
692
|
+
`#screen_name`: string type, page name
|
|
693
|
+
|
|
694
|
+
`#title`: string type, page title
|
|
695
|
+
|
|
696
|
+
`#element_content`: string type, element content
|
|
697
|
+
|
|
698
|
+
- Enable method:
|
|
699
|
+
- Call `enableAutoTrack`, pass `TDAutoTrackEventType.APP_CLICK`
|
|
700
|
+
|
|
701
|
+
```
|
|
702
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_CLICK);
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
- Execute script:
|
|
706
|
+
|
|
707
|
+
```
|
|
708
|
+
node node_modules/react-native-thinking-data/ThinkingDataRNHook.js -run
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
- Set control custom properties: Add custom properties thinkingdataparams in control
|
|
712
|
+
|
|
713
|
+
```
|
|
714
|
+
<CustomButton
|
|
715
|
+
title="Button"
|
|
716
|
+
thinkingdataparams={{
|
|
717
|
+
name: 'button',
|
|
718
|
+
pro_key:'pro_value'
|
|
719
|
+
}}
|
|
720
|
+
/>
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
- Ignore single control click event: When TDIgnoreViewClick property with value true is added in thinkingdataparams, this control click event will be ignored
|
|
724
|
+
|
|
725
|
+
```
|
|
726
|
+
<CustomButton
|
|
727
|
+
title="Button"
|
|
728
|
+
thinkingdataparams={{
|
|
729
|
+
name: 'button',
|
|
730
|
+
pro_key:'pro_value'
|
|
731
|
+
TDIgnoreViewClick: true
|
|
732
|
+
}}
|
|
733
|
+
/>
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### 3. Setting Auto-tracking Event Custom Properties
|
|
737
|
+
|
|
738
|
+
You can call `enableAutoTrack` to set auto-tracking event properties
|
|
739
|
+
|
|
740
|
+
```
|
|
741
|
+
TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START,{
|
|
742
|
+
auto_name: "xxx",
|
|
743
|
+
auto_age: "xxx"
|
|
744
|
+
})
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
# Preset Properties
|
|
750
|
+
|
|
751
|
+
### 1. Preset Properties Description
|
|
752
|
+
|
|
753
|
+
Preset properties collected by iOS and Android platforms will have some differences. Please refer to the following documents:
|
|
754
|
+
|
|
755
|
+
iOS platform preset properties, Android platform preset properties
|
|
756
|
+
|
|
757
|
+
### 2. Getting Preset Properties
|
|
758
|
+
|
|
759
|
+
```
|
|
760
|
+
async () => {
|
|
761
|
+
var presetProperties = await TDAnalytics.getPresetProperties()
|
|
762
|
+
}
|
|
763
|
+
```
|