Smartlook records user interactions sessions. Every session has a single user and a single user can have multiple sessions. For more information on users, see Life Cycle, Session, User.
User identifier
To specify the user identifier:
Smartlook.instance.user.identifier = "sample-identifier"Smartlook.getInstance().getUser().setIdentifier("sample-identifier");
Identifier restrictions
- Cannot be null or empty
- Maximum length is 120 characters.
User name and email
The name and email properties can be directly set using:
Smartlook.instance.user.name = "John Doe"
Smartlook.instance.user.email = "[email protected]"Smartlook.getInstance().getUser().setName("John Doe");
Smartlook.getInstance().getUser().setEmail("[email protected]");Both
user.nameanduser.emailact as an alias. They are added touser.propertiesunder thenameand
User properties
User properties can be added as a properties object:
Smartlook.instance.user.propertiesSmartlook.getInstance().getUser().getProperties();
Properties APIFull documentation on using
put,get, andremoveproperties can be found in the properties section.
Opening a new user
The current user can be closed and a new user opened:
Smartlook.instance.user.openNew()Smartlook.getInstance().getUser().openNew();
New user sessionOpening a new user opens a new session. For more information on user sessions, see Lifecycle, Session, User.
User URL
The URL of the currently recorded user can be obtained:
val userURL = Smartlook.instance.user.urlURL userURL = Smartlook.getInstance().getUser().getUrl();
Nullability and shareabilityThe
URLis only available when the SDK is able to communicate with the Smartlook backend. Otherwise, it isnull.The
URLis not publicly sharable. You must log in to the dashboard.
User Listeners
A listener can be registered to listen for visitor URL changes:
Smartlook.instance.user.listeners += object : User.Listener {
override fun onUrlChanged(url: URL) {
// Called when user URL changes
}
}Smartlook.getInstance().getUser().getListeners().add(
url -> {
// Called when user URL changes
}
);
Multiple listenersMultiple
User.Listenercan be registered and work in parallel.
