Mautic Community Forums

Segment Counts are Wrong

I’ve put off posting on this long enough to make sure it’s not just me. It’s not just me.



Mautic does not calculate segment totals and membership correctly.

I created three groups:

  • One (everyone active) contains all contacts with non-empty email and both unsubscribe email and unsubscribe sms not equal to “yes”. I get one count (4,500 something).
  • One, “news only” is just like the other, only adding the filter “interest=N”
  • One, “everything but news” it just like the second, only interest not equal to “N”.



    After manually running the segment update job through SSH, the membership counts of the second two segments should, but definition, add up to that of the first. They don’t. They come out 167 short.



    I created a fourth segment that contains all members the everyone segment that aren’t in either of the other two groups. It contains 167 members, but I have no idea why. All these 167 are “Do not contact,” but that doesn’t matter. The first three lists should foot (in accounting parlance) because the filter criteria for the second two lists are mutually exclusive, and subsets of the filter for the first. Clearly, mautic is excluding these 167 members from the news and everything but new lists, but there is nothing in the filter criteria to indicate why. Worse, 167 people who are “do not contact” are getting email everything I run a campaign. That’s bad.



    So fine. Apparently, Mautic has added something internally to the filters, something not exposed by the interface. So I go to the database.

    In the leads_list (segments) table, I find my two segments, news and non-news. I edit each, and copy paste the filter from non-news to news. Now the two segments are identical. But they aren’t. When I run the segment update, the counts differ by 4 members. 4. WTF? How can two segments with IDENTICAL filter expressions–as stored in the database–come up with different memberships. WTEF?



    Here is the filter expression used by both segments: a:4:{i:0;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:5:“email”;s:6:“object”;s:4:“lead”;s:4:“type”;s:5:“email”;s:6:“filter”;N;s:7:“display”;N;s:8:“operator”;s:6:"!empty";}i:1;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:8:“interest”;s:6:“object”;s:4:“lead”;s:4:“type”;s:4:“text”;s:6:“filter”;s:1:“N”;s:7:“display”;N;s:8:“operator”;s:2:"!=";}i:2;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:16:“dnc_unsubscribed”;s:6:“object”;s:4:“lead”;s:4:“type”;s:7:“boolean”;s:6:“filter”;i:1;s:7:“display”;N;s:8:“operator”;s:2:"!=";}i:3;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:20:“dnc_unsubscribed_sms”;s:6:“object”;s:4:“lead”;s:4:“type”;s:7:“boolean”;s:6:“filter”;i:1;s:7:“display”;N;s:8:“operator”;s:2:"!=";}}



    I did the copy paste because it obviously would be unrevealing and counterproductive for me to try to reverse engineer and debug that expression.

    I modified my fourth “footing” segment to see these four discrepancy contacts (the delta between news and non-news), and they are unremarkable, active contacts. WTF?



    At this point, I give up. I don’t know the Mautic database well enough or have enough experience with the database tools on my hosting provider to productively debug this.



    What I know is, 1. my campaigns are sending emails to people who have unsubscribed. 2. People who’ve asked to receive emails are not receiving any. 3. I cannot trust the segment counts reported by Mautic to be more than roughly sort of close.



    Why is this happening? How do I fix it?



    Unfortunately, I can’t see how to tell what database query Mautic is translating the filter expression into. But again, it doesn’t matter. If the filter expression is identical, the generated query should be identical.

I’ve put off posting on this long enough to make sure it’s not just me. It’s not just me.

Mautic does not calculate segment totals and membership correctly.
I created three groups:

  • One (everyone active) contains all contacts with non-empty email and both unsubscribe email and unsubscribe sms not equal to “yes”. I get one count (4,500 something).
  • One, “news only” is just like the other, only adding the filter “interest=N”
  • One, “everything but news” it just like the second, only interest not equal to “N”.

After manually running the segment update job through SSH, the membership counts of the second two segments should, but definition, add up to that of the first. They don’t. They come out 167 short.

I created a fourth segment that contains all members the everyone segment that aren’t in either of the other two groups. It contains 167 members, but I have no idea why. All these 167 are “Do not contact,” but that doesn’t matter. The first three lists should foot (in accounting parlance) because the filter criteria for the second two lists are mutually exclusive, and subsets of the filter for the first. Clearly, mautic is excluding these 167 members from the news and everything but new lists, but there is nothing in the filter criteria to indicate why. Worse, 167 people who are “do not contact” are getting email everything I run a campaign. That’s bad.

So fine. Apparently, Mautic has added something internally to the filters, something not exposed by the interface. So I go to the database.
In the leads_list (segments) table, I find my two segments, news and non-news. I edit each, and copy paste the filter from non-news to news. Now the two segments are identical. But they aren’t. When I run the segment update, the counts differ by 4 members. 4. WTF? How can two segments with IDENTICAL filter expressions–as stored in the database–come up with different memberships. WTEF?

Here is the filter expression used by both segments: a:4:{i:0;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:5:“email”;s:6:“object”;s:4:“lead”;s:4:“type”;s:5:“email”;s:6:“filter”;N;s:7:“display”;N;s:8:“operator”;s:6:"!empty";}i:1;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:8:“interest”;s:6:“object”;s:4:“lead”;s:4:“type”;s:4:“text”;s:6:“filter”;s:1:“N”;s:7:“display”;N;s:8:“operator”;s:2:"!=";}i:2;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:16:“dnc_unsubscribed”;s:6:“object”;s:4:“lead”;s:4:“type”;s:7:“boolean”;s:6:“filter”;i:1;s:7:“display”;N;s:8:“operator”;s:2:"!=";}i:3;a:7:{s:4:“glue”;s:3:“and”;s:5:“field”;s:20:“dnc_unsubscribed_sms”;s:6:“object”;s:4:“lead”;s:4:“type”;s:7:“boolean”;s:6:“filter”;i:1;s:7:“display”;N;s:8:“operator”;s:2:"!=";}}

I did the copy paste because it obviously would be unrevealing and counterproductive for me to try to reverse engineer and debug that expression.
I modified my fourth “footing” segment to see these four discrepancy contacts (the delta between news and non-news), and they are unremarkable, active contacts. WTF?

At this point, I give up. I don’t know the Mautic database well enough or have enough experience with the database tools on my hosting provider to productively debug this.

What I know is, 1. my campaigns are sending emails to people who have unsubscribed. 2. People who’ve asked to receive emails are not receiving any. 3. I cannot trust the segment counts reported by Mautic to be more than roughly sort of close.

Why is this happening? How do I fix it?

Unfortunately, I can’t see how to tell what database query Mautic is translating the filter expression into. But again, it doesn’t matter. If the filter expression is identical, the generated query should be identical.