1. Introduction to User Association across Platforms

ID-Mapping, also known as user association, is implemented in ID-Mapping 3.0 to achieve user association across platforms. It connects different IDs of the same user to unify all user behavior data, facilitating systematic user behavior analysis. It supports free association and unbinding between user identifiers.

Here are some examples of user IDs from various business ends:

2. Obtaining ID Keys

To find a suitable ID key for use, you can refer to the following figure to find a suitable ID key in the Sensors Analytics platform. For example, to associate with a mobile number, use $identity_mobile.

If you cannot find a suitable ID key, you can create a new one.

In order to clearly identify the semantics of IDs in ID-Mapping 3.0, it is necessary to specify which IDs are involved in user association. Therefore, ID keys need to be determined, similar to defining events/properties for strong verification. If an ID not defined in the ID list is included in the data, the entire event will be rejected from being stored.

Detailed list of preset ID keys 

3. API Documentation


After upgrading to SDK 3.0, you cannot downgrade to version 2.0

3.1. Web

Minimum Supported Versions of ID-Mapping 3.0 for Each Platform

Web JS SDK v1.22.3 

用户登录时调用,第一个参数从详细的预置 id key 列表中获取,第二个参数为对应的具体用户 ID。

调用接口后,对应的 key 和 value 会缓存在本地,后续采集的事件,均包含缓存的 ID 信息。

Web JS SDK

sensors.loginWithKey('key','value')
JS

Call when associating multiple user IDs. The first parameter is obtained from the detailed built-in 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 in the future will include the cached ID information.

Web JS SDK

sensors.bind('$identity_mobile','187****8991')
CPP

Call when dissociating multiple user IDs. The first parameter is the key to be dissociated, and the second parameter is the corresponding dissociated user ID.

After calling the interface, the relevant unbinding event will be sent, and the corresponding key-value in the local cached ID information will be cleared if it exists.

Web JS SDK

sensors.unbind('$identity_mobile','187****8991')
JS


3.2. Mini Program

The minimum supported version for ID-Mapping 3.0 on each platform.

WeChat Mini Program SDK v1.17.6

Call when a user logs in. The first parameter is obtained from the detailed built-in ID key list, and the second parameter is the corresponding specific user ID.

After calling the interface, the corresponding key and value will be cached locally, and the collected events in the future will include the cached ID information.

Mini Program SDK

sensors.loginWithKey('key','value')
JS

Call when associating multiple user IDs. The first parameter is obtained from the detailed built-in 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 in the future will include the cached ID information.

Mini Program

sensors.bind('$identity_mobile','187****8991')
CPP

Call when dissociating multiple user IDs. The first parameter is the key to be dissociated, and the second parameter is the corresponding dissociated user ID.

After calling the interface, the relevant unbinding event will be sent, and the corresponding key-value in the local cached ID information will be cleared if it exists.

Mini Program

sensors.unbind('$identity_mobile','187****8991')
JS

Call when associating a WeChat user's openid with multiple user IDs. The parameter is the corresponding associated user openid. (Supported in v1.18.3 and above)

After calling the interface, the corresponding key and value will be cached locally, and the collected events later will include the cached ID information.

WeChat Mini Program SDK

sensors.bindOpenid('Openid')
JS

When canceling the association between multiple User IDs and WeChat user Openid, the parameter is the corresponding associated user's Openid. (Supported in v1.18.3 and above)

After calling the interface, relevant unbinding events will be sent, and the corresponding key-value in the local cached ID information will be cleared (if it exists).

WeChat Mini Program SDK

sensors.unbindOpenid('Openid')
JS

When associating multiple User IDs with WeChat user Unionid, the parameter is the corresponding associated user's Unionid. (Supported in v1.18.3 and above)

After calling the interface, the corresponding key and value will be cached locally, and the collected events later will include the cached ID information.

WeChat Mini Program SDK

sensors.bindUnionid('Unionid')
JS

When canceling the association between multiple User IDs and WeChat user Unionid, the parameter is the corresponding associated user's Unionid. (Supported in v1.18.3 and above)

After calling the interface, relevant unbinding events will be sent, and the corresponding key-value in the local cached ID information will be cleared (if it exists).

WeChat Mini Program SDK

sensors.unbindUnionid('Unionid')
JS

3.3. Android

The minimum supported version of ID-Mapping 3.0 for each platform.

Android SDK v6.3.0

Called when the user logs in. The first parameter is obtained from the detailed preset id key list, and the second parameter is the corresponding specific user ID.

After calling the interface, the corresponding key and value will be cached locally, and the collected events later will include the cached ID information.

Android SDK

 SensorsDataAPI.sharedInstance().loginWithKey(String loginIDKey, String loginId);
JAVA

Called 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 later will include the cached ID information.

Android SDK

SensorsDataAPI.sharedInstance().bind("$identity_mobile","187****8991")
JAVA

When calling the cancel association of multiple user IDs, the first parameter is the key to cancel the association, and the second parameter is the corresponding user ID to cancel the association.

After calling the interface, related unbinding events will be sent, and the corresponding key-value in the local cache of ID information will be cleared (if it exists).

Android SDK

SensorsDataAPI.sharedInstance().unbind("$identity_mobile","187****8991")
JAVA

3.4. iOS

The minimum supported version of ID-Mapping 3.0 for each end.

iOS SDK v4.3.0

When the user logs in, the first parameter is obtained from the detailed preset list of id key. The second parameter is the corresponding specific user ID.

After calling the interface, the corresponding key and value will be cached locally, and the subsequent collected events will all contain the cached ID information.

iOS SDK

 [[SensorsAnalyticsSDK sharedInstance] loginWithKey:@"key" loginId:@"value"];
CPP

When calling the association of multiple user IDs, the first parameter is obtained from the detailed preset list of id key. The second parameter is the corresponding associated user ID.

After calling the interface, the corresponding key and value will be cached locally, and the subsequent collected events will all contain the cached ID information.

iOS SDK

[[SensorsAnalyticsSDK sharedInstance] bind:@"$identity_mobile" value:@"187****8991"];
JS

When calling the cancel association of multiple user IDs, the first parameter is the key to cancel the association, and the second parameter is the corresponding user ID to cancel the association.

After calling the interface, related unbinding events will be sent, and the corresponding key-value in the local cache of ID information will be cleared (if it exists).

iOS SDK

[[SensorsAnalyticsSDK sharedInstance] unbind:@"$identity_mobile" value:@"187****8991"];
CPP


3.5. Java

The minimum supported version of ID-Mapping 3.0 for each end.

Java SDK v3.4.3


After calling the interface, relevant binding events will be sent. The key and value of the corresponding binding will not be cached locally, and subsequent collected events will not contain the bound ID information.

The bind interface needs to pass in at least two ID information. A single ID information cannot complete the binding operation.

Java SDK

SensorsAnalyticsIdentity identity = SensorsAnalyticsIdentity.builder() .addIdentityProperty("$identity_mobile", "123") 		.addIdentityProperty("$identity_email", "a@a.com") .build(); sa.bind(identity);
JAVA


When canceling the association of the user ID, call the API with the parameter key as the key to cancel the association, and the value as the corresponding cancellation associated user business ID.

After calling the interface, relevant unbinding events will be sent.

Java SDK

SensorsAnalyticsIdentity identity = SensorsAnalyticsIdentity.builder() .addIdentityProperty("$identity_mobile", "123") .build(); sa.unbind(identity);
JAVA


3.6. C#

The minimum supported version for each end of ID-Mapping 3.0

C# SDK v2.1.0


After calling the interface, relevant binding events will be sent. The key and value of the corresponding binding will not be cached locally, and subsequent collected events will not contain the bound ID information.

The Bind interface needs to pass the Identity list, and the list must contain at least 2 values.

C# SDK

List<SensorsAnalyticsIdentity> identities = SensorsAnalyticsIdentityHelper.CreateBuilder() .AddIdentityProperty("$identity_mobile", "123") .AddIdentityProperty("$identity_email", "a@a.com") 		 .Build(); sa.bind(identities)
C#


When canceling the association of the user ID, call the API with the parameter key as the key to cancel the association, and the value as the corresponding cancellation associated user business ID.

After calling the interface, relevant unbinding events will be sent.

C# SDK

SensorsAnalyticsIdentity identity = new SensorsAnalyticsIdentity("$identity_mobile", "123") sa.unbind(identity);
C#