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 login() 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 must contain 3 keys - "field", "op", and "value" - and possibly a fourth, "extra", 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 - any 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 Field = "rating" : allows matching based on list member ratings Valid Op(erations): eq (=) / ne (!=) / gt (>) / lt (<) Valid Values: a number between 0 and 5 Field = "ecomm_prod" or "ecomm_prod": allows matching product and category names from purchases Valid Op(erations): eq (=) / ne (!=) / gt (>) / lt (<) / like (like '%blah%') / nlike (not like '%blah%') / starts (like 'blah%') / ends (like '%blah') Valid Values: any string Field = "ecomm_spent_one" or "ecomm_spent_all" : allows matching purchase amounts on a single order or all orders Valid Op(erations): gt (>) / lt (<) Valid Values: a number Field = "ecomm_date" : allow matching based on order dates Valid Op(eration): eq (is) / gt (after) / lt (before) Valid Values: string YYYY-MM-DD - any date in the form of YYYY-MM-DD Field = An Address Merge Var. Use Merge0-Merge30 or the Custom Tag 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): geoin 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 Merge0-Merge30 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?? |