Our process
Drupal
Step-by-Step Guide to Adding AIChatAssist Script to a Drupal Website
-
1
Create the Custom Module
- Navigate to your Drupal installation directory.
- Create a new directory (modules/custom/add_bot)
-
2
Create Module Files
- Inside this folder, create the following files:
- add_bot.info.yml
- add_bot.module
-
3
name: 'Add Bot' type: module description: 'A module to add custom elements to the head section.' core_version_requirement: ^8 || ^9 || ^10 package: Custom
Update add_bot.info.yml
- Copy the code and paste in the file
-
4
'ai-assist-bot', ]; $variables['#attached']['html_head'][] = [$ai_assist_bot, 'ai_assist_bot']; // Add the stylesheet $stylesheet = [ '#tag' => 'link', '#attributes' => [ 'rel' => 'stylesheet', 'href' => 'https://cdn.jsdelivr.net/gh/Open-infotech/AiAssistJsLibForWeb@master/src/styles.3.css', ], ]; $variables['#attached']['html_head'][] = [$stylesheet, 'ai_assist_stylesheet']; // Add the script $script = [ '#tag' => 'script', '#attributes' => [ 'async' => 'async', 'src' => 'https://cdn.jsdelivr.net/gh/Open-infotech/AiAssistJsLibForWeb@master/src/bundle.8.js?key=your key', ], ]; $variables['#attached']['html_head'][] = [$script, 'ai_assist_script']; }
Update dd_bot.module
- Copy the code and paste in the file.
- Replace the key with your key you will find it in the generated script.
-
5
Enable the Custom Module
- Navigate to extend and search add bot or the name specified by you.
- Click on install.
-
6
Clear Cache
- Navigate to configuration and click performance.
- Click Clear all caches.
-
7
Verify Integration
- Preview Site: Click on "View site" or open your Drupal website in a new tab to see how the script is integrated.
- Test Functionality: Interact with the script (e.g., AI chatbot) to ensure it functions correctly across different pages of your Drupal website.
-
8
Troubleshooting
- Check Script Integration:
- Verify Script Placement: Double-check that the script is correctly placed in the header section or any other designated area in the theme settings.
- Syntax and Typos: Ensure there are no syntax errors or typos in the script code that could prevent it from executing properly.
- Script Loading: Use browser developer tools (right-click on your website and select "Inspect" or press Ctrl+Shift+I) to check for any console errors related to the script.
- Check for Conflicts:
- Disable Other Modules: Temporarily disable other Drupal modules or custom code snippets to check if there's a conflict with your script.
- ○ Restore to Default: If issues persist, revert any recent changes or updates to your Drupal site's theme settings to troubleshoot potential conflicts.
-
9
Seek Support
- Contact Script Support: If you encounter persistent issues related to the script's functionality or integration, contact the script's support team (e.g., AIChatAssist support) for assistance.
- Drupal Support: For platform-specific issues or if you need further guidance on integrating scripts, consult Drupal's documentation or community forums for additional resources.