Smartlook records user interaction sessions. Every session has a single user and a single user can have multiple sessions. For more information on users, see Life cycle, session, and user.
User identifier
To specify the user identifier:
Smartlook.instance.user.setIdentifier('sample-identifier');
Identifier restrictions
- Identifier cannot be
null
or empty- Maximum length is IDENTIFIER_MAX_LENGTH.
User name and email
You can set the name
and email
properties directly:
Smartlook.instance.user.setUserName('John Doe');
Smartlook.instance.user.setUserEmail('[email protected]');
Both
user.email
anduser.name
act as an alias. They are added touser.properties
undername
and
User properties
User properties can be edited using a properties
singleton:
Smartlook.instance.user.properties;
Properties API
Full documentation on using
put
,get
, andremove
properties 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();
New user session
Opening a new user opens a new session. For more information, see Life cycle, session, and user.
User URL
The URL
of the currently recorded user can be obtained:
final String? userUrl = await smartlook.user.geUrl();
Nullability and shareability
The
URL
is only available when the SDK is able to communicate with the Smartlook backend. Otherwise, it isnull
.The
URL
is not publicly sharable. You must log in to the dashboard.
User Listeners
A listener can be registered to listen to the visitor URL changes:
Smartlook.instance.eventListeners.registerUserChangedListener((){
//TODO
});
Multiple listeners
Multiple
User.Listener
can be registered and work in parallel.