Skip to main content
All CollectionsInstalling FullSession
FS.identify - Identifying users
FS.identify - Identifying users

Use FUS.identify to distinguish and describe your users as well as introduce your own custom per-user properties.

Updated over a year ago

You'll need a little of JavaScript to use the FUS.identify function every time a page or screen loads from a user you can identify in order to associate your own application-specific id with the active user. This will be referred to as the username throughout this essay (unique username).

FUS.identify(username); // username is a string containing a unique identifier for the current user

FullSession uses local storage to keep user identification, which cannot be changed until the user deletes the matching item purposefully. FUS.identify enables FullSessions to associate the current local storage item with the user because your application knows them uniquely. FUS.identify accepts a string representing a unique identifier (USERNAME) to be used in the backend to distinguish users from one another and to link sessions with their associated users. This identifier could be the username created by the application when it uses FullSession.

We use the term USERNAME to refer to your app's id for a given user.

FUS.identify should not be used for anonymous or visitor users because you do not know who they are (however, you can still attribute custom variables to unidentified users with FUS.setSessionAttributes).

Attempting to call FUS.identify on an already-identified user changes the user information associated with the session but does not result in the sessions being split into two. FullSession does not understand the username, yet it is a good search condition.

Best practices for choosing a username:

There are a few best practices you should adhere to when choosing usernames for use with FUS.identify.

  • A username should uniquely identify a user within your application, but the username string itself shouldn’t contain personal information or be publicly guessable for a given user.

  • You should generally refrain from using information like email addresses or phone numbers as usernames.

    • Why shouldn't I use an email address for username? For businesses that let users change email addresses and continue using the same user account, using the email address as the username means that if the email address changes, a new user will be created in FullSession for the new email address. This may not be desired behavior. If this behavior is acceptable, it's okay to use email address for username. Otherwise, we recommend using a unique ID from your customer database for username and providing the email address as a user variable instead

  • Additionally, you should only call FUS.identify after a user has successfully authenticated into your application.

Specifying display name and email

FUS.identify accepts an optional second argument: a JSON object containing simple key/value pairs that you'd like to capture for the current user.

FUS.identify('<USERNAME>', { name: '<DISPLAY_NAME_HERE>', email: '<EMAIL_HERE>'});

FullSession has special system fields for name and email. You can supply values for these fields like so:

FUS.identify('<USERNAME>', { name: '<DISPLAY_NAME_HERE>', email: '<EMAIL_HERE>'});

Display names and email addresses will show up automatically the next time you browse your user list in FullSession.

You don't have to specify both display name and email as in the above example; either one is fine.

Did this answer your question?