1. User Association Introduction

For simple user association, there are two types of user ID values: one is device ID (anonymous ID), and the other is login ID. It cannot meet the requirements of complex multi-touchpoint user association. For more details, please refer to the User Identification Introduction in the SDK product function section.

2. API Introduction

This section only introduces the API functions of global user association. For other tracking interfaces, please refer to the Basic API Function Introduction.

2.1. User Login

When a user registers or logs in successfully, the login() method of the SDK needs to be called.

SensorsAnalyticsFlutterPlugin.login("登录 ID");
CODE

To accurately record the behavior information of logged-in users, it is recommended to call the user login method at the following times:

· When a user registers successfully · When a user logs in successfully · Each time a logged-in user starts the App

2.2. Get User ID

Each event in Sensors Analytics is associated with an ID to identify the user or device information corresponding to the event. We call it the distinct_id. Before the login() method of the SDK is called, the value obtained is the default anonymous ID, and the value obtained after calling the login() method is the value passed in the login() method.

//获取当前用户的 loginId SensorsAnalyticsFlutterPlugin.getLoginId();
CODE

2.3. Custom Anonymous ID

By default, the SDK generates an anonymous ID and ensures its uniqueness. If you need to replace the default anonymous ID assigned by Sensors Analytics, you can immediately call the identify("User-defined anonymous ID") method after initializing the SDK for replacement.

//设置自定义匿名 ID,在初始化 SDK 之后立即调用 SensorsAnalyticsFlutterPlugin.identify(“用户自定义匿名 ID ”);
CODE