A unique identifier for this user. Limit 997 bytes. These User IDs should be private and not easily guessable (e.g. not a plain email address or username).
Optionalsignature: stringAn encrypted signature to be used to authenticate the current user. You can update the signature
using the [[setSdkAuthenticationSignature]] method. This signature will only have an effect if the enableSdkAuthentication
initialization option is set to true.
When a user first uses Braze on a device they are considered "anonymous". Use this method to identify a user with a unique ID, which enables the following:
When you request a user switch (which is any call to changeUser where the new user ID is not the same as the existing user ID), the current session for the previous user (anonymous or not) is automatically ended and a new session is started. Similarly, following a call to changeUser, any events which fire are guaranteed to be for the new user -- if an in-flight server request completes for the old user after the user switch no events will fire, so you do not need to worry about filtering out events from Braze for old users.
Additionally, if you identify a user which has never been identified on another device, the entire history of that user as an "anonymous" user on this device will be preserved and associated with the newly identified user. However, if you identify a user which has been identified in another app, any history which was already flushed to the server for the anonymous user on this device will be merged into the identified user. Any fields that already exist on the identified user will not be overwritten, and the merge is limited to the fields listed here.
Note: Once you identify a user, you cannot revert to the "anonymous" user. The transition from anonymous to identified tracking is only allowed once because the initial anonymous user receives special treatment to allow for preservation of their history. As a result, we recommend against changing the user ID just because your app has entered a "logged out" state because it makes you unable to target the previously logged out user with re-engagement campaigns. If you anticipate multiple users on the same device, but only want to target one of them when your app is in a logged out state, we recommend separately keeping track of the user ID you want to target while logged out and switching back to that user ID as part of your app's logout process.