User ID¶
Set the app's unique user ID. By setting user ID, session information uploaded from different devices can be aggregated to the same user even when the user is using multiple devices.
You should set the string that can identify the user as follows.
Member ID used in the service
Warning
If a different user ID is sent to a device that already has a user ID set, the user ID that was last set on the device and the device itself will be linked, and past users will no longer be linked to the device.
Once the user ID is changed, the original user’s behavior history and user profiles will not be carried over. Please define the value used as the user ID with great care.
Set User ID¶
Warning
The following types of values are not recommended to use as a user ID:
- Strings that may collide, such as the user's nameEven if the users are different, if they use the same value, multiple devices can be mistakenly aggregated to the same user.
- Strings that can be freely modified by the user, such as an email address or phone numberOnce user Id is changed, Behavior history and user profiles of the original user will not be carried over.From a security standpoint, it is also recommended to perform encryption or similar measures.
Please also refer to ユーザーIDを考える for further guidance (available in Japanese only).
Set the user ID. Maximum value length is 191 characters.
[Repro setUserID:@"xxxxxxxxxxxx"];
Repro.set(userID: "xxxxxxxxxxxx")
Repro.setUserID("xxxxxxxxxxxx");
Repro.setUserID("xxxxxxxxxxxx")
ReproCpp::setUserID("xxxxxxxxxxxx");
Repro.SetUserID ("xxxxxxxxxxxx");
Repro.setUserID("xxxxxxxxxxxx");
Repro.setUserID("xxxxxxxxxxxx");
await Repro.setUserID("xxxxxxxxxxxx");
If it is not possible to uniquely identify a user within the app, it is also possible to set the device ID as the user ID as an alternative.
Note
If your application has a login feature, please do not set user ID before user has logged in.The behavior history tracked and the user profiles set while the user ID was not set will be inherited even after setting the user ID.If you explicitly specify the user ID before logging in, the behavior history and user profiles before login and after login will be aggregated as different users.
For more details, please refer to ユーザーIDを設定するタイミングのベストプラクティスを教えて下さい (available in Japanese only).
Get User ID¶
Get the user ID which you set.
NSString* userID = [Repro getUserID];
let userID = Repro.userID()
String userID = Repro.getUserID();
val userID = Repro.getUserID()
const char* userID = ReproCpp::getUserID();
string userID = Repro.GetUserID ();
// retrieve userID via callback function
Repro.getUserID(function(userID) {
...
});
// retrieve userID via callback function
Repro.getUserID((error, userID) => {
...
});
final userId = await Repro.getUserID();