You are here

function MCAPI::campaignSegmentTest in Mailchimp 6

Same name and namespace in other branches
  1. 5.2 MCAPI.class.php \MCAPI::campaignSegmentTest()
  2. 5 MCAPI.class.php \MCAPI::campaignSegmentTest()
  3. 6.2 MCAPI.class.php \MCAPI::campaignSegmentTest()
  4. 7 MCAPI.class.php \MCAPI::campaignSegmentTest()

Allows one to test their segmentation rules before creating a campaign using them

Related

@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 should contain 3 keys - "<strong>field</strong>", "<strong>op</strong>", or "<strong>value</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 - ny date in the form of YYYY-MM-DD - <i>note:</i> 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

Default Field = A Merge Var. Use <strong>Merge0-Merge15</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 190

Class

MCAPI

Code

function campaignSegmentTest($list_id, $options) {
  $params = array();
  $params["list_id"] = $list_id;
  $params["options"] = $options;
  return $this
    ->callServer("campaignSegmentTest", $params);
}