Knowing your visitors
Collect details before a chat, identify your logged-in users, and give agents a live customer card so they know who they're talking to.
Knowing your visitors
The more an agent knows about who they're chatting with, the faster they can help. Live Chat gives you three ways to add context.
Pre-chat fields
In Live Chat settings you can choose custom fields to collect before a chat starts — for example a dropdown for "Topic" or a text field for "Order number". They're drawn from your project's shared custom fields, so the same definitions power your widget, forms, and chat.
Visitors fill them in on the pre-chat screen, and the answers carry through to the feedback item the conversation becomes.
Identify logged-in users (Boot API)
If chat runs inside an app where people are signed in, you can tell UserHero who they are. Add a call after the widget script:
<script src="https://userhero.co/chat-widget.js" data-key="pk_live_your_key"></script>
<script>
UserHeroChat('boot', {
user: { userId: 'u_123', email: 'ada@example.com', name: 'Ada Lovelace' },
attributes: { plan: 'pro', signupDate: '2024-02-01' }
});
</script>user— identity fields. An email means the agent (and the converted feedback) can follow up, and it links the conversation to the customer's profile.attributes— anything else useful to your agents (plan, MRR, role…). They show on the conversation and the feedback item.
The Boot API has three methods:
| Method | When to call it |
|---|---|
boot | On page load, with whatever you know. |
identify | After a user logs in (if that happens after load). |
shutdown | On logout — clears the current visitor so the next person starts fresh. |
UserHeroChat('identify', { user: { userId: 'u_123', email: 'ada@example.com' } });
UserHeroChat('shutdown');Verified identity
Anything sent from the browser is, by nature, self-reported. To make identity trusted, sign it on your server and pass the signature along:
UserHeroChat('boot', {
user: { userId: 'u_123', email: 'ada@example.com' },
identity: { payloadJson: '<the exact JSON your server signed>', hmac: '<signature>' }
});Live Chat uses the same signing secret and identity payload as the Embedded Portal, so if you've set that up you're already done. If not, follow:
- Identity payload — what to put in the payload.
- HMAC signing — how to sign it on your server.
Verified identity is optional. Without it, chats still work — the visitor is simply treated as self-reported until they're verified.
The customer card
However identity arrives — pre-chat, the Boot API, or an agent typing it in — if it matches someone you've heard from before, the console shows a customer card: their name, company, attributes, how many feedback items they've sent, and their most recent ones, with a link to the full profile. Agents can also correct or add a visitor's name, email, phone, and notes right from the panel.
This is visible to your team only — it's never shown to the visitor.