Kroos Developers
Kroos Developers › Website chatbot

Embed the website chatbot

Every option for the Kroos chatbot script — floating or built into a page, positioning, signed-in visitors, languages, voice and Content Security Policy.

The chatbot is one script. It renders inside a Shadow DOM (your CSS can't break it, and it can't break yours) and makes no third-party requests.

Basic embed (floating)#

html
<script src="https://kroos.ai/widget.js" data-kroos-key="kroos_pk_..." async></script>

A chat button appears in the bottom-right corner of every page. This is the default and what most visitors expect.

Build it into a page#

To show the chat inside a page (a support or demo page, for example), give it a container and point the script at it:

html
<div id="kroos-chat" style="height:640px"></div>
<script src="https://kroos.ai/widget.js" data-kroos-key="kroos_pk_..." data-kroos-inline="#kroos-chat" async></script>

The panel fills the container. Give the container a height.

Attributes#

AttributeDefaultWhat it does
data-kroos-keyrequiredYour publishable key.
data-kroos-inlinenone (floating)CSS selector of a container to render inside instead of floating.
data-kroos-openfalse"true" opens the floating panel on page load. Use sparingly.
data-kroos-offset20Distance in pixels from the bottom edge (8–400), for pages with a fixed footer or cookie bar.
data-kroos-user-tokennoneA short-lived end-user token for a signed-in visitor.
data-kroos-token-urlnoneA same-origin URL that returns { "token": "…" } for the signed-in visitor. The widget refreshes the token before it expires. See Signed-in visitors.
data-kroos-apihttps://api.kroos.aiOverride the AI host (for Kroos Node or testing).
data-kroos-modenoneReserved for Kroos's own demo page (demo). Ignored for other organizations.

Signed-in visitors#

Render the token server-side on each page view. Tokens last at most one hour.

html
<script src="https://kroos.ai/widget.js"
        data-kroos-key="kroos_pk_..."
        data-kroos-user-token="<%= kroosToken %>" async></script>

For apps where people stay signed in for longer than an hour, point the widget at a same-origin endpoint on your site that returns { "token": "…" } for the signed-in user (or 401 when nobody is signed in). The widget fetches a fresh token before the current one expires; signed-out visitors are anonymous.

html
<script src="https://kroos.ai/widget.js"
        data-kroos-key="kroos_pk_..."
        data-kroos-token-url="/api/kroos/token" async></script>

After sign-in or sign-out without a page load, call window.Kroos.setUserToken(token) (or window.Kroos.setUserToken(null)); the conversation starts over for the new person. Tokens can carry a small ctx claim, and a context provider gives the chatbot live, per-user data from your own systems.

Single-page apps#

Insert the script once when your app boots. To change the signed-in visitor (sign-in or sign-out), remove the element with id kroos-concierge and the script tag, then insert a new script tag with the new token.

js
function mountKroos(token) {
  document.getElementById("kroos-concierge")?.remove();
  document.querySelectorAll("script[data-kroos-key]").forEach((s) => s.remove());
  const s = document.createElement("script");
  s.src = "https://kroos.ai/widget.js?v=" + Date.now();
  s.async = true;
  s.dataset.kroosKey = "kroos_pk_...";
  if (token) s.dataset.kroosUserToken = token;
  document.body.appendChild(s);
}

Content Security Policy#

If your site sends a CSP header, allow the script origin and the AI host:

text
script-src  'self' https://kroos.ai;
connect-src 'self' https://api.kroos.ai;
media-src   'self' https://api.kroos.ai blob:;

media-src is only needed if you enable read-aloud or voice.

Languages#

The interface follows the visitor's browser language among the languages you enable in your knowledge (languages). English and Spanish are on by default; French and Arabic (right-to-left) are opt-in; other languages stay off until a native speaker has reviewed them.

Voice#

When Kroos Voice is enabled and your organization is in full mode, a microphone button appears. Visitors always see an AI disclosure and are asked before the microphone is used.

What visitors see#

  • Your name, a verified badge for verified domains, and your approved summary.
  • Up to six approved top questions and any current promos.
  • Answers with source links (only to your verified domains and allowed links).
  • A way to reach a person (if handoff is on in your policy).
  • An AI disclosure that can't be turned off.

Troubleshooting#

SymptomCause and fix
The button never appearsThe script didn't load: check the URL, CSP script-src, and ad blockers.
"Site owner? …" link in the panelSetup is incomplete (restricted mode). The link opens the console section that fixes it.
auth.origin_not_allowed errorsThe page's origin isn't a verified domain or an allowed origin. Add it in the console.
Answers say they can't helpThe question isn't covered by approved knowledge. Teach it from Knowledge → Teach your concierge.

Where it is and when#

The widget tells Kroos which page it's on and the visitor's time zone and clock. It never sends query strings, and it never asks visitors where they are. With that, it shows whether the visitor's location is open in its header, and offers Call or Chat with a person while you're open (when you take calls). See locations & hours.

Last updated 2026-12-03