Skip to main content
Version: SDK 5.0.x

Provide your own user ID

If you already have a mechanism to assign a unique ID to each user, you can share this information with the justtrack SDK. This allows the backend of the justtrack SDK to associate events received from third parties via that user ID with the correct user on justtrack side. Should your user ID change for some reason, you have to supply the new value to the justtrack SDK again:

var ownUserId = /* get your own user ID from your app */
let builder = /* create the builder somehow */ JustTrackSdkBuilder(apiToken: "prod-...")
let sdk = builder
.set(userId: ownUserId)
// other options...
.build()

ownUserId = /* new user ID for some reason */
sdk.set(userId: ownUserId)

A custom user ID must be shorter than 4096 characters and only consist of printable ASCII characters (U+0020 to U+007E).