Set a user ID
Version:
If your app already assigns a unique ID to each user, you can share this ID with the justtrack SDK. This allows the justtrack backend to associate events received from third parties with the correct user.
If a user’s ID changes, you must provide the new value to the justtrack SDK:
- Android
- iOS
- Unity
- React Native
val userId: String = // get your custom user ID from your app
// Use the builder to set a custom user ID
val sdk = JustTrackSdkBuilder(this, API_TOKEN)
.setUserId(userId)
// other options...
.build()
// Or use an existing JustTrackSdk instance to update the custom user ID
sdk.setUserId(userId)
var userId = /* get your user ID from your app */
// set userId using builder
let sdk = JustTrackSdkBuilder(apiToken: API_TOKEN)
.set(userId: userId)
// other options...
.build()
// or using JustTrackSdk instance
sdk.set(userId: userId)
using JustTrack;
string customUserId = /* get your own user ID from your game */;
JustTrackSDK.SetUserId(customUserId);
await new JustTrackSdk.JusttrackSdkBuilder(apiKey)
.withUserId('new_id')
.initialize();
await JustTrackSdk.setUserId('new_id'); /* new user ID for some reason */
info
The user ID must be shorter than 4096 characters and only consist of printable ASCII characters (U+0020 to U+007E).