Identifying Your Users
Beta release
With the user identification feature of the Sauce Mobile Beta SDK, you can enhance your testing and debugging process by efficiently correlating session recordings with specific users and their traits. This capability empowers you to gain deeper insights into how different users interact with your app and aids in the diagnosis of user-specific issues during testing.
Example Configuration
Below are code examples illustrating how to use the SDK's setUserId method on various platforms:
- Android
- iOS
- React Native
TestFairy.setUserId("<userId>");
// Be sure to import the SDK
import com.testfairy.TestFairy;
TestFairy.setUserId("john@example.com");
[TestFairy setUserId:@"<userId>"];
// Be sure to import the SDK
#import "TestFairy.h"
[TestFairy setUserId:@"john@example.com"];
import TestFairy
TestFairy.setUserId("john@example.com")
TestFairy.setUserId("<userId>");
// Be sure to import the SDK
import TestFairy from '@saucelabs/mobile-beta-react-native';
TestFairy.setUserId("john@example.com");
Where userId is a string representing an association to your backend. We recommend passing values such as email, phone number, or user ID your app may use. This value may not be nil and is searchable via API and web search.
Important Notes
To make the most effective use of user identification, keep the following in mind:
setUserIdis the supported identity API. Call it with a non-null value chosen from user attributes such as email, phone number, or the user ID your app uses.- You can call
setUserIdmultiple times to update the identifier, before or after starting a session withbeginWithoutCrashHandler(orbegin). - The user identifier you set with
setUserIdis searchable through the Sauce Labs Mobile App Distribution API and web search interface. setCorrelationIdandidentifyare deprecated. They write the same user-identity field thatsetUserIdwrites (on Android, only the first call per session takes effect), so they overwrite, or are overwritten by, your real user ID. Replaceidentify(id, traits)withsetUserId(id)plus onesetAttributecall per trait. See Session Attributes.- Do not use
setCorrelationIdoridentifyfor the Backtrace (Sauce Labs Error Reporting) correlation id. The value that links a Backtrace crash report to a Sauce Mobile Beta session is the session attributesauce.correlation_id, set withsetAttributebefore the session starts and sent to Backtrace as well. KeepsetUserIdfor the real user. See Using Sauce Mobile Beta with Backtrace and Reserved Attributes for Backtrace Coexistence.