Drupal Integration Guide

Learn how to add your Cloudpresser AI chatbot to your Drupal website.

Integration Steps

Drupal is a powerful content management system. Here's how to add your Cloudpresser AI chatbot:

Method 1: Using the Asset Injector Module

The easiest way to add your chatbot to Drupal is by using the Asset Injector module:

  1. Get your chatbot code:
  2. Install the Asset Injector module:
    • Go to Extend → Install new module
    • Search for "Asset Injector" and install it
    • Enable the module
  3. Add your chatbot code:
    • Go to Configuration → Development → Asset Injector
    • Click "Add a new JavaScript injector"
    • Give it a name like "Cloudpresser AI Chat"
    • Paste your chatbot code into the JavaScript field
    • Set "Placement" to "Head"
    • Configure any other settings as needed (like which pages to include/exclude)
    • Click "Save"

Method 2: Editing Your Theme

If you prefer to edit your theme directly:

  1. Locate your theme's html.html.twig file:
    • Navigate to themes/[your_theme]/templates/
    • Open the html.html.twig file (or create one if it doesn't exist by copying it from the core theme)
    • Add your chatbot code just before the closing </head> tag
    • Save the file
  2. Clear the cache:
    • Go to Configuration → Performance
    • Click "Clear all caches"

Tip: If you're using Drupal 8 or higher, you can also use the "Libraries API" to add your chatbot code in a more structured way.

Drupal Version Differences

Drupal 7

In Drupal 7, you can add the code to your theme's html.tpl.php file or use the "Add JS" module.

Drupal 8/9/10

In Drupal 8 and above, use the Asset Injector module or add the code to your theme's html.html.twig file.

Troubleshooting

Chatbot not appearing on the site

Ensure the code was added correctly and that you've cleared the Drupal cache. Try refreshing your browser cache or viewing in an incognito window.

Conflicts with other modules

If you have other chat or support modules installed, they might conflict with Cloudpresser AI Chat. Try temporarily disabling them to test.

Need Help?

If you're experiencing issues with the Drupal integration, please contact our support team at [email protected].