User Context allows you to pass information about logged-in users to the AI. When you provide user context, the AI can greet users by name, reference their account details, and provide personalized responses without asking for information you already have.
This creates a seamless experience where the AI already "knows" about the user - their subscription plan, order status, loyalty points, or any other relevant data you choose to share.
How It Works
Enable User Context in your dashboard settings
Add JavaScript to your website that sets user data
AI receives the context with each message the user sends
AI personalizes responses using the provided information
AI Assistant
Where is my order?
Hi Sarah! I just checked your order #8847 — it's out for delivery with FedEx and should arrive today by 5 PM.
Can I upgrade my plan?
Of course! You're currently on the Basic plan with 847 API calls remaining. I can help you upgrade to Pro for additional features and higher limits.
Implementation
Choose the approach that fits your setup:
Output user data directly from your server-side template:
// After user logs in or data loadswindow.Asyntai = window.Asyntai || {};
window.Asyntai.userContext = {
"Customer name": currentUser.name,
"Email": currentUser.email,
"Subscription plan": currentUser.subscription.planName,
"Cart total": cart.total,
"Loyalty points": currentUser.loyaltyPoints
};
// You can update it anytime - changes apply to the next messagewindow.Asyntai.userContext["Cart total"] = newTotal;
Fetch user data only when the chat opens (best for performance):
// Define a function to fetch user contextwindow.Asyntai = window.Asyntai || {};
window.Asyntai.fetchUserContext = function() {
return fetch('/api/your-user-context-endpoint/')
.then(function(response) { return response.json(); })
.then(function(data) {
window.Asyntai.userContext = data;
});
};
// The widget automatically calls this when the chat opens
Best for performance: The widget detects fetchUserContext and calls it automatically when the chat opens, so data is loaded only when needed.
You decide what to share. Pass only the data relevant to your use case - customer name, order status, subscription tier, cart contents, or any other info that helps the AI assist your users better. Use descriptive labels so the AI understands the context.
Example Use Cases
E-commerce
"I can see your order #4521 is currently in transit and should arrive by Friday."
SaaS
"You have 847 API calls remaining this month on your Pro plan."
Support
"I see you're a Gold member with 3 open tickets. How can I help?"
Education
"You're 78% through the JavaScript course. Ready to start Module 8?"
Hospitality
"Your booking for September 17th is confirmed. Check-in starts at 3 PM."
Healthcare
"Your next appointment with Dr. Smith is scheduled for Tuesday at 10 AM."
Important Notes
Optional - The chat works perfectly without user context. It's an enhancement for logged-in users.
Real-time - Context is sent with each message, so you can update it dynamically as user data changes.
Security - Never include passwords, credit card numbers, or other sensitive data. Only pass non-sensitive information.
Size Limits - User context is limited to 2,000 characters on Standard and 10,000 characters on Pro. If exceeded, it will be truncated to fit. Keep your context concise.
Not an access control - User context is set by your page in the visitor's browser, so it must never be what stands between a visitor and restricted content. To restrict which knowledge items a visitor can retrieve at all, use Access Tags (Enterprise) — enforced on our servers with a claim signed by your own back end.
Integration Status
After implementing, visit the User Context settings page to verify your integration is working. The status card will show:
Whether context is being received
Latest message with context
Preview of the context data being sent
Platform Guides
Using a specific CMS or e-commerce platform? We have step-by-step setup instructions for each — pick yours below to jump straight to the guide.