1. User Global Association Introduction

Refer to the Identify Users - User Global Association in the SDK product feature section.

  • This solution is a brand new user association solution. Please contact the customer success team if you need to use it.
  • Mini program version >= 1.17.6

2. API Introduction

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

2.1.  User Login

Used when the user logs in. The first parameter is obtained from the detailed preset ID key list. The second parameter is the corresponding user ID.

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

 sensors.loginWithKey(String loginIDKey, String loginId);
JS

2.2. Multi-user ID Association

Used when associating multiple user IDs. The first parameter is obtained from the detailed preset ID key list. The second parameter is the corresponding associated user ID.

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

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

2.3. Multi-user ID Disassociation

Used when disassociating multiple user IDs. The first parameter is the key for disassociation, and the second parameter is the corresponding user ID for disassociation.

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

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

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: This method 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 besides 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

2.5. Multi User ID Relating to Openid

When calling the association with the WeChat user Openid, the parameter is the corresponding associated user Openid. (Supported version: v1.18.3 and above)

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

The WeChat Mini Program SDK provides the bindOpenid interface to set the anonymous ID as OpenID.

Mini Program SDK

sensors.bindOpenid('openid')
JS

This interface can only be supported if the following two conditions are met! If the conditions are not met, you can use the identify ('openid', true) interface;

  • bindOpenid only supports ID-Mapping 3.0. Please confirm if SA backend supports ID-Mapping 3.0 before using it;
  • bindOpenid The WeChat Mini Program SDK supports version v1.18.3 or above!

2.6. Multi User ID Unrelating to Openid

When unassociating with the WeChat user Openid, the parameter is the corresponding associated user Openid. (Supported version: v1.18.3 and above)

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

Mini Program SDK

sensors.unbindOpenid('openid')
JS

2.7. Multi User ID Relating to Unionid

When calling the association with the WeChat user Unionid, the parameter is the corresponding associated user Unionid. (Supported version: v1.18.3 and above)

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

Mini Program SDK

sensors.bindUnionid('Unionid')
JS

2.8. Multi User ID Unrelating to Unionid

When unassociating with the WeChat user Unionid, the parameter is the corresponding associated user Unionid. (Supported version: v1.18.3 and above)

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

Mini Program SDK

sensors.unbindUnionid('Unionid')
JS