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

StyleWhat it looks likeFeatures
Standard ButtonA chat button that expands into a drawer-style chatAgent avatar or animated orb, Glass, White, or Black background, optional animated borders, custom welcome message
Floating InputA minimal floating input field that expands into a full chatCustom accent color, smooth expansion, White background, voice input (if enabled), suggested questions

Configure the widget

Open the agent from My Agents, go to the Deploy tab, select Web Widget, and click Configure Widget.

Standard Button options

OptionWhat it does
StyleGlass, White, or Black background
Chat Button TitleThe button's welcome text, such as "Hi, let's chat!"
Button AvatarYour agent's avatar or an animated orb
BorderSimple or animated gradient border

Floating Input options

OptionWhat it does
Accent ColorColor of the input border, send button, and focus ring
Button AvatarYour agent's avatar or an animated orb
Suggested questionsShows up to three of the agent's starter questions as bubbles when the input opens

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.

OrbAnimationCustom hex color
GlintSparkling starYes
OrbSimple animated orbPredefined colors
CommandCommand-line styleYes
ManaCustom color orb with a noise effectYes
HaloHalo ringYes

Domain security

Every allowed domain is an exact match unless you use a wildcard.

EntryAllows
example.comOnly the exact domain (most secure)
*.example.comAll subdomains, such as app.example.com, blog.example.com, and shop.example.com
example.com and www.example.comBoth, if your site uses both
localhost:3000, 127.0.0.1:3000Local development

Open Domain Security Settings

In the Web Widget section, find Domain Security Settings.

Add a domain

Click Add Domain and enter the domain only, such as example.com. Don't include http:// or https://. Repeat for each site.

Save

Click Save. The embed code appears once at least one domain is saved.

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

CheckWhat happens
Pre-load validationThe widget checks the embedding domain before it starts
Origin verificationEvery API request checks the request origin against your allowed domains
Runtime checksValidation continues while the widget runs
Fail-safeIf any check fails, the widget doesn't load and shows an error

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.

Works on any website, including WordPress, Shopify, Wix, Squarespace, Webflow, and custom sites. Place it before the closing </body> tag.

html
<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

ParameterRequiredDescription
chatbotIdYesYour agent's ID
apiUrlYeshttps://dashboard.getlinkai.com
debugNotrue prints detailed console logs during development

The ?v= parameter in the script URL handles cache busting.

Debug mode example

html
<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)

bash
npm install @linkai/widget
tsx
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.

PathWhat it renders
/embed/your-agent-id/buttonThe chat button
/embed/your-agent-id/windowThe full chat interface

Button

html
<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

html
<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

PlatformWhere to paste the script
WordPressA header and footer plugin's Footer section, or your theme's footer.php before </body>
Shopifytheme.liquid, before </body>
WixSettings → Custom Code, placement Body - End
SquarespaceSettings → Advanced → Code Injection, Footer
WebflowProject Settings → Custom Code, Footer Code
Custom siteBefore </body>
WordPress
  1. Install a custom HTML plugin, such as "Insert Headers and Footers".
  2. Go to Settings → Insert Headers and Footers.
  3. Paste the embed code in the Footer section.
  4. Save changes.
Shopify
  1. Go to Online Store → Themes.
  2. Click Actions → Edit code.
  3. Open theme.liquid.
  4. Paste the embed code before the closing </body> tag.
  5. Save changes.
Wix
  1. Go to Settings → Custom Code.
  2. Click + Add Custom Code.
  3. Paste the embed code.
  4. Set placement to Body - End.
  5. Apply to all pages.
  6. Save and publish.
Squarespace
  1. Go to Settings → Advanced → Code Injection.
  2. Paste the embed code in the Footer section.
  3. Save changes.
Webflow
  1. Go to Project Settings → Custom Code.
  2. Paste the embed code in the Footer Code section.
  3. Save and publish.

Customize with code

Position

The widget sits in the bottom-right corner by default. Override it with CSS:

html
<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.

CallWhat it does
widget.openChat()Opens the chat (Standard Button)
widget.closeChat()Closes the chat
linkai-widget-opened eventFires when the widget opens
linkai-widget-closed eventFires when the widget closes
javascript
// 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

FeatureDetails
Real-time chatInstant delivery, typing indicators, message history, conversation persistence
File attachmentsImages, documents, and files (if enabled), drag and drop, preview before sending
Voice inputVoice-to-text (if enabled), real-time audio, multi-language support
MobileResponsive, touch-friendly, handles the mobile keyboard
ThemeDetects light and dark mode, follows system preferences
BrandingCustom colors and styles, agent avatar, welcome message, optional "Powered by Link AI"

The "Powered by Link AI" setting lives in your workspace brand kit.

Security and privacy

ProtectionWhat it does
Sandboxed iframesChat content loads in sandboxed iframes
HTTPS onlyAll communication is encrypted
CSP headersContent Security Policy headers restrict iframe embedding
PostMessage validationCross-origin messages are validated before processing
Domain-bound dataChat data is only available to allowed domains
Session isolationEach conversation is isolated and not shared across domains

Performance and browser support

MetricValue
Bundle sizeUnder 150 KB gzipped
Load timeUnder 300 ms on average
LoadingAsynchronous. Doesn't block page load.

Place the script before </body>, prefer the built-in style options over custom CSS, and test on mobile.

BrowserSupport
Chrome and EdgeLatest 2 versions
FirefoxLatest 2 versions
Safari (macOS and iOS)Latest 2 versions
MobileiOS Safari, Chrome Mobile, Samsung Internet
Internet ExplorerNot supported. The widget doesn't appear.

Troubleshooting

The widget doesn't appear

Domain

  1. Confirm your domain is on the allowed domains list.
  2. Make sure it matches exactly, including www if your site uses it.
  3. Check the browser console for errors.

Embed code

  1. Confirm the chatbotId is correct.
  2. Place the script before the closing </body> tag.
  3. Check the browser console for JavaScript errors.

Cache

  1. Clear your browser cache.
  2. Hard refresh (Ctrl+Shift+R or Cmd+Shift+R).
  3. Try a private window.
I see "Domain validation failed"

Domain security is blocking a domain that isn't on your allowed list.

  1. Add the domain to your allowed domains list.
  2. Compare it to your browser's address bar. It must match exactly.
  3. If you use www, add both example.com and www.example.com.
  4. For subdomains, use *.example.com.
  5. Wait a few minutes for changes to propagate.
  6. 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
  1. Check your internet connection.
  2. Confirm https://dashboard.getlinkai.com is reachable.
  3. Check the browser console for network errors.
  4. Turn off browser extensions that block scripts.
Styles look wrong
  1. Check for CSS conflicts with your site's styles.
  2. Inspect the widget with browser DevTools.
  3. Add !important to custom styles if needed.
  4. Make sure global styles aren't affecting the widget's Shadow DOM.
Voice doesn't work
  1. Confirm Voice Mode is on in the agent's Call tab.
  2. Allow microphone access in the browser.
  3. Use HTTPS. Voice needs a secure context.
  4. Test in a supported browser: Chrome, Edge, or Safari.

Still stuck? Email support@getlinkai.com.

Next steps

© Link AI