You’re already seeing the widget in action! Click the “Ask AI” button on
this page to try it out.
Prerequisites
Before adding the widget, make sure you have:- A Guru on Gurubase (either on Gurubase Cloud or self-hosted with Enterprise plan)
- A Widget ID from your Guru’s settings
Getting Your Widget ID
- Go to Gurubase platform
- Click the Guru you want to add the widget to
- Click “Integrations” and then “Web Widget”
- Click “New Widget ID”
- Enter your website’s domain
- Click the “Show” button to configure and preview your widget
- Copy the generated widget script
- A Widget ID created for
https://www.example.comwill only work on that exact domain.- It won’t work on subdomains like
https://docs.example.com - It won’t work on different domains like
https://example.org
- It won’t work on subdomains like
- For local development, you need to create a separate Widget ID using your development URL (e.g.,
http://localhost:3000) - Domain input supports wildcard (
*) expression:*.example.comwill match any subdomain ofexample.comhttp://localhost:*will match any port oflocalhost*will match any domain, so be careful with this option! Anyone who knows your Widget ID can send requests to your Guru.
Per-Widget Settings
Each Widget ID has an Attachments toggle displayed below the domain. When enabled, users can attach files (images, logs, PDFs) in the widget chat via the paperclip button, drag-and-drop onto the input, or paste. When disabled (default), the attachment button is hidden and any file upload requests are rejected by the backend. Supported attachment file formats
Default per-question limits (configurable per guru):
Compressed archives (
.gz, .zip, .bz2) are not supported; decompress before uploading.
Text & Display Customization
Inside the widget configuration panel (click “Show”), you can customize the widget’s text labels and control what elements are displayed. These settings are saved per-widget and take effect immediately. Text overrides - Leave empty to use defaults. You type the exact text you want displayed:
Display toggles - Control which elements appear in the widget:
The Button Text is configured separately in the appearance section via the
data-text HTML attribute.Widget Configuration & Live Preview
After creating a Widget ID, click “Show” button to open the configuration panel. This allows you to customize your widget’s appearance and behavior with a live preview that shows exactly how it will look on your website.
- Button Text: Customize the text displayed on the widget button
- Theme: Choose between Light, Dark, or Auto (syncs with your website’s theme)
- Window Mode: Select Sidebar or Floating display mode
- Button Color & Shimmer: Customize the button’s primary color and shimmer effect
- Margins: Adjust the button’s position from the bottom and right edges
- Tooltip: Add an optional tooltip with customizable position
- Icon URL & Custom Name: Override the default Guru icon and name
- Text & Display: Override widget text labels and toggle sources, trust score, and branding visibility (see Text & Display Customization)
AI Assistant Integration
If you’re using AI coding assistants like Cursor, Claude Code, or similar tools, click the “Show Prompt” button next to “Using Cursor, Claude Code, or AI assistants?” to get a ready-to-use prompt.
- Instructions to detect your website’s framework (Next.js, Docusaurus, MkDocs, etc.)
- Guidance to check framework-specific setup from Gurubase docs
- Your widget script with all configured options
Basic Installation
Add this script to your website’s HTML:Configuration Options
Window Modes
The widget supports two display modes for the chat window:Sidebar Mode (Default)
The traditional sidebar experience where the chat window slides in from the
right edge of the screen.

Floating Mode
A modern modal-style experience where the chat opens as a centered floating
window.

Floating Mode Example
Self-hosted Installation (Enterprise Only)
Self-hosted installations are exclusively available under the Enterprise plan. To request access, contact us at [email protected].If you’re using self-hosted Gurubase, you must set the Gurubase instance URL using the
data-base-url attribute. The default URL of Self-hosted Gurubase instance is http://localhost:8029/api/.Customization Examples
Custom Button Text and Position
Light Mode with Custom Colors
Exposed Functions
The widget exposes the following functions viawindow.chatWidget:
-
switchTheme(lightMode = null)Sync the theme of the widget with your website’s theme. Accepts an optionallightModeparameter:switchTheme(): Toggle the themeswitchTheme(true): Force light modeswitchTheme(false): Force dark mode
window.chatWidget.switchTheme(true);See the MkDocs example for theme syncing implementation. -
destroy()Remove the widget from the DOM and clean up all event listeners. Useful for SPAs where you want to conditionally show/hide the widget based on the current route. Example:window.chatWidget.destroy();See Path-Based Widget Loading for a complete example.
Example Questions
You can display custom example questions in your widget to help guide users on what they can ask. These questions appear when users open the widget, providing helpful prompts to get started.
- Go to your Guru’s settings page
- Scroll to Advanced Settings
- Add up to 3 example questions (100 characters max each)
- Save your changes
Learn More
See the full Example Questions guide for best practices and tips
User Identification
The widget can automatically identify users and include their information in API requests asexternal_user_id. It also displays the user’s name in chat messages instead of the default “You” label. This supports two methods: automatic detection on Zendesk Help Center pages and manual configuration via localStorage.
How It Works
Whendata-pass-user-info="true" is set, the widget:
- Checks for Zendesk’s
HelpCenter.user.emailfor user identification (automatic, no extra config needed) - Falls back to reading from localStorage via
data-user-info-sourceif HelpCenter is not available - Sends the extracted value as
external_user_idto the backend - Displays the user’s name in chat messages using this fallback order:
HelpCenter.user.name(Zendesk only)HelpCenter.user.email(Zendesk only)data-user-info-sourcevalue from localStorage- “You” (default if none of the above are available)
- Fails silently if data is unavailable (won’t break widget functionality)
Zendesk Help Center (Automatic)
On Zendesk Help Center pages, the widget automatically detects the logged-in user’s email for identification and their name for display. Nodata-user-info-source is needed:
localStorage (Other Sites)
For non-Zendesk sites, configuredata-user-info-source to read from localStorage. Supports dot notation for nested JSON objects.
Common Use Cases
Segment Analytics:Path-Based Widget Loading
If you want to load the widget only on specific paths (e.g., only on/docs/ pages), you can use a conditional loading approach. This is especially useful for Single Page Applications (SPAs) where you need to handle client-side navigation.
The following script can be adapted to any SPA framework (Docusaurus, Next.js, Remix, etc.):
- The
isDocsPath()helper matches both/docsand/docs/*paths (modify this function to match your desired paths) - The
initWidget()function checks the current path before loading the widget - The
destroyWidget()function cleans up all widget-related DOM elements when navigating away - History API hooks (
pushState,replaceState,popstate) handle SPA navigation
Docusaurus Plugin Example
Docusaurus Plugin Example
For Docusaurus, you can wrap this in a plugin. Create Then register in
plugins/gurubase-widget.js:docusaurus.config.js:Platform-Specific Integrations
Archbee
To add the Gurubase widget to your Archbee documentation:- Go to Space Settings > Custom Code
- Under the “Include Headers” text area, paste the Gurubase widget script that you received from the Gurubase platform:
For security reasons, scripts are only included on a custom domain in Archbee.
Make sure you have set up a custom domain for your documentation to use the
widget.

GitBook
GitBook offers an official integration that makes it easy to add Gurubase to your documentation:- In your GitBook space, go to Integrations and search for Gurubase
- Click Install to add the integration
- Click Install on a docs site and select a site to install
- Enter your Widget ID from Gurubase platform
- Configure additional options (optional)

Mintlify
To add the Gurubase widget to your Mintlify documentation with automatic theme syncing, create a JavaScript file (e.g.,gurubase.js) in your docs content folder with the following content:
.js file in your Mintlify content directory is automatically included on every page - no additional configuration needed. The widget will automatically sync its theme (light/dark) with your Mintlify documentation.
Docusaurus
Add the widget to yourdocusaurus.config.js:
/docs/), see Path-Based Widget Loading.
MkDocs (Material)
For MkDocs with the Material theme, you can add theme syncing so the widget matches your documentation’s light/dark mode.- Add the widget script to your
mkdocs.yml:
- Create
docs/js/gurubase-widget.js:
Sphinx / Read the Docs
For Sphinx documentation (including Read the Docs), you can add the widget using either a static JavaScript file or a template override.Important: Choose only ONE of the following approaches. Using both will
cause the widget to load twice.
Option A: Static JavaScript File (Recommended)
Use this approach for a cleaner setup with all widget configuration in a single JavaScript file.- Create
_static/gurubase-widget.js:
- Add the script to your
conf.py:
Option B: Template Override
Use this approach if you prefer to add the widget directly in HTML templates.- Create or edit
_templates/layout.html:
- Make sure your
conf.pyincludes the templates path:
Theme Sync for Dark Mode
For themes with dark mode support (like Furo or PyData), add theme syncing to automatically match the widget theme with your documentation. Using static JS file (_static/gurubase-widget.js):
_templates/layout.html):
Zendesk Knowledge Base
For Zendesk Help Center themes (like Copenhagen), add the widget to your theme’sscript.js file.
- Navigate to your Zendesk Help Center (e.g.,
https://<your-subdomain>.zendesk.com/hc/en-us) - Open Knowledge Admin
- Select Customize design from the left sidebar (Eye icon)
- Click Customize on the Live theme
- Click Edit code to open the theme editor
- Open the
script.jsfile - Add the following code just before the closing
})();at the end of the file:

- Click Save and then Publish to make the changes live
Make sure to create a Widget ID for your Zendesk Help Center domain (e.g.,
yourcompany.zendesk.com or your custom domain) in the Gurubase
platform.Alternative: Using document_head.hbs Template
If you prefer to add the widget via the template, edittemplates/document_head.hbs and add the script tag:
For self-hosted Gurubase (Enterprise plan), add
data-base-url="https://gurubase.yourcompany.com/api/" to point to your
instance.Astro / Starlight
For Astro with Starlight documentation theme:Important: Choose only ONE of the following approaches. Using both will
cause the widget to load twice since both methods add a script with the same
id='guru-widget-id'.Option A: Component Approach (Recommended for Theme Sync)
Use this approach if you need automatic theme synchronization with Starlight’s dark/light mode. Createsrc/components/GurubaseWidget.astro:
astro.config.mjs head if using this approach.
Option B: Config Approach (Simpler Setup)
Use this approach for a simpler setup without theme synchronization. Add toastro.config.mjs:
GurubaseWidget.astro component if using this approach.
Retype
For Retype documentation: Add the widget script to yourretype.yml:
Troubleshooting
Widget not appearing
Widget not appearing
- Check domain configuration: Ensure your Widget ID was created for the
exact domain where you’re testing. Remember that
www.example.comandexample.comare different domains. - Check for JavaScript errors: Open your browser’s developer console (F12) and look for any errors. - Verify script loading: Check the Network tab to ensurewidget.latest.min.jsloads successfully. - Check for ad blockers: Some ad blockers may prevent the widget from loading.
Widget appears twice
Widget appears twice
This usually happens when the widget script is included multiple times.
Common causes: - Using both the config approach AND component approach
(e.g., in Astro/Starlight) - Script included in both layout template and
page template - SPA navigation re-initializing without proper cleanup
Solution: Ensure you only use ONE method to add the widget, and check
that
document.getElementById('guru-widget-id') guard is in place.Theme not syncing with website
Theme not syncing with website
- Ensure you’re using
data-light-mode="auto"for automatic detection - For custom theme sync, verify yourMutationObserveris watching the correct element and attribute - Check thatwindow.chatWidget.switchTheme()is being called after the widget loads
Widget not working on localhost
Widget not working on localhost
Create a separate Widget ID for your local development URL (e.g.,
http://localhost:3000 or http://localhost:* for any port).Next Steps
Example Questions
Configure example questions for your widget
API Reference
Explore our API documentation