By default, Yaplet treats every browser session as an anonymous visitor. That means your team sees "Visitor 1234" instead of a real name, and the same customer starts a fresh conversation every time they log in. Calling Yaplet.identify() once per session fixes this: the widget shows
the user's name, links all their past conversations, and lets you filter your inbox by plan, company, or any custom property you send.
Prerequisites
- The Yaplet snippet is already installed. If not, start with Install Yaplet with the JavaScript snippet.
- You have a server-side session that knows the current user's ID and email.
Basic usage
Call Yaplet.identify() after your page loads and your user session is available. Pass the user's unique ID as the first argument and an object with their details as the second:
Yaplet.identify("user-123", {
name: "Jane Smith",
email: "[email protected]",
phone: "+1 555-0100",
createdAt: new Date("2024-03-15"),
plan: "pro",
companyId: "acme-001",
companyName: "Acme Corp",
});
All fields except userId (the first argument) are optional, but the more you send, the more context your team has when a conversation comes in.
Standard fields
| Field | Type | Description |
|---|---|---|
name |
string | Full name shown in the inbox and on the visitor profile. |
email |
string | Contact email. Enables email follow-ups after a chat. |
phone |
string | Phone number in E.164 format (e.g. +14155550100). |
value |
number | Lifetime value in your currency. Shown on the visitor sidebar. |
companyId |
string | Your internal company identifier for B2B filtering. |
companyName |
string | Company display name. |
plan |
string | Subscription plan name (e.g. "free", "pro", "enterprise"). |
sla |
number | Target response time in hours for this user. Highlights SLA-sensitive conversations. |
createdAt |
Date | When the user signed up. Useful for cohort-based support rules. |
Custom attributes
Any data that doesn't fit the standard fields goes into customData. These are free-form key-value pairs:
Yaplet.identify("user-123", {
name: "Jane Smith",
email: "[email protected]",
customData: {
subscriptionStatus: "trialing",
trialEndsAt: "2026-06-15",
accountRegion: "EU",
featureFlagsEnabled: ["ai-phone", "affiliate"],
},
});
Custom attributes appear on the visitor sidebar in the inbox, and your team can filter conversations by them.
Where to call identify()
Call it as soon as your app knows who the current user is β typically right after your authentication check resolves. In a single-page app this is usually in your root component or auth store. In a server-rendered app you can inline it in the page response.
You can call Yaplet.identify() at any point after the snippet runs β even before the SDK has fully loaded. The snippet queues the call and replays it once the SDK is ready.
Logging out
When a user logs out of your app, clear their Yaplet identity so the next visitor doesn't inherit their conversation history:
Yaplet.clearIdentity();
What's next
With identification in place, your team can see who they're talking to the moment a conversation comes in. Check that everything is working with Verify your installation.