HomeAdd a widgetany website

AI chat · any website

Add an AI chat widget to any website

An AI chat agent on every page of your site from one copy-paste just before </body>. It answers from your indexed pages, says so when the answer isn’t there, and shows an AI disclosure line in every chat.

Free plan with no time limit, no card.

See it working

There is a live one on this page already: the chat button in the bottom corner is a Sorraia AI chat agent — ours, answering from the pages it has indexed on this site and saying so when the answer isn’t there, with the AI disclosure line every chat carries. Open it and ask it something.

How to add an AI chat widget to any website

One tag in the layout every page shares and the launcher is on the whole site — a base template, a partial, a layout component, whatever each page inherits. The one rule that matters is where it sits: inside <body>, just before the closing tag. The chat loader attaches the launcher to the body the moment it runs and doesn’t retry, so in the <head>, where there is no body yet, it never appears — and nothing on the page says why.

  1. In Sorraia, add the website and verify it — a DNS TXT record, or a meta tag in your homepage’s <head>. Verification is what lets you attach a widget to that site, so it comes before there is anything to paste.

  2. Save the agent, then copy the snippet from the Embed code box in the right-hand panel of the chat builder. (Chat has no install wizard — the box is the whole thing.)

  3. Copy the snippet from Sorraia.

  4. Paste it into the one template every page inherits — the base layout, the shared footer partial, the layout component — immediately before the closing </body> tag.

  5. Deploy. Do not paste it into pages one at a time.

  6. Load any page and confirm the launcher appears in the corner. Anywhere inside <body> works; where you put it does not change where it lands.

Where these steps come from:1

Worth knowing for this one

  • MDN documents document.body as null when no body element exists yet — the state of the page while the browser is still reading the <head>.2
  • A script placed just before </body> runs after the content above it has been parsed, with no load listener needed, which is why Sorraia’s help puts every launcher there, once, site-wide.31
  • The agent’s crawler reads your pages’ HTML and doesn’t run JavaScript, so content a page renders only in the browser may be missed; press Re-crawl & re-index whenever the site changes.4

What a page can already do

A page can already offer mailto: and tel: links: one opens the visitor’s email program with a new message, the other dials the number on a phone. Both hand the question to you, and nothing answers it on the page. Sorraia’s agent answers from the pages it has indexed on your site, says so when the answer isn’t there and offers to connect the visitor with your team, and every chat shows an AI disclosure line that can’t be switched off.54

What’s included

  • Answers from the pages it has indexed on your site
  • Says so when the answer isn’t there
  • An AI disclosure line on every chat
  • 25 conversations a month on Free
  • Live with one copy-paste

Free plan with no time limit, no card.

Questions

Head or body for the chat snippet?

The body, just before it closes. In the head the launcher has no body to attach to yet, so it never shows; anywhere inside the body works, and the end is the safe place.

Does the chat work on a site built as a single-page app?

Load the snippet once in the HTML shell every route shares, before </body>, rather than in a component that renders it again. Keep the crawler in mind too: it reads HTML without running JavaScript, so text that appears only client-side may not be indexed.

What happens when the Free plan’s 25 conversations run out?

New chats aren’t answered by the AI until the count resets at the start of the next month (UTC), and the widget offers your WhatsApp and email options instead.

Can the agent answer questions my pages don’t cover?

It answers from the pages it has indexed and from knowledge you add by hand. When the answer isn’t in either, it says so and offers to connect the visitor with your team.

Will a Content-Security-Policy block the chat?

It can. Allow the script’s host under script-src and the Sorraia API under connect-src, and allow inline styles under style-src, because the chat builds its stylesheet when it loads.

Sources

  1. Embedding on your website · sorraia.app
  2. Document.body (MDN) · developer.mozilla.org
  3. The DOMContentLoaded event (MDN) · developer.mozilla.org
  4. The AI chat agent · sorraia.app
  5. The anchor element (MDN) · developer.mozilla.org
  6. CSP script-src (MDN) · developer.mozilla.org
  7. CSP connect-src (MDN) · developer.mozilla.org
  8. CSP style-src (MDN) · developer.mozilla.org

Each page read and checked on 20 October 2026.

Add an AI chat widget to any website

Build it in Sorraia, put it live on your site with one copy-paste, and change it later without touching the embed again.