The identify method allows you to create a consistent chat experience for known Live Chat visitors on your site.
In this guide, we will outline the different types of Live Chat visitors on the Omnichannel Widget, how to identify these users to create a consistent conversation across devices and browsers, and how to logout and reset users.
There are two different types of Omnichannel Widget users: Anonymous and Identified users. When a user interacts with the Omnichannel Widget, we will first create an Anonymous user within the Omnichannel Widget.
This creates a frictionless experience for users who would like to start a conversation with you via the Omnichannel Widget.
This session is stored via client-side storage, within the browser. This means that if the user returns to your site, or accesses your site via a different tab, they will be considered the same visitor and will see the same chat.
However, if they use a different browser, or if they attempt to chat again on another device, they would be considered a separate user, and would therefore be unable to see the chat.
If you would like your users to have a consistent conversation history, you can use the identify() in javascript to make sure that they are considered the same user, regardless of how they access your site.
The most common use case for the identify method is to keep the Omnichannel Widget aligned with your own site’s login system.
If a user logs in to your site, you can pass the identifier of that user from your business’s system to create the exact same user in Live Chat. This Live Chat user profile can then be passed to Flow Builder or Inbox to be used by the team.
It's important to outline the difference between the Identify and the setAttributes method.
setAttributes will allow you to set an attribute as a userID and pass it, so that your Inbox agents can receive custom information that they can use when handling inquiries. identify will allow you to create a static user based on the identifier that is passed. If an anonymous visitor with some custom attributes changes devices or attempts to engage a conversation on the Omnichannel Widget after a period of time, they will create a new ticket in Inbox as a new user and they will also not see their previous conversations.
The identify method takes a static ID as a string which you can pass to identify a user. This ID will replace the session ID of the anonymous visitor created by the Omnichannel Widget.
Please make sure to keep the ID that you pass private, as anyone who knows this ID can use this to log in as the identified user and view their conversation history
Please make sure that the identifier is unique. If there is an overlap between user identifiers on your Omnichannel Widget then they could be able to see the conversations of the other user with the same identifier
window.MessageBirdChatWidget.identify('123-456-789');
It is also possible to setAttributes at the same time, for example, if a user has just signed up and you want to pass extra information to identify them in Inbox. Please see our guide here for more information on setAttributes.
window.MessageBirdChatWidget.identify('123-456-789', {email: "hello@test.com",phone: "+31 123 456 789",premiumUser: true,itemsInCart: 2})
Once the identify method has resolved the user of the Live Chat will use the ID you passed in the params of the method as its identifier.
The logout method will reset the Omnichannel Widget, removing all stored data about the Live Chat visitor’s session. The Omnichannel Widget will then create a new anonymous user.
window.MessageBirdChatWidget.logout()