User IDs are important information in many scenarios.
- Mobile Analysis Service (MAS) presets a string-type attribute named
userId
. You can log in to the console and go to the Mobile Analysis Service > Custom analysis > Custom configuration > Attribute page to view the attribute details. - Event tracking logs contain the User ID field. For more information, see Log model > Custom event tracking.
- Event analysis related to user volume (UV) depends on the User ID field.
- When you use the mPaaS Delivery Service to perform App release to the specific whitelist of users in gray release mode, user IDs are required on the client.
User ID and device ID
A user can use an App before login, which means the user ID may be empty, but the device ID is usually available. In this case, the device ID can be used for user behavior analysis instead of the user ID.
For example, you can specify the user ID or device ID for calculation when using the funnel analysis function. When the user ID is used for calculation, the number of users is the number of distinct user IDs. When the device ID is used for calculation, the number of users is the number of distinct device IDs.
Set user IDs
To use the user ID-related analysis functions, you need to call the SDK APIs to set user IDs.
- Avoid using special symbols when setting up user IDs. Numbers and letters are recommended.
- Do not use the device ID read by UTDID as
userId
.
Android
- Case 1: Call the
MPLogger.reportUserLogin("userId");
API.
If you want to collect the number of registered users of an App, call theMPLogger.reportUserLogin("userId");
API. This API automatically sets the global user ID as the input parameter. No manual operation is required. - Other cases: Call the
MPLogger.setUserId("userId");
API to set a user ID.
For more information, see Active device/user reporting log.
iOS
Set the user ID in the Category of MPaaSInterface
. For more information, see Configure a project.
@implementation MPaaSInterface (Demo)
- (NSString *)userId
{
return @"the-user-id";
}
@end