← All posts
March 23, 2026 · 5 min read · Factfu Team

How to Add an AI Chatbot to Any Website (One Script Tag)

The simplest way to add an AI chatbot to your website. One line of HTML, no framework required. Works with any site that can load a script tag — which is all of them.

HTMLAI ChatbotTutorialCustomer SupportJavaScript

One script tag. That's the whole tutorial.

We could pad this out with a 2,000-word intro about the importance of customer engagement in the digital age. We could talk about market trends and customer retention statistics. We could use the phrase "paradigm shift" unironically.

Instead, here's the answer you came for:

<script
  src="https://factfu.com/v0/widget.loader.js"
  data-widget-key="pk_your_key_here"
  defer>
</script>

Drop that before your closing </body> tag. Done.

Okay, you need a widget key first. And you probably want some context. So let's do the slightly longer version.

The 5-minute version

1. Sign up and create a bot

Go to factfu.com/signup. Free account comes with 200 messages per month — enough to test whether this is worth your time (spoiler: it is).

Once you're in:

  1. Click Create Bot
  2. Name it something respectable
  3. Add your content — this is what the bot will actually know about

You've got three ways to feed it information:

The bot builds a knowledge base from this. Better input = better answers. Garbage in, garbage out — same as everything else in life.

2. Copy the embed code

Go to Settings → Widget in the dashboard. You'll see your embed code with a unique widget key:

<script
  src="https://factfu.com/v0/widget.loader.js"
  data-widget-key="pk_abc123..."
  defer>
</script>

3. Paste it into your HTML

Open whatever file serves your site's HTML. Could be index.html. Could be a template. Could be a CMS field that accepts custom code. Put the script tag just before </body>:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Your Site</title>
</head>
<body>
  <!-- all your existing content -->

  <script
    src="https://factfu.com/v0/widget.loader.js"
    data-widget-key="pk_your_key_here"
    defer>
  </script>
</body>
</html>

Refresh. There's a chat bubble in the bottom-right corner of your page. Click it. Ask a question. Watch the bot answer it using your content.

That's genuinely it.

For the "but what about..." crowd

Static HTML sites

Just edit the HTML file. If you have multiple pages, paste the script in each one — or better yet, put it in a shared template/include if your setup supports it.

PHP sites

Add the script to your footer template:

<!-- in footer.php or equivalent -->
<script
  src="https://factfu.com/v0/widget.loader.js"
  data-widget-key="pk_your_key_here"
  defer>
</script>
</body>
</html>

Server-rendered apps (Express, Django, Rails, etc.)

Same idea — add the script tag to your base layout template. The defer attribute means it won't block rendering regardless of where you put it, but </body> is conventional.

Hugo, Jekyll, Eleventy, or any static site generator

Find the base layout (usually something like layouts/_default/baseof.html or _layouts/default.html) and add the script before the closing body tag.

Single-page apps (React, Vue, Angular)

Add it to your root index.html. The widget attaches itself to the DOM independently — it doesn't care what framework you're using. For React/Next.js specifically, check out our Next.js guide for a slightly more idiomatic approach.

How the script works (for the curious)

The loader script (widget.loader.js) is about 2 KB. It:

  1. Fetches a manifest to find the latest widget bundle
  2. Loads the full widget (~30 KB gzipped) asynchronously
  3. Renders the chat bubble in a shadow DOM (isolated from your CSS)
  4. Connects to the Factfu API when someone opens the chat

The defer attribute ensures it doesn't block page parsing. Your content loads first, then the chat bubble appears. Lighthouse won't bat an eye.

Customizing

All customization happens in the Factfu dashboard — not in your HTML:

  1. Colors: Match your brand in Bots → Customize
  2. Welcome message: Set a greeting that fits your tone
  3. Quick replies: Pre-set buttons like "Pricing", "Contact", "FAQs"
  4. Avatar: Upload your logo or a custom icon
  5. Instructions: Tell the bot how to behave ("Keep answers short", "Always suggest booking a call for complex questions", etc.)

Changes apply instantly. No need to touch your site's code.

Troubleshooting

Nothing appears:

Bot doesn't know the answers:

Widget conflicts with my layout:

Pricing

Free Starter ($19/mo) Pro ($49/mo)
Bots 1 3 Unlimited
Messages/month 200 2,000 5,000
Content sources 5 25 Unlimited
Custom branding
Live chat handoff
Zapier integration
Slack integration
Remove "Powered by"

Start free. Upgrade when the bot is answering more questions than you ever did manually.

The bottom line

Adding a chatbot to your website is a one-line-of-HTML operation. No npm install. No build step. No external dependencies. No iframe sizing issues. Just a script tag with your key.

If you can paste code into an HTML file, you can have an AI chatbot running in five minutes. Start here.

Ready to add AI chat to your site?

Set up Factfu in under 5 minutes. No credit card required.

Start for free →