Answer customer inquiries instantly at any hour with verified factual accuracy and zero waiting.
AI Chatbot HTML: Add a Chatbot to Any HTML Website
Learn how to add an AI chatbot to your website HTML with one standalone, under 20 KB vanilla JavaScript snippet. No npm packages, no bundler, and no backend required — train your agent on your XML sitemap, PDFs, and Excel sheets with knowledge-grounded accuracy.
Copy-Paste Installation for Static HTML
Choose a corner chat bubble for your whole site, mount the widget inline inside a support page, or dedicate a full browser window to your AI assistant.
Floating Widget (Before </body>)
Paste this snippet right before the closing </body> tag in your index.html. The async attribute ensures the script downloads in parallel without delaying page render.
<!-- Knogents AI Agent -->
<script>
window.widgetConfig = {
chatbotId: "YOUR_CHATBOT_ID"
};
</script>
<script
async
data-id="YOUR_CHATBOT_ID"
id="knogents-widget-script"
type="text/javascript"
src="https://knogents.com/embed.js"
></script>Inline Embed Inside a Page Section
Add a container with id="rag-inline-bot" inside your HTML layout and set display: "inline". Make sure the container exists in the DOM above the script tag.
<!-- Target Container -->
<div id="rag-inline-bot" style="width: 100%; height: 600px; min-height: 450px;"></div>
<!-- Knogents Inline Embed -->
<script>
window.widgetConfig = {
chatbotId: "YOUR_CHATBOT_ID",
display: "inline"
};
</script>
<script
async
data-id="YOUR_CHATBOT_ID"
id="knogents-widget-script"
type="text/javascript"
src="https://knogents.com/embed.js"
></script>Need a dedicated help page?
Set display: "fullscreen" in window.widgetConfig to expand the chat interface across the entire viewport on a standalone HTML page.
display: "fullscreen"Built for Fast Static Websites
Keep your static site fast while offloading document parsing, vector search in PostgreSQL pgvector, and lead capture to Knogents.
Under 20 KB Vanilla JavaScript
No framework runtime, no npm install, and no build pipeline changes. Works cleanly alongside custom CSS and supports custom themes or full CSS styling on the Standard plan.
Excel, CSV, PDF & Docs Retrieval
Upload multi-sheet .xlsx, .xls, and .csv files plus .pdf, .docx, .md, and .txt files. Our table chunking engine keeps column headers intact across chunks so pricing and spec tables stay accurate.
Automated Sitemap Sync & Grounding
Point Knogents at your sitemap.xml or individual HTML URLs. Connected pages re-index automatically (monthly on Free, weekly on Basic, daily on Standard), and every response cites its source document or URL.
Meeting Capture & Email Lead Alerts
Detect natural language appointment requests, check for scheduling conflicts, and capture visitor contact details right inside the widget. Instant email alerts deliver the lead and notes straight to your inbox.
Production Checklist: Adding an AI Chatbot to Website HTML
Static HTML websites hosted on GitHub Pages, Netlify, Cloudflare Pages, Vercel Static, or AWS S3 prioritize fast load times, strict browser security policies, and minimal scripts. Here is how to deploy an HTML chatbot cleanly across multi-page templates, static site generators, and hardened headers without degrading Lighthouse scores.
1. Multi-Page HTML Templates & Static Site Generators
Instead of manually editing dozens of individual .html pages, place the window.widgetConfig block and embed.js loader once inside your shared footer partial. Static site generators and classic server templates propagate the widget site-wide on the next build:
- Plain Multi-Page HTML / cPanel: Place the snippet inside a shared footer include or copy it before
</body>on landing pages, pricing pages, and documentation hubs. - Jekyll, Hugo & Eleventy (11ty): Drop the script into
_includes/footer.htmlorlayouts/partials/footer.htmlso every generated HTML route loads asynchronously. - Astro & Vite Multi-Page Builds: Add the snippet to your base layout shell with
is:inlinewhere needed so build tools do not bundle or rewrite the externalhttps://knogents.com/embed.jsURL. - Dedicated Help Pages: Keep the default
floatingbubble across marketing pages while embeddingdisplay: "inline"inside/support.htmlor/faq.htmlwith<div id="rag-inline-bot"></div>.
2. Content Security Policy (CSP), Origin Isolation & Privacy
Security-conscious static websites often enforce strict HTTP response headers via Netlify _headers, Cloudflare Transform Rules, or Nginx configs. Because embed.js runs entirely client-side without external runtime libraries, keeping CSP tight takes only two directives:
# Minimum CSP directives for Knogents embed.js Content-Security-Policy: script-src 'self' https://knogents.com; connect-src 'self' https://knogents.com;
- Cookie-Free Session State: Conversation history uses ephemeral browser
sessionStoragerather than third-party advertising cookies, simplifying consent banners on static marketing pages. - Zero DOM Pollution Before Click: When loaded with
async, the script waits for the browser parser to finish HTML layout, protecting First Contentful Paint (FCP), Cumulative Layout Shift (CLS), and Interaction to Next Paint (INP).
3. Five-Step Pre-Launch Verification for Static Sites
- STEP 01Connect Sitemap & FilesImport your
sitemap.xml, PDFs, or.xlsxsheets and inspect indexed chunks in your Knogents workspace. - STEP 02Verify Agent IDConfirm both
window.widgetConfig.chatbotIdanddata-idcarry your exact dashboard agent ID. - STEP 03Check DOM OrderFor inline widgets, place
<div id="rag-inline-bot"></div>above the script tag so it exists at mount time. - STEP 04Authorize OriginTest from your production HTTPS domain (not
file://locally) and check DevTools Network tab for 200 responses. - STEP 05Audit Edge QuestionsAsk pricing, refund, and unsupported off-topic questions to verify grounded refusal and lead capture alerts.
HTML Chatbot vs. Static FAQ Accordions & Generic Widgets
A common question for teams running static HTML documentation sites is whether an embedded AI chatbot actually outperforms plain <details> FAQ accordions or client-side search scripts like Lunr.js. Keyword search requires visitors to guess your exact page vocabulary, whereas Knogents translates every uploaded guide, product CSV, and HTML route into high-dimensional vector embeddings inside PostgreSQL pgvector.
| Capability | Knogents HTML AI Chatbot | Static FAQ / Client Search |
|---|---|---|
| Query Matching | Semantic intent retrieval across synonyms and multi-part questions | Literal keyword matches only |
| Browser Bundle Weight | Under 20 KB async loader; index lives server-side in pgvector | JSON search indexes bloat browser downloads as docs grow |
| PDFs & Spreadsheets | Reads uploaded PDFs, DOCX, and multi-tab Excel/CSV price sheets | HTML page text only; attachments stay invisible |
| Lead & Booking Capture | Captures contact details and requests meetings with instant email alerts | Requires separate contact forms and manual navigation |
Compatible Static Hosts
Transparent Monthly Plans
Start free on your static site and scale with flat monthly tiers or modular add-ons.
100 messages/mo, 1 agent, 30K chars, monthly sync, 0 extra seats (Owner only)
1,000 messages/mo, 2 agents, 150K chars, weekly sync, 2 extra seats, 5 themes
3,000 messages/mo, 6 agents, 500K chars, daily sync, 3 extra seats, custom CSS
Add-ons available anytime: +1,500 messages ($10/mo), +1 agent ($8/mo), Remove Branding ($10/mo).
Scope & Boundaries
Know what Knogents handles out of the box before you embed it.
- Automated AI only: There is no shared human live-chat inbox. Escalations and captured leads go to your email and Knogents dashboard.
- Websites only: No social DM or external messaging inbox automation.
- Prompt and RAG driven: No drag-and-drop visual flowchart builder for rigid decision trees.
- No ticketing CRM or native HubSpot/Salesforce sync: Review transcripts, usage analytics, and leads inside your Knogents workspace.
Frequently Asked Questions
Common questions about installing Knogents on static HTML websites.
How do I add an AI chatbot to an HTML website?
Open your index.html (or shared HTML footer) in your editor, paste the window.widgetConfig and embed.js snippet right before the closing </body> tag, replace YOUR_CHATBOT_ID with your agent ID from the Knogents dashboard, and deploy your file.
Does embed.js need jQuery, React, or a bundler like Vite or Webpack?
No. Knogents embed.js is standalone vanilla JavaScript under 20 KB with zero external dependencies. It runs directly in the browser on static sites hosted on GitHub Pages, Netlify, Cloudflare Pages, AWS S3, or standard cPanel hosting.
Why does window.widgetConfig need to come before embed.js?
When embed.js initializes, it reads your chatbotId and display mode (floating, inline, or fullscreen) from window.widgetConfig. Defining the config object right above the loader script guarantees those settings are ready before the widget mounts.
How do I embed the HTML chatbot inside a specific section of my page?
Add <div id="rag-inline-bot"></div> where you want the chat interface to appear (such as inside a <main> or <section> block), then set display: "inline" inside window.widgetConfig. The widget mounts directly inside that container.
Will adding an HTML chatbot script hurt Core Web Vitals or page speed?
No. The embed script is under 20 KB, loads with the async attribute, and executes client-side without blocking HTML parsing, CSS layout, or Largest Contentful Paint. All document indexing and PostgreSQL pgvector searches run remotely on Knogents servers.
What Content Security Policy (CSP) rules are needed for an HTML chatbot?
If your static host or Nginx/Cloudflare config enforces strict Content-Security-Policy headers, allow https://knogents.com in script-src and connect-src so the loader downloads cleanly and sends encrypted chat requests over HTTPS.
Can I add the same HTML chatbot to multiple static pages or subdomains?
Yes. Paste the same snippet across every HTML template or static site generator layout partial (Hugo, Jekyll, Eleventy, Astro) on authorized domains. For separate bots with distinct knowledge bases, Basic includes 2 agents ($29/mo) and Standard includes 6 agents ($59/mo).
How does Knogents handle visitor follow-ups if a human is needed?
Knogents is an automated AI agent and does not include a live human chat console. When a visitor wants to talk to your team or book a consultation, the agent collects their name, email, and notes (or checks for scheduling conflicts and books a time slot) and sends an instant email notification to your inbox.
Add Knogents to Your HTML Site Today
Connect your sitemap, upload your PDFs or spreadsheets, and paste the embed snippet before your closing body tag.
Solutions Powered by this Integration
Explore autonomous AI customer service and sales workflows built for your platform.
Lead Generation & Consultation Scheduling
Qualify website visitors, capture contact details, and book consultations in real-time.
Manufacturing & Industrial Chatbot
Answer complex technical specifications, SKU part lookups, and compliance queries from PDF manuals and Excel.
Setup Guides & Tutorials
Step-by-step technical guides for setting up Knogents on this platform.
How to Add an AI Chatbot to an HTML Website
Complete guide to pasting the standalone vanilla JS snippet into static HTML, PHP, or custom stacks.
How to Add an AI Chatbot via Google Tag Manager
Deploy Knogents across your entire domain using a GTM Custom HTML Tag triggered on Page View.
How to Add an AI Chatbot to React & Next.js
Best practices for loading Knogents via next/script strategy lazyOnload in Next.js 14 App Router.
Explore Other Platform Integrations
Deploy Knogents across Shopify, WordPress, WooCommerce, Wix, Webflow, and custom stacks.
Under 20 KB vanilla JavaScript embed loader supporting floating, inline, and fullscreen modes.
Load the Knogents script cleanly in React and Next.js App Router using next/script.
Install an AI support agent on WordPress via footer script, header plugin, or block editor.
24/7 STOREFRONT ASSISTANT
Deploy Knogents on Your Website in 2 Minutes
Connect your website sitemap, upload your documentation or product catalog, and embed with a single snippet.