1. User Association Introduction
When identifying users with simple user association, there are two types of user ID values: device ID (anonymous ID) and login ID. It cannot meet the complex multi-touch user association. For detailed information, please refer to the User Identification Introduction in the SDK product functionality section.
2. API Introduction
This section only introduces the API function of simple user association. For other tracking interfaces, please refer to the Basic API Function Introduction.
2.1. User Login
When a user registers successfully or logs in, you need to call the user login interface of the SDK:
[[SensorsAnalyticsSDK sharedInstance] login:@"<#登录 ID#>"];
CODE
SensorsAnalyticsSDK.sharedInstance()?.login("<#登录 ID#>")
CODE
In order to accurately record the behavior information of logged-in users, it is recommended to call the user login interface at the following times:
2.2. Get User ID
In Sensors Analytics, each event is associated with an ID to identify the user or device information corresponding to that event. We call it distinct_id. You can also obtain this ID through the - distinctId interface:
// 获取事件的 ID 标识 [[SensorsAnalyticsSDK sharedInstance] distinctId];
CODE
In Sensors Analytics, each event is associated with an ID to identify the user or device information corresponding to that event. We call it distinct_id. You can also obtain this ID through the - distinctId interface:
// 获取事件的 ID 标识 SensorsAnalyticsSDK.sharedInstance()?.distinctId
CODE
By default, before the user logs in,distinct_id is aanonymous ID generated by the SDK, usually IDFA, IDFV, or UUID.
You can also use - anonymousId interface to get current anonymity ID:
// 获取匿名 ID [[SensorsAnalyticsSDK sharedInstance] anonymousId];
CODE
// 获取匿名 ID SensorsAnalyticsSDK.sharedInstance()?.anonymousId()
CODE
2.3. Custom Anonymous ID
By default, the SDK generates an anonymous ID to ensure its uniqueness. If you need to replace the default anonymous ID assigned by Sensors Analytics, you can call the identify: method immediately after initializing the SDK. - identify:method for replacement.
Code example:
[[SensorsAnalyticsSDK sharedInstance] identify:<#自定义匿名 ID#>];
CODE
SensorsAnalyticsSDK.sharedInstance()?.identify(<#自定义匿名 ID#>)
CODE