Integrating with Docusaurus
This guide explains how to integrate FormAgent.ai with your Docusaurus site. By doing so, you can provide an AI assistant to your Docusaurus site visitors.
Prerequisites
- You have a Docusaurus project set up
- You have a FormAgent.ai account
- You have obtained your Agent ID
Integration Steps
1. Configure docusaurus.config.js
Open your docusaurus.config.js
file and add or edit the scripts
section as follows:
const config = {
title: 'Your Site',
scripts: [
{
id: 'formagent-script',
src: 'https://formagent.ai/embed.js',
async: true,
defer: true,
'data-agent-id': 'YOUR_AGENT_ID', // Agent ID from FormAgent.ai
},
],
// Other settings
presets: [
// ...
],
};
module.exports = config;
2. Explanation of Settings
Parameter | Description |
---|---|
id | Unique identifier for the script |
src | URL of the FormAgent.ai embed script |
async | Enables asynchronous script loading |
defer | Enables deferred script loading |
data-agent-id | Agent ID obtained from FormAgent.ai |
Verifying Operation
- After saving your changes, rebuild your Docusaurus site:
npm run build
- Start the development server to check:
npm run start
- Open your site in a browser and confirm that the FormAgent.ai chat widget appears.
Troubleshooting
If the Chat Widget Does Not Appear
- Check for error messages in the browser console
- Confirm that your Agent ID is set correctly
- In the network tab, verify that
embed.js
is being loaded
Support
If you still have issues, you can get support in the following ways:
- Email: [email protected]
- Chat: Chat support within the dashboard
- Documentation: FormAgent.ai Documentation