function MCAPI::campaignSegmentTest in Mailchimp 7
Same name and namespace in other branches
- 5.2 MCAPI.class.php \MCAPI::campaignSegmentTest()
- 5 MCAPI.class.php \MCAPI::campaignSegmentTest()
- 6.2 MCAPI.class.php \MCAPI::campaignSegmentTest()
- 6 MCAPI.class.php \MCAPI::campaignSegmentTest()
Allows one to test their segmentation rules before creating a campaign using them
Related
@example mcapi_campaignSegmentTest.php @example xml-rpc_campaignSegmentTest.php
Parameters
string $list_id the list to test segmentation on - get lists using lists():
array $options with 2 keys:: string "match" controls whether to use AND or OR when applying your options - expects "<strong>any</strong>" (for OR) or "<strong>all</strong>" (for AND) array "conditions" - up to 10 different criteria to apply while segmenting. Each criteria row must contain 3 keys - "<strong>field</strong>", "<strong>op</strong>", and "<strong>value</strong>" - and possibly a fourth, "<strong>extra</strong>", based on these definitions:
Field = "<strong>date</strong>" : Select based on various dates we track Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before) Valid Values: string last_campaign_sent uses the date of the last campaign sent string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns() string YYYY-MM-DD - any date in the form of YYYY-MM-DD - <em>note:</em> anything that appears to start with YYYY will be treated as a date
Field = "<strong>interests</strong>": Valid Op(erations): <strong>one</strong> / <strong>none</strong> / <strong>all</strong> Valid Values: a comma delimited of interest groups for the list - see listInterestGroups()
Field = "<strong>aim</strong>" Valid Op(erations): <strong>open</strong> / <strong>noopen</strong> / <strong>click</strong> / <strong>noclick</strong> Valid Values: "<strong>any</strong>" or a valid AIM-enabled Campaign that has been sent
Field = "<strong>rating</strong>" : allows matching based on list member ratings Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) Valid Values: a number between 0 and 5
Field = "<strong>ecomm_prod</strong>" or "<strong>ecomm_prod</strong>": allows matching product and category names from purchases Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah') Valid Values: any string
Field = "<strong>ecomm_spent_one</strong>" or "<strong>ecomm_spent_all</strong>" : allows matching purchase amounts on a single order or all orders Valid Op(erations): <strong>gt</strong> (>) / <strong>lt</strong> (<) Valid Values: a number
Field = "<strong>ecomm_date</strong>" : allow matching based on order dates Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before) Valid Values: string YYYY-MM-DD - any date in the form of YYYY-MM-DD
Field = An <strong>Address</strong> Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Address fields can still be used with the default operations below - this section is broken out solely to highlight the differences in using the geolocation routines. Valid Op(erations): <strong>geoin</strong> Valid Values: The number of miles an address should be within Extra Value: The Zip Code to be used as the center point
Default Field = A Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars() Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah') Valid Values: any string
Return value
integer total The total number of subscribers matching your segmentation options
File
- ./
MCAPI.class.php, line 246
Class
Code
function campaignSegmentTest($list_id, $options) {
$params = array();
$params["list_id"] = $list_id;
$params["options"] = $options;
return $this
->callServer("campaignSegmentTest", $params);
}