Identify users
Last updated
Last updated
Identifying users enables you to build the full picture of how a person uses your product across different sessions and devices.
Collecting user properties also is crucial for running Workflows and Segmentation where you want to send emails, personalise copy, and target users better.
To identify a user, call the identify
method:
In UserFlux, there are two types of users: Known and Anonymous.
If you have not identified a user yet but are tracking their traffic on your website, this will automatically create an Anonymous user unique to that device.
Identifying a user with a user ID allows you to build up your user base, collect information about your users, as well as stitch any Anonymous users to their associated Known user profile.
Known and Anonymous users are a one-to-many relationship. That is, one Known user can be linked to many Anonymous users.
When you call identify with a user ID, UserFlux will associate the auto-generated Anonymous user to the Known user.
When an Anonymous user is linked to a Known user for the first time, or when an existing linked Anonymous users properties are updated, that information will be merged with the primary Known user profile.
This means the Known user profile will have the most up to date information on any:
Properties defined by you
Device information
Location information
Computed Properties are only calculated for Known users, however when evaluating the Computed Property, UserFlux will take in to account any linked Anonymous user data.
This is useful when using Computed Properties for things such as event roll ups, where you want to aggregate behavioural data from a user.
Having users linked to their Anonymous users is also a helpful data point when crafting user Workflow's.
For example, a classic Workflow for an ecommerce site would be an Abandoned Cart Email. If a anonymous website viewer has previously been linked to a known account, the next time they start a checkout but don't provide any contact details, you will still be able to send them a follow up email.
You should set a user ID once they have created an account, logged in, or is otherwise identified in your product.
Whenever you receive new data from a user, such as age, email, mobile number, you should call identify
with this information as soon as possible.
If two users have the same user ID, their data is merged and they are considered one user in UserFlux.
If you set a user ID in a different case, UserFlux tracks two separate profiles for the same user.
For example, if you set the user ID to the string None
for multiple users, UserFlux doesn't recognize those users as separate users. Instead, it assumes all those users are actually the same user, and it groups all events for those users together under that None
user ID.
You can always set the user ID later.
User IDs are fixed forever: you shouldn't, for example, set a user's email address as their user ID—email addresses change.
If a user logs out on your frontend, you should call reset()
to unlink any future events made on that device with that user.
This is important if your users are sharing a computer, as otherwise all of those users are grouped together into a single user due to shared cookies between sessions.