Skip to content

Identifying visitors

Use identify() to attach an identity and custom attributes to the current visitor. Standard fields are promoted to the visitor profile; everything else is stored as custom attributes and shown to your agents.

js
window.laneChat.identify({
  email: '[email protected]',   // standard field -> promoted to the visitor profile
  name: 'Jane Doe',         // standard field
  phone: '+1 415-555-2671', // standard field
  plan: 'pro',              // custom attribute -> stored as-is, visible to agents
  seats: 12,
})

setFromData(data) is a historic alias of identify() with identical behavior.

Behavior contract

  • In-place and fire-and-forget. identify() never remounts the widget and never drops the session.
  • Idempotent. An identical payload is a no-op.
  • Callable any time. Before the widget mounts, calls are buffered on window.from_data; after a session exists, they are pushed to the server via POST /chat/context.
  • Prefer it over remounting. To update visitor data, always call identify() — never destroy() + init().

Standard fields

These keys are promoted to dedicated columns on the visitor profile. Keys are case-insensitive, and - or spaces are read as _ (so Email Address and email_address are the same key).

Profile fieldAccepted keysValidation
emailemail, email_addressMust be a valid email address
phonephone, phone_numberNormalized to +?digits (7–15 digits)
namenameTrimmed, must be non-empty

Promotion rules (server side)

  • Fill-if-empty. A standard field is written only when that profile column is currently empty.
  • Conflicts leave an audit trail. A differing, non-empty email or phone is appended to traits.captured_contacts (source from_data); the existing column is never overwritten. name conflicts are ignored (no trail).
  • Invalid values are silently skipped — never an error, never a block.
  • Non-standard keys are stored verbatim in from_data as custom attributes, and are never promoted to columns.

Knowing what was applied

Both the session init response (POST /chat) and the context update response (POST /chat/context) include data.from_data_applied: an array naming the columns that were just written, a subset of ['email', 'name', 'phone'].

Custom attributes

Any key that is not a standard field is stored as-is and surfaced to agents in the visitor panel — the same "push data" pattern you may know from other tools:

js
window.laneChat.identify({
  plan: 'enterprise',
  mrr: 4200,
  signup_date: '2026-01-14',
  account_id: 'acct_9f12',
})

Agents see plan, mrr, signup_date, and account_id alongside the conversation.

Native apps

The iOS and Android SDKs expose the same concept as identify(userId:traits:). Traits are forwarded into the in-app chat and shown to agents, and the SDK also binds an external_user_id so one device maps to one visitor identity across native and web. See Native SDK.

Lane.Chat — AI customer support, multichannel CRM, and roleplay AI.