User ID

更新时间:
复制 MD 格式

The user ID is important in many scenarios.

  • The Mobile Analysis platform includes a predefined string property named userId. To view the property details, go to the Mobile Analysis > Custom Analysis > Event and Property Configuration > Properties page in the console.

  • Different types of instrumentation logs contain a user ID field. For more information, see Log Model > Custom Events.

  • In Event Analysis, analyses related to the number of unique visitors (UV) depend on the user ID.

  • When you use the mPaaS real-time release platform for a canary release to a specific user whitelist, the client must have a user ID set.

User ID and device ID

If a user is not logged on to your app, the user ID might be empty. However, the device ID is usually available. You can use the device ID instead of the user ID to analyze user behavior.

For example, when you use the Funnel Analysis feature, you can set the calculation dimension to user ID or device ID. If the dimension is user ID, the user count is the number of unique user IDs. If the dimension is device ID, the user count is the number of unique device IDs.

Set the user ID

To use analysis features related to the user ID, you must call the SDK interface to set the user ID.

Note

  • Avoid using special characters when setting the user ID. Use numbers and letters.

  • Do not use the device ID read from UTDID as the userId.

Android

  • Scenario 1: To count the number of registered app users, call the MPLogger.reportUserLogin("userId"); user logon reporting interface. This interface automatically sets the input parameter as the global user ID, so no other action is required.

  • In other scenarios, call MPLogger.setUserId("userId"); to set the user ID.

For more information, see Logon logs.

iOS

See Configure project and configure the user ID in the Category of MPaaSInterface:

@implementation MPaaSInterface (Demo)
- (NSString *)userId
{
    return @"the-user-id";
}
@end