This module integrates Drupal with Mautic, enabling Mautic's tracking script on selected pages with custom events and data. It also provides API access to Mautic and can synchronize Drupal users to Mautic contacts.
Advanced Mautic Integration connects Drupal and Mautic. It tracks what visitors do and shows Mautic's popups and bars on the pages you choose, waiting for the visitor's consent when the consent gate is on, and lets your own code call the Mautic API, with an optional sync of Drupal users to Mautic contacts.
Features
- ๐ Tracking beyond page views. Page views, clicks on outbound links, on
mailto:andtel:links, and on links to the file extensions you list, each sent to Mautic as a page view.Drupal.mt_send()sends events of your own from any script, once per URL and page load. - ๐ค Contact data with every event. Default parameters, a JSON object with tokens, go with every event, so
{"email": "[current-user:mail]"}ties a signed-in visitor to their Mautic contact. Parameters that resolve to nothing are dropped, never sent as blanks. Drupal users can also be pushed to Mautic contacts when they are created or updated, with a field mapping you write. - โ๏ธ Placed with block conditions. Where the tracker loads is decided by the condition plugins block placement uses: pages, roles, content types, languages, and the conditions other modules add, such as Mautic segments from Mautic Audiences.
- ๐ฌ Focus items. Mautic's popups, bars and notifications are placed from a Focus items tab, each with conditions of its own, and loaded by the tracker's code, so they wait for consent like the tracker. With the API configured, the Focus item is picked from a list read from Mautic.
- ๐ก๏ธ Nothing before consent. With the consent gate on, no request reaches Mautic and no cookie is set until a consent manager reports that the visitor agreed. The page views raised meanwhile, the landing page included, wait in the browser and are sent if consent follows.
- ๐งฉ Klaro sub-module. Installing it turns the gate on, creates a
mauticKlaro service when the site has none, and reports every decision the visitor makes. The status report flags a disabled service and anonymous visitors without the permission to use Klaro. Any other consent manager answers through one JavaScript function. - โก Cache friendly. The tracker and its settings arrive in a placeholder rendered on every request, so a default parameter that names the visitor keeps the page in the Dynamic Page Cache.
- ๐ The Mautic API for your code. The
advanced_mautic_integration.apiservice hands out the Mautic API library's objects already authenticated, and an alter hook lets your code travel with the tracker, such as a consent integration of your own.
Quick start
composer require drupal/advanced_mautic_integration drush en advanced_mautic_integration
- At Configuration > Web services > Advanced Mautic Integration, enter the Mautic base URL, for example
https://mautic.example.com, and tick the events to track. - In Mautic, add the site's address to the CORS settings, so the tracking requests go through.
- If the site asks for consent with Klaro,
drush en advanced_mautic_integration_klaro: the tracker then waits for the visitor to accept the Mautic service. - Open a page as a visitor and accept: the visit appears in Mautic as a page view of an anonymous contact.
A Focus item: Mautic's newsletter popup, chosen from the list the API returns, kept off the cart and the checkout, and shown only to anonymous visitors.
Good to know
- The tracker sends Mautic the address and title of each page and the clicks you chose to track, plus the default parameters. Mautic sets its own cookies when the tracker or a Focus item loads. With the consent gate off, that happens on the first page view, before the visitor makes any choice.
- A withdrawal stops every further event. It cannot unload a script the browser already has, and removing the cookies Mautic set is the consent manager's job.
- The module decides the pages a Focus item goes on; the item's settings in Mautic decide the moment and how often it shows. A delay counts from the moment the script loads, which with the gate on is the moment the visitor agreed.
- Mautic code embedded any other way, such as a snippet in an asset injector, is not held by the gate. The README shows how to load it from the same decision.
- Every Mautic field used in the default parameters has to be Publicly updatable in Mautic, and the API side needs basic authentication enabled in Mautic's API settings.
Additional requirements
- Drupal 10.3 or later, or Drupal 11, on PHP 8.2 or later.
- Token.
- The Mautic API library, which Composer installs with the module.
- A Mautic instance that allows the site's address in its CORS settings, with its API enabled for the API side.
- Klaro Cookie & Consent Management, for the Klaro sub-module.
Recommended modules/libraries
- Mautic Audiences: shows each visitor the content meant for their Mautic segments and tags, and adds those segments to the conditions of the tracker and the Focus items.
- Commerce Mautic Connect: sends Drupal Commerce carts, coupon codes, order metrics and customer details to Mautic, through this module's connection.
- AI Mautic: lets an AI agent or an MCP client look up and change Mautic contacts, segments, campaigns, tags and points.
- Consent Audit: records every request to another site and every new cookie while the visitor has not consented, to check that the gate, and everything else on the page, waits.
Similar projects
Advanced Mautic Integration Mautic Integration Tracker and page views โ โ Outbound, mail, phone and download clicks โ โ Contact data with every event โ โ Where the tracker loads Any condition plugin A list of paths Waits for consent โ โ Focus items โ โ Mautic API and user synchronization โ โ Acquia Personalization fields โ โ Drupal 11 โ โMautic Integration adds the tracker to every page outside a list of paths, skips 403 and 404 pages, and can send Acquia Personalization data. Its latest release, 8.x-1.13 from September 2022, supports Drupal 8.8 to 10. The README explains how to move from it.
Community documentation
- README: every setting, Focus items, the consent contract with recipes for Klaro and EU Cookie Compliance, gating other Mautic code, the API, user synchronization, and moving from Mautic Integration.
Supporting this module
Created by Grzegorz Pietrzak. Developed and maintained by Bloomidea. Bloomidea offers support and custom development for this module.
Ask your assistant about Advanced Mautic Integration
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
3 tracked projects depend on this one
- Commerce Mautic Connect 5 sites
- Mautic Audiences 2 sites
- AI Mautic
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-beta1 | Pre-release | 10 | Dec 11, 2023 | ||
| 1.0.x-dev | Dev | 10โ11 | Dec 11, 2023 |