Drupal Integration Guide
Complete guide to integrate MyFormConnect with Drupal
Integrate MyFormConnect with your Drupal website to capture leads from contact forms, webforms, and custom forms. Drupal powers over 1 million websites worldwide and offers powerful content management capabilities.
Prerequisites
- A MyFormConnect account - Sign up here
- Your MyFormConnect integration code from your dashboard
- Drupal admin access (Administrator role)
- Drupal 8.x, 9.x, or 10.x installation
- Basic understanding of Drupal modules (for custom module method)
Integration Methods
Custom Module
Create a custom Drupal module for MyFormConnect integration. This is the most maintainable and Drupal-friendly approach.
Create Module Directory
- Navigate to
/modules/customin your Drupal root directory - Create a new directory called
myformcapture_integration - Create the module info file
myformcapture_integration.info.yml
name: 'MyFormConnect Integration'
type: module
description: 'Integrates MyFormConnect lead capture widget with Drupal'
package: Custom
core_version_requirement: ^8 || ^9 || ^10
version: '1.0.0'
dependencies:
- drupal:system
Important Note
Create Module Files
- Create
myformcapture_integration.modulefile - Create
myformcapture_integration.libraries.ymlfile - Create
js/myformcapture.jsfile in your module directory
<?php
/**
* @file
* MyFormConnect Integration module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function myformcapture_integration_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.myformcapture_integration':
return '<p>' . t('MyFormConnect integration for capturing leads.') . '</p>';
}
}
/**
* Implements hook_page_attachments().
*/
function myformcapture_integration_page_attachments(array &$attachments) {
$attachments['#attached']['library'][] = 'myformcapture_integration/myformcapture';
}
Important Note
Create Library Definition
myformcapture:
js:
js/myformcapture.js: {}
dependencies:
- core/drupal
- core/jquery
Important Note
Add JavaScript File
(function ($, Drupal, drupalSettings) {
'use strict';
Drupal.behaviors.myformcaptureIntegration = {
attach: function (context, settings) {
// Use once() to ensure the script only runs once per element
$(context).find('body').once('myformcapture').each(function() {
// Load MyFormConnect script dynamically
var script = document.createElement('script');
script.src = 'https://widget.callmebackbutton.com/widget.js';
script.setAttribute('data-account', 'YOUR_ACCOUNT_ID');
script.setAttribute('data-drupal', 'true');
document.head.appendChild(script);
});
}
};
})(jQuery, Drupal, drupalSettings);
Important Note
Enable and Test Module
- Go to Extend in your Drupal admin
- Find 'MyFormConnect Integration' and check the checkbox
- Click Install
- Clear cache via Configuration → Performance → Clear all caches
- Visit your site to verify the widget appears
Important Note
Related Integrations
References & Official Documentation
Next Steps
Configure MyFormConnect
- Set up your timezone
- Configure lead notifications
- Set up advanced spam detection
- Add team members to your account
Advanced Features
- Use our custom form templates
- Try AI Insights for Leads
- Integrate with your CRM
- Set up automated workflows