This guide will walk you through adding the Linked2Web AI chat and search widgets to your website in just a few simple steps.
The fastest way to get started:
</body> tagThat's it! The widgets will appear on your website.
Before you can embed the widgets, make sure you have:
✅ Created a Linked2Web account
✅ Added your website to your account
✅ Indexed your website (optional for chat, required for search)
✅ Enabled at least one feature (Chat or Search)
✅ Generated an embed token
Note: Chat works immediately even without indexing, but Search requires your website to be indexed first.
The setup tracker shows three steps:
Step 1: Index Website
Step 2: Enable Features
Step 3: Get Embed Code
The embed code will look like this:
<script defer src="https://your-domain.com/embed.js"
data-app-id="YOUR_WEBSITE_ID"
data-token="YOUR_TOKEN"
data-token-endpoint="https://your-api.com/api/public/embed-token/YOUR_WEBSITE_ID"
data-api-url="https://your-api.com">
</script>
Click the "Copy Code" button to copy it to your clipboard.
Paste the embed code into your website's HTML, just before the closing </body> tag.
All embed codes must include these attributes:
| Attribute | Description | Example |
|---|---|---|
data-app-id | Your website ID from the dashboard | data-app-id="507f1f77bcf86cd799439011" |
data-token | Security token (auto-generated) | data-token="emb_abc123..." |
data-token-endpoint | Endpoint for token refresh | data-token-endpoint="https://api.com/api/public/embed-token/..." |
data-api-url | Your API base URL | data-api-url="https://api.linked2web.com" |
Customize the widget behavior with these optional attributes:
| Attribute | Description | Default | Values |
|---|---|---|---|
data-theme | Widget theme | light | light or dark |
data-enable-chat | Show chat widget | true | true or false |
data-enable-search | Show search widget | true | true or false |
data-page-path | Override page path detection | Auto-detected | Any path string |
Method 1: Using a Plugin
Method 2: Edit Theme Files
footer.php</body> tag⚠️ Warning: Editing theme files directly can be lost when updating themes. Use Method 1 or a child theme.
theme.liquid from the Layout folder</body> tag</body></body> tag</body>For multiple pages, add to all pages or use a template/partial.
Option 1: Using useEffect (Recommended)
import { useEffect } from 'react';
export default function Layout({ children }) {
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://your-domain.com/embed.js';
script.setAttribute('defer', '');
script.setAttribute('data-app-id', 'YOUR_WEBSITE_ID');
script.setAttribute('data-token', 'YOUR_TOKEN');
script.setAttribute('data-token-endpoint', 'https://your-api.com/api/public/embed-token/YOUR_WEBSITE_ID');
script.setAttribute('data-api-url', 'https://your-api.com');
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
};
}, []);
return <>{children}</>;
}
Option 2: Using next/script
import Script from 'next/script';
export default function Layout({ children }) {
return (
<>
{children}
<Script
src="https://your-domain.com/embed.js"
strategy="lazyOnload"
data-app-id="YOUR_WEBSITE_ID"
data-token="YOUR_TOKEN"
data-token-endpoint="https://your-api.com/api/public/embed-token/YOUR_WEBSITE_ID"
data-api-url="https://your-api.com"
/>
</>
);
}
Check 1: Embed Code Placement
</body> tagCheck 2: Browser Console
[Embed]Check 3: Token Validity
Check 4: Features Enabled
Issue: "Invalid or expired token"
Issue: "No results found"
Override automatic path detection:
<script defer src="..." data-page-path="/custom-page"></script>
Tokens automatically refresh to maintain security:
No action needed - this happens automatically!
Configure lead capture in Chat Manager:
<script defer src="YOUR_DOMAIN/embed.js"
data-app-id="YOUR_WEBSITE_ID"
data-token="YOUR_TOKEN"
data-token-endpoint="YOUR_API_URL/api/public/embed-token/YOUR_WEBSITE_ID"
data-api-url="YOUR_API_URL"
data-theme="light"
data-enable-chat="true"
data-enable-search="true">
</script>
Last Updated: 12/29/2025
Version: 2.0
If you're still having issues, check the browser console (F12) for errors or contact support.
Go to Websites →