Back to Documentation Overview
campaignSegmentTest
public static campaignSegmentTest(string apikey, string list_id, array options)
Allows one to test their segmentation rules before creating a campaign using them
- Section:
- Campaign Related
- Parameters:
apikey a valid API Key for your user account. Get by calling Get by visiting your API dashboard list_id the list to test segmentation on - get lists using lists() options with 2 keys: string "match" controls whether to use AND or OR when applying your options - expects "any" (for OR) or "all" (for AND) array "conditions" - up to 10 different criteria to apply while segmenting. Each criteria row should contain 3 keys - "field", "op", or "value" based on these definitions: Field = "date" : Select based on various dates we track Valid Op(eration): eq (is) / gt (after) / lt (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 - note: anything that appears to start with YYYY will be treated as a date Field = "interests": Valid Op(erations): one / none / all Valid Values: a comma delimited of interest groups for the list - see listInterestGroups() Field = "aim" Valid Op(erations): open / noopen / click / noclick Valid Values: "any" or a valid AIM-enabled Campaign that has been sent Default Field = A Merge Var. Use Merge0-Merge15 or the Custom Tag you've setup for your merge field - see listMergeVars() Valid Op(erations): eq (=)/ne(!=)/gt(>)/lt(<)/like(like '%blah%')/nlike(not like '%blah%')/starts(like 'blah%')/ends(like '%blah') Valid Values: any string - Returns:
- integer - total The total number of subscribers matching your segmentation options
- <?php
- /**
- This Example shows how to test a List Segment for use with a new campaign
- via the MCAPI class.
- **/
- require_once 'inc/MCAPI.class.php';
- require_once 'inc/config.inc.php'; //contains apikey
- $retval = $api->campaignSegmentTest($listId, $opts );
- if ($api->errorCode){
- } else {
- }
- <?php
- /**
- This Example shows how to test a List Segment for use with a new campaign using
- XML-RPC.
- Note that we are using the PEAR XML-RPC2 client and recommend others do as well.
- **/
- require_once 'XML/RPC2/Client.php';
- require_once 'inc/config.inc.php';
- try {
- $result = $client->campaignSegmentTest($apikey, $listId, $opts );
- } catch (XML_RPC2_FaultException $e){
- }
Examples (2)
download example code[1] mcapi_campaignSegmentTest.php
[2] xml-rpc_campaignSegmentTest.php
|
Add New Note
User Contributed Notes for
campaignSegmentTest |
|---|
| No notes, yet... Will you be the first?? |