Skip to content

Identify, set and reset: which to call when

Three calls, one job each, and the one that causes trouble if you forget it.

The whole JavaScript API is five calls. Three of them are about who the visitor is.

Call When
identify You have just learned who this is.
set You already told us, and something changed.
reset They signed out.

identify

On page load for a signed-in user, with their id and whatever details you have. Calling it again with the same id is harmless.

Talkfront('identify', { id: 'usr_1042', name: 'Marcus Webb' });

If you are signing the id, the hash goes here too. See verifying identity.

set

For changes during a session. It updates the person you already identified and does not start a new one.

Talkfront('set', { plan: 'Trade account' });

Calling set before any identify is not useful: there is nobody to attach it to.

reset

The one people forget, and the one that matters.

Talkfront('reset');   // in your sign-out handler

On a shared machine, a signed-out session that was never reset leaves the previous person identified. The next visitor opens the chat and your agent sees somebody else’s name, and possibly their history. Call reset wherever you clear your own session, not only on the sign-out page.

Calling them before the widget has loaded

The snippet is async, so for a moment after the page starts Talkfront is not defined yet and calling it throws. Anywhere that runs after the page has settled (a click, a route change, the end of your own setup) is fine as it is.

To call it earlier than that, add the small queue stub described in opening the chat from your own button. It collects calls until the loader arrives and then replays them in order.

The other two

open and close drive the chat window from your own code, for example a “Chat to us” button of your own:

document.querySelector('#help').addEventListener('click', () => Talkfront('open'));

Rules worth knowing

  • You can pass the same details as data-user-* attributes on the snippet itself, which is easier when your templates already know who is signed in. Where both are used, the JavaScript API wins over the attributes.
  • A later call wins over an earlier one, field by field.
  • Every field is validated and length-limited on our side.
  • Identity is context for a conversation, not an authorisation decision. Do not use it to gate anything sensitive in your own product.
  • Only send what an agent genuinely needs. It is customer data, and the fewer copies of it that exist, the better.

Last updated 22 September 2026.