Agents
Embed
Reference for the website chat widget: styles, options, domain rules, embed methods, JavaScript API, and troubleshooting.
This is the full reference for the Link AI chat widget: every style option, config parameter, embed method, and API call. For the five-minute version, follow the Embed quickstart.
The widget only loads on domains you allow. Add at least one domain in Domain Security Settings before you embed. This blocks unauthorized use, protects your usage limits, and keeps your customers' data safe. See Domain security.
Widget styles
Configure the widget
Open the agent from My Agents, go to the Deploy tab, select Web Widget, and click Configure Widget.
Standard Button options
Floating Input options
Suggested questions are set on the agent: up to four questions, 120 characters each. See Configure Agent.
Orb styles
Both styles can use an animated orb. The orb also responds to the sound of the voice in voice mode.
Domain security
Every allowed domain is an exact match unless you use a wildcard.
Rules for wildcards
- Use them when you control several subdomains, or deploy to dynamic subdomains (for example, per-user subdomains).
- Never use
*alone. Always include the base domain. - Prefer specific domains, such as
shop.example.com, over wildcards when you can.
Remove localhost from your allowed domains before you go to production.
What domain security prevents
Without it, anyone could copy your embed code and:
- Run your agent on sites you don't control
- Use up your usage limits and run up costs
- Access conversations and sensitive business data
- Damage your brand by deploying your agent where it doesn't belong
How validation works
If you embed on unrelated websites, create a separate agent for each. You get cleaner isolation and analytics. Audit your allowed domains regularly and remove ones you no longer use.
Embed methods
Click Copy Code next to the method you want, then paste it into your site.
Script tag (recommended)
Works on any website, including WordPress, Shopify, Wix, Squarespace, Webflow, and custom sites. Place it before the closing </body> tag.
<script>
window.chatbotConfig = {
chatbotId: 'your-agent-id',
apiUrl: 'https://dashboard.getlinkai.com'
};
(function() {
var script = document.createElement('script');
script.src = window.chatbotConfig.apiUrl + '/chatbot.js?v=' + Date.now();
document.head.appendChild(script);
})();
</script>
Config parameters
The ?v= parameter in the script URL handles cache busting.
Debug mode example
<script>
window.chatbotConfig = {
chatbotId: 'your-agent-id',
apiUrl: 'https://dashboard.getlinkai.com',
debug: true // Enable debug logging
};
</script>
<script src="https://dashboard.getlinkai.com/chatbot.js"></script>
NPM package (React and Next.js)
npm install @linkai/widget
import { LinkAIWidget } from '@linkai/widget';
function App() {
return (
<div>
{/* Your app content */}
<LinkAIWidget agentId="your-agent-id" />
</div>
);
}
Direct iframe
Use an iframe when you need more control over placement.
Button
<iframe
src="https://dashboard.getlinkai.com/embed/your-agent-id/button"
style="position: fixed; bottom: 20px; right: 20px; border: none; width: 400px; height: 600px; z-index: 9999;"
allow="microphone"
></iframe>
Window
<iframe
src="https://dashboard.getlinkai.com/embed/your-agent-id/window"
style="border: none; width: 100%; height: 600px;"
allow="microphone"
></iframe>
Keep allow="microphone" if you use voice.
Platform guides
WordPress
- Install a custom HTML plugin, such as "Insert Headers and Footers".
- Go to Settings → Insert Headers and Footers.
- Paste the embed code in the Footer section.
- Save changes.
Shopify
- Go to Online Store → Themes.
- Click Actions → Edit code.
- Open
theme.liquid. - Paste the embed code before the closing
</body>tag. - Save changes.
Wix
- Go to Settings → Custom Code.
- Click + Add Custom Code.
- Paste the embed code.
- Set placement to Body - End.
- Apply to all pages.
- Save and publish.
Squarespace
- Go to Settings → Advanced → Code Injection.
- Paste the embed code in the Footer section.
- Save changes.
Webflow
- Go to Project Settings → Custom Code.
- Paste the embed code in the Footer Code section.
- Save and publish.
Customize with code
Position
The widget sits in the bottom-right corner by default. Override it with CSS:
<style>
linkai-widget {
/* Custom positioning */
bottom: 20px !important;
left: 20px !important;
right: auto !important;
}
</style>
Theme
The widget detects your site's light or dark theme. It listens to the prefers-color-scheme media query and updates when it changes.
JavaScript API
Control the widget from your own code.
// Access the widget element
const widget = document.querySelector('linkai-widget');
// Open the chat (if using standard button)
if (widget && widget.openChat) {
widget.openChat();
}
// Close the chat
if (widget && widget.closeChat) {
widget.closeChat();
}
// Listen for widget events
window.addEventListener('linkai-widget-opened', () => {
console.log('Widget opened');
});
window.addEventListener('linkai-widget-closed', () => {
console.log('Widget closed');
});
Widget features
The "Powered by Link AI" setting lives in your workspace brand kit.
Security and privacy
Performance and browser support
Place the script before </body>, prefer the built-in style options over custom CSS, and test on mobile.
Troubleshooting
The widget doesn't appear
Domain
- Confirm your domain is on the allowed domains list.
- Make sure it matches exactly, including
wwwif your site uses it. - Check the browser console for errors.
Embed code
- Confirm the
chatbotIdis correct. - Place the script before the closing
</body>tag. - Check the browser console for JavaScript errors.
Cache
- Clear your browser cache.
- Hard refresh (Ctrl+Shift+R or Cmd+Shift+R).
- Try a private window.
I see "Domain validation failed"
Domain security is blocking a domain that isn't on your allowed list.
- Add the domain to your allowed domains list.
- Compare it to your browser's address bar. It must match exactly.
- If you use
www, add bothexample.comandwww.example.com. - For subdomains, use
*.example.com. - Wait a few minutes for changes to propagate.
- Clear your cache and hard refresh.
Common mistakes: missing www, adding http:// or https:// (add the domain only), typos, and using a subdomain without a wildcard.
The widget loads slowly
- Check your internet connection.
- Confirm
https://dashboard.getlinkai.comis reachable. - Check the browser console for network errors.
- Turn off browser extensions that block scripts.
Styles look wrong
- Check for CSS conflicts with your site's styles.
- Inspect the widget with browser DevTools.
- Add
!importantto custom styles if needed. - Make sure global styles aren't affecting the widget's Shadow DOM.
Voice doesn't work
- Confirm Voice Mode is on in the agent's Call tab.
- Allow microphone access in the browser.
- Use HTTPS. Voice needs a secure context.
- Test in a supported browser: Chrome, Edge, or Safari.
Still stuck? Email support@getlinkai.com.