Using the SDK
Learn how to identify users, update their details, and clear them from Rdentify.
Identifying a User
It is recommended to identify a user upon a successful login. Use the following method to identify a user:
_rdentify.setUser(<customer-id>, <optional-properties-object>);
customer-id
: A unique ID set by you to identify the customer in both Rdentify and your own systems.optional-properties-object
: An optional object containing up to three properties:firstName
,lastName
, andemail
.
Example
_rdentify.setUser('12345', { firstName: 'John', lastName: 'Doe', email: '[email protected]' });
As soon as a customer has been identified, Rdentify will look for interactions and automatically interact with the customer if there are any pending ones. If you want to control the location of when a popup is shown, you should use setUser() and clearUser() functions between pages or in areas where you want interactions to show.
Updating a User
To update a user’s details, use:
_rdentify.updateUser(<properties-object>);
The properties-object
takes the same properties as the optional-properties-object
in setUser
.
Example
_rdentify.updateUser({ firstName: 'Jane', lastName: 'Doe' });
Clearing a User
To clear a user, generally upon logout, use:
_rdentify.clearUser();
This will clear the user from the frontend and Rdentify will stop monitoring the user.