User Association for All-domain (iOS)
|
Collect
1. User Association Introduction
When using a simple user association to identify users, there are two types of user ID values: one is the device ID (anonymous ID), and the other is the login ID. It cannot meet the complex multi-touch user association. For more detailed information, please refer to the User Identification Introduction in the SDK product functions section.
2. API Introduction
This section only introduces the API functions of all-domain 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:
SDK version >= 4.3.0, call this method when the user logs in. The first parameter is obtained from the detailed preset ID key list, and the second parameter is the specific user ID.
After calling the interface, the key and value will be cached locally, and the ID information will be included in subsequent collected events.
iOS SDK
[[SensorsAnalyticsSDK sharedInstance] loginWithKey:@"key" loginId:@"value"];
Call this method in the case of multiple user ID associations. The first parameter is obtained from the detailed preset ID key list, and the second parameter is the associated user ID.
After calling the interface, the key and value will be cached locally, and the ID information will be included in subsequent collected events.
iOS SDK
[[SensorsAnalyticsSDK sharedInstance] bind:@"$identity_mobile" value:@"187****8991"];
Call this method to cancel the association of multiple user IDs. The first parameter is the key to cancel the association, and the second parameter is the user ID to cancel the association.
After calling the interface, the corresponding unbinding events will be sent, and the key-value in the local cache of the ID information will be cleared (if it exists).
iOS SDK
[[SensorsAnalyticsSDK sharedInstance] unbind:@"$identity_mobile" value:@"187****8991"];
SDK version >= 4.3.0, call this method when the user logs in. The first parameter is obtained from the detailed preset ID key list, and the second parameter is the specific user ID.
After calling the interface, the key and value will be cached locally, and the ID information will be included in subsequent collected events.
iOS SDK
SensorsAnalyticsSDK.sharedInstance()?.login(withKey:"key",loginId:"value");
When calling in multiple user ID associations, the first parameter is obtained from the detailed preset ID key list, and the second parameter is the corresponding associated user ID.
After calling the interface, the corresponding key and value will be cached locally, and the collected events thereafter will include the cached ID information.
iOS SDK
SensorsAnalyticsSDK.sharedInstance()?.bind("$identity_mobile",value:"187****8991");
When calling in multiple user ID disassociations, the first parameter is the disassociated key, and the second parameter is the corresponding disassociated user ID.
After calling the interface, relevant unbinding events will be sent, and the corresponding key-value will be cleared from the local cached ID information if it exists.
iOS SDK
SensorsAnalyticsSDK.sharedInstance()?.unbind("$identity_mobile",value:"187****8991");
In order to accurately record the behavior information of logged in users, it is recommended to call the user login interface at the following moments:
· When the user registers successfully · When the user logs in successfully · Every time the logged in user starts the app
2.2. Multiple User ID Association
Used when associating multiple user IDs, the first parameter is obtained from the detailed preset ID key list, and the second parameter is the corresponding associated user ID.
After calling the interface, the corresponding key and value will be cached locally, and the collected events thereafter will include the cached ID information.
[[SensorsAnalyticsSDK sharedInstance] bind:@"$identity_mobile" value:@"187****8991"];
2.3. Multiple User ID Disassociation
Used when disassociating multiple user IDs, the first parameter is the disassociated key, and the second parameter is the corresponding disassociated user ID.
After calling the interface, relevant unbinding events will be sent, and the corresponding key-value will be cleared from the local cached ID information if it exists.
[[SensorsAnalyticsSDK sharedInstance] unbind:@"$identity_mobile" value:@"187****8991"];
2.4. Reset Anonymous ID
Used to reset the anonymous ID, it can generate a new anonymous ID or pass in a specified anonymous ID.
Note: It can only be used in an anonymous state (i.e. after logout or before login), otherwise the call is invalid.
The difference between this method and identify is that in addition to modifying the distinct_id in IDM 2.0, it also modifies the values of $identity_idfv or $identity_ios_uuid in IDM 3.0 identities.
// 重置匿名 ID [[SensorsAnalyticsSDK sharedInstance] resetAnonymousIdentity:nil]; // 修改为指定的匿名 ID [[SensorsAnalyticsSDK sharedInstance] resetAnonymousIdentity:@"id-xxxxxxx-xxxxx"];
2.5. Get User ID
SDK version needs to be >=4.3.0
Get the ID of the globally linked user
// 获取事件的 ID NSDictionary *SDKProperties = [[SensorsAnalyticsSDK sharedInstance] identities]; // 可以获取数据体中的 identities 对象:SDKProperties.identities
SDK version needs to be >=4.3.0
Get the ID of the globally linked user
// 获取事件的 ID NSDictionary *SDKProperties = SensorsAnalyticsSDK.sharedInstance?.identities; // 可以获取数据体中的 identities 对象:SDKProperties.identities
Note: The content of this document is a technical document that provides details on how to use the Sensors product and does not include sales terms; the specific content of enterprise procurement products and technical services shall be subject to the commercial procurement contract.