Setting a User ID
Important: If you subscribe to Singular's Cross-Device solution, you must collect the User ID across all platforms using a sign-in or authentication flow.
Best Practices
- The User ID can be any identifier and should not expose PII (Personally Identifiable Information). For example, you should not use a User's raw email address, username, or phone number. Singular recommends using a hashed value unique only to your first-party data.
- The User ID value passed to Singular should also be the same internal User ID captured across all platforms (Web/Mobile/PC/Console/Offline).
- Singular will include the User ID in user-level exports, ETL, and Internal BI postbacks (if configured). The User ID is first-party data, and Singular does not share it with other parties.
- The User ID value, when set with the Singular SDK Method, will persist until it is unset using the unsetCustomUserId method or until the app is uninstalled. Closing or restarting the app does not unset the User ID.
- Note: If multiple Users use a single device, we recommend implementing a logout flow to set and unset the User ID for each login and logout.
Implementation
To set the User ID, use the setCustomUserId method. To unset it (for example, if the User "logs out" of the account), call unsetCustomUserId.
If you already know the user ID when the app opens, set the customUserId before initializing the Singular SDK. This way, Singular can have the User ID from the first Session. However, the User ID is typically unavailable until the User registers or performs a login. In that case, call setCustomUserId after the registration flow is complete.