function MCAPI::campaignCreate in Mailchimp 6
Same name and namespace in other branches
- 5.2 MCAPI.class.php \MCAPI::campaignCreate()
- 5 MCAPI.class.php \MCAPI::campaignCreate()
- 6.2 MCAPI.class.php \MCAPI::campaignCreate()
- 7 MCAPI.class.php \MCAPI::campaignCreate()
Create a new draft campaign to send
Related
@example mcapi_ .php @example xml-rpc_campaignCreate.php @example xml-rpc_campaignCreateABSplit.php @example xml-rpc_campaignCreateRss.php
Parameters
string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "trans":
array $opts a hash of the standard options for this campaign :: string list_id the list to send this campaign to- get lists using lists() string subject the subject line for your campaign message string from_email the From: email address for your campaign message string from_name the From: name for your campaign message (not an email address) integer template_id optional - use this template to generate the HTML content of the campaign array tracking optional - set which recipient actions will be tracked, as a struct of boolean values with the following keys: "opens", "html_clicks", and "text_clicks". By default, opens and HTML clicks will be tracked. string title optional - an internal name to use for this campaign. By default, the campaign subject will be used. boolean authenticate optional - set to true to enable SenderID, DomainKeys, and DKIM authentication, defaults to false. array analytics optional - if provided, use a struct with "service type" as a key and the "service tag" as a value. For Google, this should be "google"=>"your_google_analytics_key_here". Note that only "google" is currently supported - a Google Analytics tags will be added to all links in the campaign with this string attached. Others may be added in the future boolean inline_css optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false. boolean generate_text optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false.
array $content the content for this campaign - use a struct with the following keys:: "html" for pasted HTML content "text" for the plain-text version "url" to have us pull in content from a URL (will replace any "html" content you pass in - can be used with "generate_text" option as well).
If you chose a template instead of pasting in your HTML content, then use "html_" followed by the template sections as keys - for example, use a key of "html_MAIN" to fill in the "MAIN" section of a template. Supported template sections include: "html_HEADER", "html_MAIN", "html_SIDECOLUMN", and "html_FOOTER"
array $segment_opts optional - if you wish to do Segmentation with this campaign this array should contain: see campaignSegmentTest(). You should test your options against campaignSegmentTest() as campaignCreate() will not allow you to set a segment that includes no members. Also, "trans" campaigns <strong>do not</strong> support segmentation.:
array $type_opts optional -: For RSS Campaigns this, array should contain: string url the URL to pull RSS content from - it will be verified and must exist
For A/B Split campaigns, this array should contain: string split_test The values to segment based on. Currently, one of: "subject", "from_name", "schedule". NOTE, for "schedule", you will need to call campaignSchedule() separately! string pick_winner How the winner will be picked, one of: "opens" (by the open_rate), "clicks" (by the click rate), "manual" (you pick manually) integer wait_units optional the default time unit to wait before auto-selecting a winner - use "3600" for hours, "86400" for days. Defaults to 86400. integer wait_time optional the number of units to wait before auto-selecting a winner - defaults to 1, so if not set, a winner will be selected after 1 Day. integer split_size optional this is a percentage of what size the Campaign's List plus any segmentation options results in. "schedule" type forces 50%, all others default to 10% string from_name_a optional sort of, required when split_test is "from_name" string from_name_b optional sort of, required when split_test is "from_name" string from_email_a optional sort of, required when split_test is "from_name" string from_email_b optional sort of, required when split_test is "from_name" string subject_a optional sort of, required when split_test is "subject" string subject_b optional sort of, required when split_test is "subject"
Return value
string the ID for the created campaign
File
- ./
MCAPI.class.php, line 246
Class
Code
function campaignCreate($type, $options, $content, $segment_opts = NULL, $type_opts = NULL) {
$params = array();
$params["type"] = $type;
$params["options"] = $options;
$params["content"] = $content;
$params["segment_opts"] = $segment_opts;
$params["type_opts"] = $type_opts;
return $this
->callServer("campaignCreate", $params);
}