Skip to content
Ask a question in your own words

Identify logged-in visitors in the chat widget

Tell Mando who a signed-in visitor is so your agent knows them, clear that identity on sign out, and fix the most common reason identify seems to do nothing.

Written by: Sherif Mahmoud2 hours ago3 min read

If visitors sign in to your website, you can tell Mando who they are. Your agent then knows their name and details without asking, and their conversations are attached to the right person.

Identify a visitor

After your page knows who is signed in, call:

MandoCS('identify', {
  id: user.id,
  email: user.email,
  name: user.name,
  phone: user.phone,
  metadata: {
    plan: user.plan,
    company: user.company
  }
});

Only id is required. Everything else is optional, and metadata takes any extra details you want your team to see.

The dashboard gives you a ready made version of this on the Logged-in User tab of the install card.

Include the email address

This is the single most useful thing on this page.

Passing an id alone is accepted, but a contact record is only created and linked when you also pass an email. If you identify with just an id, nothing errors and nothing appears to be wrong, but the visitor is never connected to a person in your workspace.

So if identify looks like it is doing nothing, check that you are sending an email first.

Clear the identity on sign out

When a visitor signs out, call:

MandoCS('reset');

This clears the stored identity and starts a fresh conversation, so the previous chat is no longer reachable from that browser. That is what you want on a shared computer, and it is worth knowing before you call it anywhere else.

Update details later

To add or change extra details after identifying, call MandoCS('updateMetadata', { ... }). It merges with what is already there rather than replacing it.

It only works after a successful identify. Called before one, it does nothing and notes a warning in the browser console.

If identify is not working

  1. Are you sending an email? Without one, no contact is linked. This is the usual answer.

  2. Is there an id? A missing or empty id stops the call, and the browser console says so.

  3. Is your data ready? Calling identify with values that are still undefined sends nothing useful. Call it once your user data has loaded.

Calling identify early is safe in itself. The snippet queues calls made before the widget finishes loading and applies them once it is ready, so timing alone is rarely the problem.

What else you can call

The widget accepts a small set of commands: identify, reset, updateMetadata, open, close and toggle. Both forms work, so MandoCS('open') and MandoCS.open() do the same thing.

There is no command for sending a message on the visitor behalf.

A note on trust

Mando accepts the details your page sends as they are. Only send identity details from pages where you have already checked the visitor is signed in, and never from a page anyone can reach.

Frequently asked questions

Can I open the widget from a link?

Yes. Adding #mandochat to a URL opens it, and #mandochat=your%20text also fills the message box. The text is not sent automatically.

Does reset delete the conversation?

It starts a new one. The old conversation stays in your inbox.

Are there events I can listen for?

The widget signals when it is ready, but there is no general event API.

Related articles

Did this answer your question?

More Support

Get more support from us