This project is not covered by Drupal’s security advisory policy.
This module provides an advanced integration with Mautic.

JavaScript tracking
- Embedding mtc.js - putting the Mautic script into page attachments.
- Tracking pageviews - enable/disable tracking page visits.
- Tracking outbound links -
pageviewevent for external links. - Tracking mail links -
pageviewevent for links likemailto:someone@example.com. - Tracking phone links -
pageviewevent for links liketel:123456. - Tracking downloads -
pageviewevent for links to selected file types. - Lead parameters - an ability to send additional data with
pageviewrequests. For example - you can send the current user's e-mail to identify anonymous contacts in Mautic. Tokens can be used here (the module takes care of the additional cache dependencies coming from the token's contexts). - Script location - the module uses the Condition API to let you choose where the script should be visible. It works similar to block settings. You can track only relevant pages and save a lot of resources.
API connection
The module acts as a wrapper for the Mautic API library. It provides basic configuration (endpoint, credentials for Basic Auth) and allows to use API in your own code.
Unfortunately, the latest 3.1.0 release of the library has problems with Psr/Log. Therefore, I had to use the main branch. I will change it back when a new version of the library is released.
Example custom usage:
/** @var\Drupal\advanced_mautic_integration\MauticApiWrapperInterface $api_wrapper */
$api_wrapper = \Drupal::service('advanced_mautic_integration.api');
$api = $api_wrapper->getApi('contacts');
$lead_data = [
'email' => 'someone@example.com',
'firstname' => 'John Doe',
];
$api->create($lead_data);
For now, there is a built-in API integration that allows you to send Drupal user data to Mautic. It happens on user entity update/insert. You can set up a custom field mapping to suit your needs.
Additional information
The module is compliant with phpcs (Drupal/DrupalPractice), phpstan-drupal (at level 5) and eslint.
How does it relate to GTM?
You can achieve very similar tracking functionality with Google Tag Manager, but it's not out of the box. The module provides a simple solution that just works. In the future, it will be adjusted to use GTM as the source of the mtc.js script.
Project information
- Project categories: Integrations
17 sites report using this module
- Created by gpietrzak on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Drupal 11 Compatibility
Development version: 1.0.x-dev updated 21 May 2024 at 12:51 UTC

