In order to clearly identify the semantics of ID in ID-Mapping 3.0, it is necessary to determine which IDs are involved in user association. Therefore, the ID keys need to be defined, similar to events/properties that need to be defined for strict validation. If an ID that is not defined in the data is included, the entire event will be rejected for storage.

If you cannot find a suitable ID key that meets the requirements, you can create a new one.

Detailed list of preset ID keys 

1. API Introduction

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

Minimum Supported Version of ID-Mapping 3.0

Web SDK v1.22.3

1.1.  User Login

Call this when the user logs in. The first parameter is obtained from the detailed list of preset ID keys, and the second parameter is the specific user ID associated with it.

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

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

1.2. Association of Multiple User IDs

Used for calling when associating multiple user IDs. The first parameter is obtained from the detailed list of preset ID keys, 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.

sensors.bind("$identity_mobile","187****8991")
JS

1.3. Disassociation of Multiple User IDs

Used for calling when disassociating multiple user IDs. The first parameter is the key to be disassociated, and the second parameter is the corresponding user ID to be disassociated.

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).

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

1.4. Reset Anonymous ID

Used to reset the anonymous ID. You can generate a new anonymous ID or pass in a specified anonymous ID.

Note: This can only be used in anonymous state (i.e., after logout or before login), otherwise the call will be invalid.

This method is different from logout(true) and identify. In addition to modifying the distinct_id in IDM 2.0, it also modifies the value of $identity_cookie_id in IDM 3.0 identities.

// 重置匿名 ID sensors.resetAnonymousIdentity(); // 修改为指定的匿名 ID sensors.resetAnonymousIdentity('id-xxxxxxx-xxxxx');
JS

1.5. Get user ID

Get the ID of the global user.

var presetProperties = sensors.getPresetProperties(); // 可以获取数据体中的 identities 对象:SDKProperties.identities // 如果是 ES6,同步等方式加载的,直接用上面方式获取即可。 // 如果是异步动态 Script 加载的,需要在 sensors.quick('isReady',function(){}) 在 ready 回调中获取;
JS