NativebrikUser
Definition
public class NativebrikUser {
public var id: String { get }
public var retention: Int { get }
public func set(_ properties: [String: String])
public func comeBack()
public func debugPrint()
}
.id
This value will be sent to Nativebrik server to collect data for experiments. For this reason, it's noted that setting privacy data as user id is not recommended.
NativebrikUser
has user id as property with uuid format by default. And you can get user id:
get user.id
let userId: String = nativebrik.user.id
Optionally, you can set custom user id:
set userId
nativebrik.user.set(["userId": "<CUSTOM_USER_ID>"])
.retention
user.id
let retention: Int = nativebrik.user.retention
.set
This properties are used to filter which users will be the target of the experiment.
You can set user properties:
set user properties programmatically
nativebrik.user.set(["<KEY>": "<VALUE>"])
.debugPrint
You can print user properties for debugging:
debugPrint
nativebrik.user.debugPrint()
.comeBack
.comeBack
will be called automatically when user comes back from background to foreground. Basically you don't need to call .comeBack
manually.
.comeBack
computes user's retention period.
debugPrint
nativebrik.user.comeBack()
Built-in user properties
By default, these are built-in properties:
Key | Description |
---|---|
userId | User id (uuid by default) |
languageCode | language code (e.g. en for English, fr for French) ISO 639-1 |
regionCode | region code (e.g. US for United States, GB for United Kingdom) ISO 3166-1 |
sdkVersion | nativebrik sdk version |
osName | os name (e.g. iOS, iPadOS) |
osVersion | os version (e.g. 15.3.2) |
appVersion | your app version (e.g. CFBundleShortVersionString for Apple platforms) |
cfBundleVersion | your apple app CFBundleVersion |