Skip to main content

Behavior

Below is a detailed list of all configuration options that control the Website Widget's behavior. These are set as data- attributes on the script tag. For styling and component customization, see Styling.

Required parameters

The following parameters are required to configure the Website Widget:

ParameterDescription
data-website-idObtain this ID from the Kapa team for your website.
data-project-nameSet the name to be displayed at the top of the widget modal.
data-project-colorChoose the default color for the widget (use a HEX color code).
data-project-logoProvide a link to the logo you want to use (a square format is recommended).

Here is an example with the required parameters and a few recommended optional parameters:

<script
async
src="https://widget.kapa.ai/kapa-widget.bundle.js"
data-website-id="XXX-XXX-XXX"
data-project-name="kapa.ai"
data-project-color="#6306B6"
data-project-logo="https://example.com/logo.png"
></script>

Optional parameters

Language

ParameterDescriptionDefault Value
data-languageSet the widget's UI language. See supported languages for the complete list. This only changes the UI strings — users can still ask questions in any language."en"

The default behavior is to open the modal on clicking the Ask AI button. If you want to override this behavior, you can set the following parameters:

ParameterDescriptionDefault Value
data-modal-open-by-defaultSet to "true" to open the modal by default when loading it on a page."false"
data-modal-open-on-command-kSet to "true" to enable opening the modal with Cmd+K (or Ctrl+K on Windows/Linux)."false"
data-modal-command-k-search-mode-defaultSet to "true" to open in search mode when the widget is triggered via Cmd+K. Only relevant when search mode is enabled."false"
data-modal-override-open-selectorSet to a CSS selector (e.g., "button[data-action='open']") to override the modal open behavior. Clicking any element matching this selector opens the modal.Not set
data-modal-override-open-selector-searchSet to a CSS selector to open the modal in search mode when the matching element is clicked.Not set
data-modal-override-open-selector-ask-aiSet to a CSS selector to open the modal in ask-AI mode when the matching element is clicked.Not set
data-modal-override-open-classSet to a CSS class name to open the modal when any element with this class is clicked.Not set
data-modal-override-open-class-searchSet to a CSS class name to open the modal in search mode when any element with this class is clicked.Not set
data-modal-override-open-class-ask-aiSet to a CSS class name to open the modal in ask-AI mode when any element with this class is clicked.Not set
data-modal-override-open-idSet to an element ID to open the modal when that element is clicked.Not set
data-modal-override-open-id-searchSet to an element ID to open the modal in search mode when that element is clicked.Not set
data-modal-override-open-id-ask-aiSet to an element ID to open the modal in ask-AI mode when that element is clicked.Not set
data-render-on-loadDetermines whether the widget is rendered immediately when the script loads. Set to "false" to defer rendering and trigger it later using window.Kapa.render()."true"

Search configuration

By default, the search mode is not enabled. You can enable it and customize its behavior with the following parameters:

ParameterDescriptionDefault Value
data-search-mode-enabledSet to "true" to enable the search mode."false"
data-search-mode-defaultSet to "true" to set search as the default mode when the widget is opened."false"
data-search-keyboard-nav-enabledSet to "false" to disable keyboard navigation in search results."true"
data-search-source-ids-includeDefine the set of source IDs to be included in the search. Kapa excludes the other sources. Source IDs can be found in the Kapa platform: go to Sources, select the source name, then get the ID from the URL. Example: "id1,id2,id3". If you use both this and data-source-group-ids-include, Kapa restricts search to sources in both lists.Not set
data-search-source-ids-orderDefine the order in which sources should be grouped in the search results list. Comma-separated list of source IDs.Not set

Source groups

ParameterDescriptionDefault Value
data-source-group-ids-includeComma-separated list of source group IDs to limit the widget's knowledge base. When set, the widget only uses sources from the specified groups (plus any global sources). Example: "group-id-1,group-id-2". See source groups documentation for details.Not set

Bot protection

ParameterDescriptionDefault Value
data-bot-protection-mechanismDetermines the captcha service on the widget that provides protection from bots and other abuse. To use hCaptcha instead of reCAPTCHA, set to "hcaptcha"."recaptcha"

Analytics

By default, the widget performs anonymous user tracking and collects anonymous user feedback through satisfaction surveys. You can disable these features with the following parameters:

ParameterDescriptionDefault Value
data-user-analytics-cookie-enabledSet to "false" to disable anonymous user tracking via cookies."true"
data-user-analytics-fingerprint-enabledSet to "true" to enable browser fingerprinting for user identification. Takes precedence over cookie tracking when enabled."false"
data-user-satisfaction-feedback-enabledSet to "false" to prevent the satisfaction survey from being shown to users."true"

Advanced

ParameterDescriptionDefault Value
data-uncertain-answer-calloutAn additional message, formatted as Markdown, that is directly appended to the answer when uncertainty is detected.Not set
data-consent-requiredSet to "true" to require user consent before using the widget. Enabling this sets a kapa_consent cookie in the browser."false"

MCP install menu

You can add an install menu to the widget header that promotes your Hosted MCP server and helps users connect to your knowledge base from popular AI tools like Cursor, VS Code, Claude (Code and Desktop), and ChatGPT. You must have a hosted MCP server set up before enabling this feature.

MCP dropdown in widget header

ParameterDescriptionDefault Value
data-mcp-server-urlThe MCP server URL for your docs (e.g., "https://your-project.mcp.kapa.ai"). Required when MCP is enabled.Not set

The MCP button visibility and text can be configured through data-mcp-button-hidden and data-mcp-button-text on the Styling page.

note

Component-specific behavioral parameters like button text, modal titles, consent screen text, and input placeholders are configured through the component styling system. For example, data-launcher-button-text, data-modal-title-text, data-consent-screen-title, and data-ask-ai-input-placeholder are documented in the Styling page under their respective component sections.

Supported languages

The widget supports UI localization in multiple languages. Use the data-language parameter to set the widget's interface language.

LanguageLanguage Code
English"en"
Chinese"zh"
Czech"cs"
Dutch"nl"
French"fr"
German"de"
Italian"it"
Japanese"ja"
Korean"ko"
Portuguese"pt"
Russian"ru"
Spanish"es"

English ("en") is the default language. The language setting only affects the widget's UI elements such as buttons, labels, and placeholder text. Users can ask questions in any language regardless of the UI language setting.

Example

<script
src="https://widget.kapa.ai/kapa-widget.bundle.js"
data-website-id="your-website-id"
data-language="zh"
...
></script>