By default every conversation in your dashboard is Anonymous. The widget knows the browser tab it is running in, not the person using it.
If your site already knows who is signed in, pass that to the widget. Conversations then show a name instead of "Anonymous", and searching the conversation list for an email finds every chat that person had.
window.KookeeChat.identify({ id: user.id, email: user.email, name: user.name });
All three fields are optional. Send whichever you have.
What it changes
The Visitor column in your project's Site widget → Conversations list shows the name, or the email if there is no name.
The conversation detail page shows all three fields under the title.
The conversation search matches the visitor's name and email, alongside titles and message text. So "who has been asking about refunds" and "what did alice@example.com ask" are both one search.
On Home, their first name goes above the greeting.
On the Feedback tab, the email field starts filled in, and a message they send carries their name and id, so you see who wrote it when you review it.
Nothing else. It does not change the answers.
React
Pass the visitor prop. It works on KookeeChatWidget, KookeeChat and KookeeChatProvider:
import { KookeeChatWidget } from '@kookee/react/chat';
<KookeeChatWidget
clientOptions={{ apiKey: 'YOUR_API_KEY' }}
visitor={user ? { id: user.id, email: user.email, name: user.name } : null}
/>;
clientOptions also takes a projectId in place of the key, but only while the project's hosted portal is enabled; without it the API answers 403 PORTAL_NOT_ENABLED.
The user ? … : null shape matters. See Signed out means null below.
Script tag
identify() and reset() are on the window.KookeeChat global:
<script>
// after your own login completes
window.KookeeChat.identify({ id: user.id, email: user.email, name: user.name });
// on logout
window.KookeeChat.reset();
</script>
You can also pass it to init() when the page already knows the user at load:
window.KookeeChat.init({
apiKey: 'YOUR_API_KEY',
visitor: { id: user.id, email: user.email, name: user.name },
});
identify() works before init(), so the order of the two does not matter. If you use the queueing stub, add both methods to its list:
<script>
window.KookeeChat = window.KookeeChat || (function () {
var stub = { _q: [] };
['init', 'open', 'close', 'toggle', 'sendMessage', 'stop', 'clearMessages', 'identify', 'reset', 'setTheme', 'setLocale', 'on', 'destroy']
.forEach(function (m) { stub[m] = function () { stub._q.push([m, [].slice.call(arguments)]); }; });
return stub;
})();
</script>
Signed out means null, not nothing
The widget treats three values differently, and the difference is what makes asynchronous login work:
undefined— "I have not told you yet." Nothing happens. The conversation is left alone.null— "Nobody is signed in." The conversation is discarded and a new session starts.reset()does this.An object — "This person is chatting." They become the owner of the conversation.
Most apps do not know the user on the first render. They fetch /me, and only then can they identify anyone. Because undefined means "not told", that first render never wipes a conversation restored from a previous page. If undefined and null meant the same thing, every page load would throw the chat away before your session check finished.
So: leave it undefined while you are still loading, and pass null once you know nobody is signed in.
const { user, isLoading } = useSession();
<KookeeChatWidget
clientOptions={{ apiKey }}
visitor={isLoading ? undefined : user ? { id: user.id, email: user.email } : null}
/>;
When the conversation is discarded
A conversation belongs to whoever was identified while it was written. When that changes, the widget starts a fresh one: new session, cleared history, nothing carried over.
Conversation belongs to | You pass | What happens |
|---|---|---|
nobody |
| kept |
nobody | Alice | kept, and Alice becomes the owner |
Alice |
| kept |
Alice | Alice | kept |
Alice | Bob | discarded, Bob becomes the owner |
Alice |
| discarded |
nobody |
| kept |
Two rows deserve a note.
Nobody → Alice keeps the conversation. Someone browsing anonymously who asks two questions and then signs in does not lose their chat. It becomes theirs.
Nobody → null keeps it too. There is no one to protect it from. This is why a site that renders visitor={user ?? null} on every page does not wipe an anonymous visitor's chat on every navigation.
Identity is compared on id first, then email. A name on its own identifies nobody, so changing only the name never discards anything.
It is a label, not a login
Two limits worth being explicit about.
It is never verified. The identity is whatever your page sends. Anyone can open developer tools and call identify() with someone else's email. Use it to label conversations and to search them. Never use it to decide what the assistant is allowed to reveal. If the assistant needs to answer from a specific person's data, do that with a tool — a tool handler runs in the visitor's own browser with their own session, so your server does the authenticating, as it already does for the rest of your site.
It is never sent to the model. The assistant does not see the name or the email, and cannot greet the visitor by name because of it. That is deliberate: it keeps personal data out of the model request. If you want the assistant to know something about the person, put it in appContext, which is the field meant for that:
window.KookeeChat.init({
apiKey: 'YOUR_API_KEY',
visitor: { id: user.id, email: user.email, name: user.name }, // for your dashboard
appContext: { firstName: user.firstName, plan: user.plan }, // for the assistant
});
Privacy
The visitor you pass is stored with the conversation, which Kookee keeps for 90 days before deleting it. A message sent from the Feedback tab keeps the name, id and email it was sent with; one your team neither adds to the board nor links to a post is deleted after 90 days too. If you pass an email address, that is personal data on your users, so say so in your privacy policy — the same sentence that already covers your chat transcripts.
If you would rather not store an email, pass only id. An opaque id from your own system is meaningless to anyone without your database; the transcript shows it, but the conversation list shows the visitor as Anonymous and search does not match ids.
Limits
Each field is trimmed and capped at 250 characters. Longer values are rejected rather than truncated, so an oversized value fails loudly instead of being silently cut.
An object whose fields are all empty ({ id: '', name: '' }) counts as no visitor at all, so a template that renders empty strings before login does not create a nameless identity.
Requirements
visitor, identify() and reset() need @kookee/react 1.7.0 with @kookee/sdk 1.7.0. The script tag at https://kookee.dev/chat/latest.js always serves the current version, so it already has them.