Mautic-based personalisation in Drupal¶
Using a combination of our Drupal module “Mautic Personalisation“ and our Mautic plugin “Segments tracking”, you can personalise your Drupal content based on your segmentation in Mautic.
Mautic setup¶
- Make sure the “Segments tracking” plugin is loaded at /s/plugins.
- Make sure there is at least one application set up for your Drupal site at /s/credentials.
- Set up some Segments for which you might like to personalise your Drupal content at /s/segments.
Drupal setup¶
Drupal will need a Mautic connection to fetch the available segments.
- Make sure the “Mautic Personalisation” module is enabled.
- Add a Mautic connection by configuring it at /admin/config/services/mautic/api.
Connection details can be set up and consulted in Mautic at /s/credentials.
Info
The configuration form will let you know if the connection succeeded or not. In the next step, you can verify this again by checking if the segments are correctly fetched.
In order to track visitor behaviour and add them to segments, the Mautic tracking script will need to be loaded.
- Find the script in the “Tracking settings“ section of Mautic’s configuration at /s/config/edit.
- Add it to your Drupal site in any way.
Info
Loading the script via a script loading service like Google Tag Manager allows easy integration with cookie policies.
The Drupal module will use the Mautic tracking to fetch the user’s segments and save them in a cookie for local usage. This cookie can be configured in Drupal at /admin/config/services/mautic-personalisation if needed.
Finally, we should be able to add Mautic segment based block visibility conditions anywhere they are applicable.
Info
If the Mautic segment condition shows a text field in stead of a select field. The Mautic connection is not working correctly.
A soupy example¶
In this example, we will be scoring users' interest in soup and showing a personalised banner in Drupal if they really like soups. This example assumes the setup steps were executed properly.
- In Mautic, we set up the scoring for soup interest.
- Go to /s/points and set up a scoring action called “Soup lover”.
- We configure it to charge 10 points so we can get a quick result.
- We have it react to the contact action “Visits specific URL” and enter our soup-related URL(s).

- Still in Mautic, we now create a segment for contacts that have a good “soup score”.
- Go to /s/segments and add a segment called “Soup lovers”.
- Configure the filters to include “Points (soup)” greater than or equal to 10, so we only include users that have scored some points.

- At this point, any tracked user will start being assigned to this segment after visiting our soup article.
Info
Though anonymous users will get contacts in Mautic immediately, they only get assigned to segments when the segments are updated. This is done on a regular cron run.
- Now we move to the Drupal side and set up a new banner.
- Go to /admin/structure/block and add a new block to the desired region, creating a new “Content block”.
- For this example, we create a “Banner block” with some soup-related content.
- When we get to the configuration of this block, make sure to only show it for our newly created segment, using the “Mautic segment” condition settings.

Info
If any other banners are shown to all users, we can configure those to be hidden for this segment by adding the reversed condition on those blocks.
At this point, we have successfully added a personalised banner to our website, specifically for soup lovers!
We can validate this by going to the website as an anonymous user, navigating to our soup article and then back to any page showing our new block (in this case any page will do). Note that we might need to wait until our anonymous contact was added to the segment.
