React app identify users in @livechat/widget-react

Hi. I am using @livechat/widget-react package in my react app. I tried to sign in with different accounts and wrote message. And every time I get the messages in the same chat in my live chat admin bar.
So how can I identify users ?

Hello @Derenik.

LiveChat Chat Widget by default creates a new user identity automatically for a current user session. It means that if you load a widget for your LiveChat licenses in a specific browser your Customer Identity would be reused even if you open a new tab or reload the page. The easiest way to trigger a new Customer Identity is to for example open your App with Chat Widget in Incognito Mode.

Apart from that, could you please explain a little bit deeper what you mean by “I tried to sign in with different accounts and wrote message”? Are those accounts in your App or different LiveChat accounts?

If you are interested in binding your App user account together with LiveChat Chat Widget user identity, so changing the account would also change the Chat Widget user identity then we have a feature exactly for that :slight_smile:

You can read about this feature here: https://developers.livechat.com/updates/livechat-customer-identity-provider/ and if it looks like something you would like to use, then let us know so we will be able to explain it further :slight_smile:

1 Like

@m.walaszczyk Thanks a lot fo your reply.

We have platform that want to see every visitor chat in separated from each other in live chat.
This is the component widget provided from liveChat for react package
<LiveChatWidget
license=“14188500”
sessionVariables={{customerEmail:user.email}}
visibility=“minimized”
sessionVariables={{ customerEmail: user.email }}
/>

I provided in sessionVariables different user emails, but it doesn’t help.

Unfortunately, session variables will not allow transferring the identity of the customer alongside his chat history. They serve as additional information for your Agents using LiveChat Agent App to see on the chats that additional information.

Typically in session variables, you can store identifiers of specific cases like order id or identifiers of specific users like user name, email, id. Thanks to that in case the user will switch devices and try to contact you from different identity you will be able to see that he is the same person even if this is a new chat with the new user identity. You can read more about session variables in our dedicated help center article: Setters configuration | LiveChat Help Center

If you would like to achieve full synchronization between your App users and LiveChat chat users, together with chat history and you would need to use the Custom Identity Provider feature in LiveChat Chat Widget. As I have mentioned before it is a more advanced feature and requires some development on both the client and server sides. We have dedicated documentation for this feature: docs/extending-chat-widget/custom-identity-provider as also we have a public code repository with working example implementation: livechat/identity-provider-example

Hii @m.walaszczyk , I runned the working example but but doesn’t work signup part, but it is nothing.
I only need to identify my visitors by their email address in react based app (your example is next too).
The npm package LiveChatWidget doesn’t have props or something else to do so.
If you know how can I identify my visitors by their email it will fine.

Hi @Derenik,

In case you only need to identify your users by email you can use customerEmail property for LiveChatWidget component. You cna read more about available configuration properties here: React Adapter | LiveChat Platform Docs & API Reference

After adjusting your example it would look like this:
<LiveChatWidget license=“14188500” visibility=“minimized” customerEmail={user.email} />