User Tools

Site Tools

Translations of this page:

plugin:segment

Segment

—- plugin —-
description: Provides segmentation of the subscribers to which a campaign is sent using subscriber attributes and fields.
author : Duncan Cameron
type :
compatible : phplist 3
depends :
conflicts :
similar :
tags :

sourcerepo : https://github.com/bramley/phplist-plugin-segment
donationurl:


Purpose

This plugin provides flexible segmentation of subscribers when sending a campaign.

It allows you to filter the subscribers based on attribute values and subscriber data:

  • campaign activity
    1. was sent/was not sent a recent campaign or any campaign within a period
    2. opened/did not open a recent campaign or any campaign within a period
    3. clicked/did not click any link in a recent campaign or any campaign within a period
  • Entered date (the date they signed-up to phplist)
  • List entered date (the date they subscribed to one of the lists to which the message is being sent)
  • email address
  • subscriber id (the incrementing number assigned to each subscriber)
  • subscriber unique id (the 32 character value assigned to each subscriber)
  • List membership, belongs to ALL of the selected lists
  • any attribute value

When the campaign is sent then only those subscribers who meet either any or all of the conditions will be selected.

The filtering of subscribers happens when phplist is actually sending the campaign. As phplist processes each subscriber it calls the plugin to decide whether or not to send to that subscriber. Therefore, when phplist starts to process a campaign it will appear that it is sending to the complete list because at that point it does not know which subscribers will be selected by the plugin.

To ensure that you understand this approach, you should send a test campaign to a small list to confirm that the correct subscribers are selected.

Installation

phpList now includes this plugin, which can be enabled on the Manage Plugins page.

See the README file on the GitHub page https://github.com/bramley/phplist-plugin-segment for how to configure the plugin or upgrade to the latest version.

Support

Please raise any questions or problems in the user forum https://discuss.phplist.org/

Translations

The text displayed by the plugin can be translated into other languages. See the file plugins/SegmentPlugin/lan/translations_en.php for the English version that can be used as the basis for another language. Each line in the file contains the English text then the equivalent text in the target language.

To create a new language file, copy translationsen.php to translationsxx.php, where xx is the language code, then change the texts for your target language. You can share your new language file by submitting it for inclusion in the plugin. Please create a topic in the user forum or an issue on GitHub.

Usage

Add segment conditions

The plugin adds a tab to the Send a campaign page on which you can create segment conditions to filter the subscribers who will receive the campaign.

You can choose whether subscribers must meet all conditions or any of the conditions. Then add one or more conditions:

  1. select an attribute or a subscriber field from the drop-down list.
  2. the page will then refresh automatically showing a list of the operators for the selected field and a target input field.
  3. select an operator and then enter or select the target value

Any number of conditions can be created but usually one or two should be sufficient. Then click the Calculate button to see how many subscribers will be selected when the campaign is actually sent.

Calculating the number of subscribers

The plugin calculates the number of subscribers using the lists chosen on the Lists tab. It selects only those subscribers who belong to the lists and who meet either any or all of the conditions. Also, it excludes unconfirmed or blacklisted subscribers, any subscribers who have already received the campaign, and subscribers who belong to excluded lists.
A warning will be displayed if there are any incomplete conditions, where the target value has not been selected.

The calculation provides an idea of the number of subscribers using the current data. When the campaign is actually sent the plugin selects the subscribers again. Therefore, if there have been new subscriptions, changes to attribute values etc. in the interim, then the number of subscribers actually selected can differ.

On anniversary operator

This operator can be used when you have a date attribute holding the date of an event, such as birth date. It is used to send a campaign to subscribers on the anniversary of that date, such as the birthday. For this to work effectively you need to set the campaign to requeue each day and ensure that the queue is processed regularly, ideally using a cron job.

When you initially create the campaign and select this operator on the Segment tab the calculation of subscribers will include those whose anniversary is the current day. That will be accurate if the campaign is to be first sent on the same day, but the actual subscribers selected will definitely be different if the campaign is sent on a later day. It is still useful to see the number of subscribers for the current day in order to be confident of the calculation's accuracy.

After interval operator

When the “after interval” operator is used for the “Date signed-up to phplist”, the “Date subscribed to list”, or a date attribute, the calculation will include subscribers who meet the condition for the current day. That will be accurate if the campaign is sent on the same day, but the actual subscribers selected will definitely be different if the campaign is sent on a later day. Still, it is useful to see the number of subscribers for the current day in order to be confident of the calculation's accuracy.

The plugin displays the first 50 subscribers' email addresses to help confirm that the conditions have been specified correctly. The limit of 50 can be changed on the Settings page.

When the subscribers are displayed the full set of selected subscribers can be downloaded.

Processing the queue

When phplist processes the message queue the plugin selects the subscribers who meet the conditions for each message. It writes a record to the event log showing the number of subscribers selected.

Entering the target value

Field / Attribute typeEntering the target value
textline, textarea, hidden attributes, email address, subscriber id and unique idEntered directly in the text field.
select, radio button attributesSelected from the multi-select list box.
Entered date and date attributesA date is selected using the date-picker control.
An interval is entered directly in the text field and can be a number of days, weeks, months, quarters or years. For example 15 days
checkbox attributesThese do not have target values.
checkboxgroup attributesSelected from the multi-select list box.
campaign activityA prior campaign is selected from the drop-down list. The list contains only campaigns sent to the lists selected on the Lists tab.
For the “opened” and “did not open” operators the campaign activity also contains aggregated campaigns, any sent within the past 7 days, one month, or three months.

Choosing target values from a multi-select list

The target values for select, radio button, and checkbox group attributes are presented as a multi-select list. When target values have not yet been chosen then the list will be displayed similarly to this

To show the list of values you need to click the area

Then you can select one or more target values, after which they will be displayed similarly to this

Evaluating conditions

OperatorHow the condition is evaluated
“is” and “is not”The attribute value is compared directly with the target value.
“is blank” and “is not blank”The attribute value is compared directly with an empty string.
“matches” and “does not match”These operators use the mysql LIKE operator. This means that you need to include % or _ characters (sql wildcard characters) as necessary. See the mysql reference manual for guidance on using the LIKE operator.
As an example, to match email addresses on the gmail.com domain the target value should be %gmail.com
“REGEXP” and “not REGEXP”These operators use the mysql REGEXP operator. See the mysql reference manual for guidance on using regular expressions in mysql.
As an example, to match email addresses on the gmail.com or yahoo.co.uk domains the target value should be (yahoo.co.uk|gmail.com)$.
Or to select an arbitrary 20% of subscribers using the subscriber id field the target value could be [01]$. This selects subscribers whose id ends in 0 or 1, which will select approximately 20% of subscribers.
“is included” and “is not included”These operators test whether a subscriber email address is included or is not included in a set of email addresses. The target email addresses should be entered one on each line.
“is before” and “is after”These operators compare the date part of the Entered date or attribute date with the target date, and test for being less than and greater than respectively.
Note that if you want to match subscribers who have subscribed since, and including, 1 January 2014 then the target date will need to be 31 December 2013 in order to include 1 January.
“is between”This operator compares the date part of the Entered date or attribute date with two target dates, and tests for it being greater than or equal to the first value, and less than or equal to the second value.
“after interval”
plugin/segment.txt · Last modified: 2023/03/17 17:45 by duncanc

Resources
Contact Us

e: info@phplist.com

Boring Bit

phpList is a registered limited company

UK Company No. 07582966

VAT Registration 122 0788 37

© phpList 2016