Add Ask AI Button to GitBook
Integrate the Ask AI Button into your GitBook documentation.
Method 1: Custom HTML Integration
Step 1: Open GitBook Integrations
- Open your GitBook space
- Click Integrations in the space menu
- Search for Custom HTML
- Click Configure
Step 2: Add the Code
Add this code to the Custom HTML integration:
html
<script>
window.aaib = {
projectId: 'YOUR_PROJECT_ID'
};
</script>
<script src="https://cdn.ask-ai-button.io/loader-v1.js" async></script>Step 3: Save
Click Save to apply. The Ask AI Button will appear on all pages.
Method 2: Custom Head Tags
If your GitBook plan supports advanced customization:
Step 1: Access Customization
- Go to GitBook space settings
- Navigate to Customize → Advanced
- Select Custom head tags
Step 2: Add the Script
html
<script>
window.aaib = {
projectId: 'YOUR_PROJECT_ID',
theme: 'auto' // Matches GitBook's theme
};
</script>
<script src="https://cdn.ask-ai-button.io/loader-v1.js" async></script>Configuration for GitBook
For GitBook-specific settings:
javascript
window.aaib = {
projectId: 'YOUR_PROJECT_ID',
theme: 'auto', // Syncs with GitBook's light/dark mode
position: {
bottom: '24px',
right: '24px'
},
zIndex: 10000 // Ensures button appears above GitBook elements
};See Configuration Parameters for all available options.
Indexing GitBook Content
Add your GitBook URL as a documentation source in your Ask AI Button dashboard. The content will be automatically crawled and indexed.
Tutorial
Read our guide: How to Add AI Chatbot to GitBook.
Source
View the integration source code: github.com/aaibt/ask-ai-button/tree/main/integrations/gitbook