Visitor Identification API
What It Does
When you use the Identify API, LiveChatAI will:
- Match or create a Contact based on the provided data
- Populate the userβs Contact Attributes
- Enable attribute-based logic for:
-Behind-login user identification
-Segment-based content targeting (Enterprise only)
π
Contact Attributes are not used directly in chatbot responses but play a critical role in user segmentation and authentication workflows.
How to Use It
Place the identify call before your chatbot initializes:
window.liveChatAI("identify", {
distinctId: "user-123",
email: "[email protected]",
name: "Jane Doe",
phone: "+11234567890",
attributes: {
plan_type: "pro",
total_spent: 1200,
is_trial: false,
userTestId: "123"
}
});
The attributes object accepts any custom Contact Attributes you've already defined in your dashboard.
Supported Attribute Data Types
- You can only pass attributes that already exist in your dashboard.
- New attribute keys must be created manually under Contacts > Attributes.
TypeScript Integration
If you're using TypeScript, define the structure as follows:
Interface
interface IdentifyEventData {
distinctId: string;
email?: string;
name?: string;
phone?: string;
attributes?: {
[key: string]: string | number | boolean;
};
}
Global Declaration
declare global {
interface Window {
lc: {
identity?: IdentifyEventData;
debug?: boolean;
};
}
}
Use Cases
- Authenticated sessions: identify logged-in users and show personalized flows.
- Segment targeting: enable dynamic content delivery via Segments (Enterprise only).
- Data enrichment: pre-fill user data in the inbox for more context and support continuity.
Best Practices
- Always call identify before chatbot initialization
- Make sure attribute keys already exist in your dashboard
- Avoid sending sensitive user data like passwords or personal identifiers
- Use distinctId consistently across sessions for accurate user tracking
For help setting up the Identify API or managing Contact Attributes, contact us at [email protected].