Importing a segment from csv on existing contacts

Your software
My Mautic version is: 3.1.0
My PHP version is: 7.2

Your problem
My problem is:
I’ve read that it’s possible to import contacts from a csv file and assign them to a segment.
I would like to import only a segment without creating contacts.
Say I need yo create a very complex selection of contacts, not possible inside Mautic, I would like to create it inside the db, and then export a list of contacts to a csv file.
Is it possible in some way? I could do this via db, but i would like to let non tech-savvy users do it by themselves

  1. Do the users already exist in Mautic ? If not I am not sure how you can create a segement of them.
  2. If you were to do it inside mysql/mariadb you need to be careful of all the different tables and indexes between them. What you could do it to add a specific tag in the tags table and then create a segment based on that tag and that would do it.

If I understood your question correctly ( How do I import contacts directly into a segment without creating any contacts) I would think: because mautic creates AND updates contacts when importing, you could import the contacts directly to the segment and it would essentially create no new contacts but update the existing to be included in the aforementioned segment. Export from there I suppose.

If you are asking how to create segments using variables present in the database but not selectable on the segment filter screen Id ask for an example of what variables you are referring to.

Yes you can import contacts and assign them to a segment, but by doing that you’ll lose the ability to dynamically change the segment’s content.

I suggest to do this:

  1. make a csv with your segment
  2. By the import use the ‘add tag’ in import settings and and tag them as ‘messysegment’. All contacts will have the ‘messysegment’ tag.
  3. Create a filter with ‘messysegment’ and start your communication with them.

Good luck!

Hi Joey,
I am trying to only add a segment. I already have all the contacts in the db, but sometimes I need very special segmenting, so I would like to only import the segment for contacs already in the db.
Any suggestion?

Hi Mike,
users already exist.
As an example, I sometime need to send an email to a list provided from a client, or maybe a list that excludes users the client has already.
So we do a match between our db and the list of the client, and it results with a list of users that need to be excluded/included.
It’s impossible to create such a list based on some criteria.
So I would like to create a segment of already existing users, importing a csv with all ids listed

There are many creative ways around this.

One is to use tags, and when you upload a certain list, you can add tags to all the contacts being imported, then you can create segments based on tags present or excluding tags.

You can also create custom fields for example one with the name data_source (and here put in the client name).

In general, do you advise to use tags instead of segments? Can you elaborate on losing the ability to dynamically change a segments’ content?

There is no right and wrong.
I like to use tags and custom fields to designate a main attribute to all the contacts on a certain list. That tag stays no matter what segment the person is.
Segments represent a group of contacts you’d like to target with communication. Segments are recalculated all the time and their content can change based on the filters you use.

For example I’m a cosmetics company selling soaps and bath balls.
I have 5 lists:

  1. Contacts who have a Bath
  2. Big spenders, with spending vaule in last 360 days
  3. Contacts with large families
  4. Loyal customers
  5. Contacts, who purchased by me in the past 60 days, with purchase date

Would I import 5 segments? I could, but it’s much easier to create fields like:

  1. New filed: Has bath (yes/no)
  2. New field: amount spent in last 360 days
  3. New tag: large family
  4. New tag: Loyal customer
  5. New Date field: date of last purchase

Now I have the ability to create multiple cool automations by dynamically creating the segments:

  1. Contacts that just purchased (how did you like it campaign)
  2. Big spenders who haven’t purchased for a while (Come back campaign)
  3. Loyals who haven’t purchased for a while (Free gift campaign)
  4. People with bath who have never purchased: (Try the bath balls)
  5. People with large families, haven’t bought anything for 30 days: Free shipping above XX

Good luck!


That’s food for thought. Thanks!