Website Widget Integration
Add Gurubase AI assistant to your website
You can try the widget live on getanteon.com to see how it works in a real-world setting.
You can add your Guru directly to your website using our widget. The widget adds an “Ask AI” button that opens a chat interface when clicked.
Prerequisites
Before adding the widget, make sure you have:
- A Guru on Gurubase (either on Gurubase.io or self-hosted)
- A Widget ID from your Guru’s settings
Getting Your Widget ID
- Click “My Gurus” under the profile
- 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
- Copy the generated Widget ID
Each Widget ID is restricted to work only on the specific domain it was created for. For example:
- If a Widget ID created for
https://www.example.com
will 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.com
will match any subdomain ofexample.com
http://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.
Make sure to create Widget IDs for each domain where you want to use the widget.
Basic Installation
Add this script to your website’s HTML:
For more examples like Astro - Starlight, Docusaurus, Mintlify, MKDocs, Next.js, JS, React, Remix, Sphinx, see our demo projects.
Configuration Options
Option | Description | Default |
---|---|---|
data-widget-id | Your widget ID (required) | - |
data-text | Button text | ”Ask AI” |
data-margins | Button positioning | {"bottom": "1rem", "right": "1rem"} |
data-light-mode | Light mode toggle. Possible values are "light" , "dark" , "auto" . Auto mode syncs the widget theme with the website’s theme | "dark" |
data-bg-color | Primary color | Fetched from Gurubase |
data-icon-url | Custom logo URL | Fetched from Gurubase |
data-name | Custom name | Fetched from Gurubase |
data-baseUrl | URL to your Gurubase backend. Only for self-hosted Gurubase. | Gurubase Cloud |
data-tooltip | Tooltip text | null |
data-tooltip-side | "top" , "bottom" , "left" , "right" , "top left" , "top right" , "bottom left" , "bottom right" | "left" |
data-overlap-content | Whether to overlap the main content or shrink its width with the sidebar | "false" |
Self-hosted Installation
If you’re using self-hosted Gurubase, you must set the Gurubase instance URL using the data-baseUrl
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
-
switchTheme(lightMode = null)
You can use this function to sync the theme of the widget with the theme of your website. It accepts an optional
lightMode
boolean parameter to force the widget to be in light/dark mode. 3 possible usages of this function:switchTheme()
: Toggle the themeswitchTheme(true)
: Force light modeswitchTheme(false)
: Force dark mode
This function can be accessed with
window.chatWidget.switchTheme();
An example usage is shown in the MKDocs example in the
theme-switch.js
script. It toggles the theme of the widget based on the MkDocs website by listening for changes in the theme and using this function with each change.
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)
After few minutes, you will see the “Ask AI” button in your GitBook documentation.
Source Code
The widget is open-source and available on GitHub where you can report issues, suggest features, and contribute improvements.