In this tutorial I am going to describe how we can add a Contact or Contacts to Mautic segment, it is possible to do this in many ways so I am explaining all of them below.
What is Mautic Segment ?
Segment(previously called Lead Lists) is a collection of Mautic Contacts(previously called Leads) grouped together with or without a common property. The whole purpose of the segment is to categorize and create data set out of contacts for various use cases of Mautic.
How to Add Contact to Segment in Mautic ?
There are many ways to do so these are listed below:
- Add to segment while importing contact(s).
- Select manually from contact list and use Change Segment option.
- Use Campaign Action `Modify contact’s segments` to add or change contact segment.
- Use Form submission action to add or change contact segment.
- Use Dynamic Segment or Segment Filters to add contact to a segment.
- Use Point triggers to add to or change contact segment.
- Use Mautic API to add or modify contact segment.
- Create custom event listeners and change segment programmatically.
Out of all the points mentioned above, I will not demonstrate point number 7 and 8 as this may take a whole post for itself and goes too technical. However if you are interested in Mautic Plugin Development do checkout the tutorial for that.
Import Contacts to Mautic Segment
This method allows you to import a contact to segment while you are importing the list of contacts. As you may know Mautic allows mass import of contacts from csv file. when you upload the file for importing contacts, you may choose a segment where to import. Steps are as follows:
- Go to Segments >
New
.- Fill in the Segment Name.
Save and Close
.
- Go to
Contacts
> downward arrow on top right of the screen >import
. - Browser the csv file and click
Upload
.- If needed, please adjust the delimiter and other parameters.
- From the dropdown choose the segment where you want to import the contacts.
- Finally Choose if you want to import in browser or in background. In my case I choose Import in Browser.
- Go to Segments, and you should be able to see the contacts in selected segments.
Add Manually from Contact List – Change Segments
- Go to
Contacts
. - Select the contact you want to add or remove from any segment.
- On the top of the list, click on drop down icon to open available options.
- Choose
Change Segments
from available options. - In the Popup you get two options to add and to remove from one or more segments.
- Choose the segments in relevant field.
- Click save to apply.
Change Contact Segment from Campaign
Mautic campaign is really powerful tool and the backbone of Mautic. It provides a ton of useful actions. Changing contact segment based on some action is one of these. To make the tutorial quick and easy to understand I have used the form based campaign. The steps are as follows:
- Create a campaign form (this is for demonstration only, you are free to use Segment as source of campaign trigger).
- Create single field of email, this will serve as contact identifier.
- Give this form a Name let’s say, “Campaign Trigger Form”.
- Save and Close.
- Create New Campaign.
- Go to
Campaigns
and clickNew
. - Fill in the Name of Campaign, let’s call it “Segment Change Campaign”.
- Launch Campaign Builder.
- Choose
Campaign Forms
as contact source. - Choose “Campaign Trigger Form” as the source form.
- Add Action,
Modify Contact's Segment
.- give some name to this node.
- Choose from drop down field, in which segment you want to add contact, or from which segment you want to remove contact.
- Click Add.
- Click Apply then Close Builder.
- Set Published switch to Yes.
- Save and Close campaign.
- Go to
- Test action by submitting the form.
- Go to
Components
>Forms
. - Click on drop down arrow next to the form created.
- Click on Preview from drop down menu.
- The form will appear in new tab.
- Fill in the email of contact.
- Submit the form.
- The contact will enroll in the campaign immediately.
- When the cron for campaign is executed, the action will execute and will move the contact as per Action node configuration.
- Go to
Form Submission to modify contact segment
This action is only available for Standalone Form
and NOT for Campaign Form.
The action is very simple, you need to create a standalone form and from the actions select Modify contact's segment
. Complete steps are listed as follows:
- Go to
Components
>Forms
. - Create New Form.
- From the popup choose,
New Standalone Form
. - Fill in the Form Name and other details as required.
- Create form fields from the Field tab.
- For testing purpose I have created only email field.
- Finally go to Actions tab to configure form submission action.
- From the drop down field under Actions tab, choose
Modify contact's segments
. - The popup will appear with configuration form.
- In the popup select the segments where to add the contact or from which to remove the contact.
- From the drop down field under Actions tab, choose
- Save and Close.
- From the popup choose,
- Test the form
- Just like in previous section, the testing of form is easy.
- Click on the drop down icon in from of form name in the list.
- Click on Preview from the drop down menu.
- Submit the form.
- The action will execute immediately and move contact as per configuration in Action tab.
The video demonstrate this process.
Segment Filters to add contact to a segment
Mautic segment provides a Filter tab, which can be usefull to automatically filter and segregate contacts into different segments. This can be done based on any contact field available within Mautic and even supports the custom field option. To use this feature, follow the steps below:
- Create a new segment.
- Enter the Segment name.
- Let’s call it “Dynamic Segment”
- Go to Filters tab.
- From the drop down field, choose the contact field you would like to filter upon.
- I’ll choose the
First name
field as I added a pattern to the contacts before importing them. - You will be provided with 2 new fields.
- One field is a comparison operator, which allows you to choose from variety of operators like, ‘equals’, ‘not equals’, ‘like’, ‘regex’ etc.
- Second field presented is to enter a value to compare against.
- So for example I want to filter and segregate all contacts having ‘fn’ in the First name field. So I’ll chose ‘like’ operator to compare against ‘fn’ value.
- Save and Close.
- When the next pass of
mautic:segment:update
cron tab is executed it’ll add all the matching contacts in this segment.
The Video demonstrate the process as follows:
Point triggers to modify contact segment
Point Side menu provides two options, One to take action and assign points when contact does something. Second is to take action when points reach a certain limit. We can use the second option in order to trigger the segment change action when contact acquires a certain number of points. For this here’s a demonstration and steps to follow:
- Go to
Points
>Manage Triggers
. - Create New Trigger.
- Name it whatever you would like to call, I’ll name it “Change Segment Trigger”.
- For demonstration purpose I am adding 2 as
Minimum number of points
. - In the
Events
tab, chooseModify contact's segments
from theAdd an event
drop down field. - Configure the popup for segments to add or to remove contact from.
- Save and Close.
- To Test the trigger, you can use any action to increase the points, I am using form previously created.
- Go to the standalone form created in previous section of this tutorial.
- Edit the form.
- Go to Actions Tab.
- Remove the action to modify contact’s segments.
- Add a new action from drop down field to
Adjust contact's points
. - Add 1 or 2 points, depending on your trigger value. In my demonstration I use 1 point, so I have to submit the form twice.
- Save and Close.
- Open the form and submit with an email.
- You will notice the point was allocated but segment didn’t change yet.
- Submit the form again with same email.
- This time you will notice point was allocated and Point Trigger also worked and contact segment was changed as well.
The Video tutorial demonstrate all the steps mentioned above.
As described in the introduction section all the 6 ways have been described above, if you have any queries related to any of these, please do comment below.