Website Embed¶
Add your AI chatbot to any website with a simple script tag.
Quick Setup
Add this before</body> and you're done!
Overview¶
Website embedding allows you to add your Functional AI chatbot to any website, regardless of platform. Simply add a script tag to your HTML.
Benefits¶
- Universal compatibility - Works on any website
- Simple setup - One line of code
- Automatic updates - Widget updates automatically
- Full customization - Appearance syncs from dashboard
Prerequisites¶
Before embedding:
- Functional AI account
- Configured assistant
- Assistant set to public
- Access to your website's HTML
Getting the Embed Code¶
Step 1: Make Assistant Public¶
- Go to Assistants
- Select your assistant
- Toggle Assistant Privacy to public
Step 2: Get the Code¶
- Click Manage Assistant
- Go to the Sharing tab
- Find the Website Integration section
- Copy the script code
The Embed Code¶
<script
src="https://app.functionalai.com/chatbot.js"
data-token="your-unique-token"
defer>
</script>
Token Security
The token identifies your assistant. While it's public-facing (embedded in your website), treat it as you would any API key.
Installation¶
Basic Installation¶
Add the script before the closing </body> tag:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<!-- Your website content -->
<!-- Functional AI Chatbot -->
<script
src="https://app.functionalai.com/chatbot.js"
data-token="your-unique-token"
defer>
</script>
</body>
</html>
Platform-Specific Instructions¶
- Go to Appearance > Theme Editor
- Select
footer.php - Add the script before
</body>
Or use "Insert Headers and Footers" plugin.
- Settings > Custom Code
- Add Custom Code
- Set placement to "Body - end"
- Apply to "All pages"
- Settings > Advanced > Code Injection
- Paste in Footer section
- Project settings > Custom Code
- Paste in Footer Code section
Simply add the script before </body> in your layout template.
Widget Behavior¶
Default Position¶
Bottom-right corner of the viewport.
Appearance¶
Matches your customization settings from the Functional AI dashboard.
Mobile Responsive¶
The widget adapts to mobile screens automatically.
Persistence¶
Conversation history is maintained during the browser session.
Customization¶
Widget appearance is controlled from your Functional AI dashboard:
- Go to Assistants
- Select your assistant
- Click Appearance tab
- Customize colors, theme, avatars
- Save
Changes sync automatically to all embedded widgets.
See Customization for details.
Testing Your Embed¶
Verify Installation¶
- Open your website
- Look for the chat bubble (bottom-right)
- Click to open the chat
- Send a test message
Troubleshooting Steps¶
If the widget doesn't appear:
- Check the script placement - Should be before
</body> - Verify the token - Copy fresh from dashboard
- Test in incognito - Eliminates cache issues
- Check browser console - Look for errors
Browser Console Check¶
- Open Developer Tools (F12 or right-click > Inspect)
- Go to Console tab
- Look for errors related to the chatbot script
- Check Network tab to verify script loaded
Advanced Configuration¶
Loading on Specific Pages¶
To show the widget only on certain pages, add conditional logic:
<script>
if (window.location.pathname === '/support') {
const script = document.createElement('script')
script.src = 'https://app.functionalai.com/chatbot.js'
script.setAttribute('data-token', 'your-unique-token')
document.body.appendChild(script)
}
</script>
Multiple Assistants¶
For different assistants on different pages, use different tokens:
<!-- Support page -->
<script data-token="support-assistant-token" ...></script>
<!-- Sales page -->
<script data-token="sales-assistant-token" ...></script>
Troubleshooting¶
Widget Not Appearing¶
| Issue | Solution |
|---|---|
| Script not loading | Check placement before </body> |
| Wrong token | Copy fresh token from dashboard |
| Assistant private | Make assistant public |
| Cache | Test in incognito mode |
| JS errors | Check browser console |
Widget Appears But Won't Open¶
- Check for CSS conflicts (z-index issues)
- Look for JavaScript errors
- Test in a different browser
Style Conflicts¶
If your site's CSS affects the widget:
- The widget uses scoped styles
- Check for overly broad CSS selectors
- Use browser inspector to identify conflicts
- Contact support for advanced issues
Best Practices¶
Do¶
- Test thoroughly before going live
- Use incognito mode for testing
- Keep your token secure
- Monitor conversations after launch
Don't¶
- Add multiple instances of the script
- Modify the script src URL
- Cache the script locally (use CDN)
- Forget to make assistant public