Setup Chat Widget
Get the embed code for your chat widget and configure its appearance. Access it from Admin > Widget Setup in your admin panel.
Embed Code
Add a floating chat widget to any website. The widget appears as a button in the corner of the page that expands into a full chat interface when clicked.
Simple Integration
Add this single line to your HTML, just before the closing </body> tag:
<script src="https://[your-subdomain].xinfer.ai/widget.js" async></script>
Replace [your-subdomain] with your subdomain (e.g., mycompany).
Advanced Integration - Data Attributes
Pass customer information using HTML data attributes:
<script
src="https://[your-subdomain].xinfer.ai/widget.js"
data-customer-id="12345"
data-customer-name="John Doe"
data-customer-email="john@example.com"
data-customer-phone="+1-555-123-4567"
data-position="bottom-right"
async
></script>
Advanced Integration - JavaScript Configuration
For more control, use JavaScript configuration with callback support:
<script>
window.XInferChat = {
customerId: "12345",
customerName: "John Doe",
customerEmail: "john@example.com",
customerPhone: "+1-555-123-4567",
position: "bottom-left",
onReady: function () {
console.log("Chat widget is ready");
},
};
</script>
<script src="https://[your-subdomain].xinfer.ai/widget.js" async></script>
Configuration Options
| Option | Data Attribute | Description |
|---|---|---|
| Customer ID | data-customer-id | Your internal customer identifier for session linking and analytics |
| Customer Name | data-customer-name | Pre-fills the name field in follow-up forms |
| Customer Email | data-customer-email | Pre-fills the email field in follow-up forms |
| Customer Phone | data-customer-phone | Pre-fills the phone field in follow-up forms |
| Position | data-position | Widget position: bottom-right (default) or bottom-left |
Widget Config
The Widget Config section in your admin panel lets you customize the widget's appearance and behavior:
- Logo - Upload a custom logo displayed for the full web chat
- Favicon - Custom favicon for the full web chat
- Colors - Primary color theme for the widget
- Greeting - Welcome message shown when the widget opens
- Suggested Actions - Clickable prompts that appear in the widget
Changes to widget config take effect immediately for new visitors.
Activating the Widget
After embedding the script on your website:
- Visit your website in a browser
- Look for the chat button in the bottom corner
- Click it to open the chat interface
- Test a conversation to verify everything works
Programmatic Control
When using JavaScript configuration, you can control the widget programmatically:
// Open the chat widget
window.XInferChat.open();
// Close the chat widget
window.XInferChat.close();
// Toggle the chat widget
window.XInferChat.toggle();
Full Chat Interface
In addition to the embeddable widget, your AI agent has a full-page chat interface at:
https://[your-subdomain].xinfer.ai
Use this URL for:
- Sharing on social media
- Adding to email signatures
- Linking from your website's navigation
- QR codes for print materials
Best Practices
- Use customer data - Pass customer information when available to provide personalized experiences and pre-fill forms
- Position carefully - Choose a widget position that doesn't overlap with other UI elements on your site
- Load asynchronously - Always include the
asyncattribute to prevent the widget from blocking page load - Test thoroughly - Test the widget on different devices and screen sizes before going live
Troubleshooting
Widget not appearing?
- Check that the script URL is correct
- Verify your subdomain is active
- Check browser console for JavaScript errors
Customer data not showing?
- Ensure data attributes are spelled correctly
- Check that values don't contain special characters that need escaping
Widget in wrong position?
- Verify the
data-positionattribute value - Check for CSS conflicts with
position: fixedelements
Related Pages
- Setup AI Agent - Configure your AI agent
- Chat Clients - Full chat vs widget comparison
- URL Reference - Quick reference for all URLs