forked from ignitionmedia-au/MCAPI-PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAPI.class.php
2908 lines (2752 loc) · 169 KB
/
MAPI.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
class MCAPI {
var $version = "1.3";
var $errorMessage;
var $errorCode;
/**
* Cache the information on the API location on the server
*/
var $apiUrl;
/**
* Default to a 300 second timeout on server calls
*/
var $timeout = 300;
/**
* Default to a 8K chunk size
*/
var $chunkSize = 8192;
/**
* Cache the user api_key so we only have to log in once per client instantiation
*/
var $api_key;
/**
* Cache the user api_key so we only have to log in once per client instantiation
*/
var $secure = false;
/**
* Connect to the MailChimp API for a given list.
*
* @param string $apikey Your MailChimp apikey
* @param string $secure Whether or not this should use a secure connection
*/
public function __construct($apikey, $secure=false) {
$this->secure = $secure;
$aAPIKey = explode("-", $apikey);
if (count($aAPIKey) === 1)
{
$aAPIKey[1] = 'us1';
}
$apiURL = sprintf("http://%s.api.mailchimp.com/%.1f/?output=php", $aAPIKey[1], $this->version);
$this->apiUrl = parse_url($apiURL);
$this->api_key = $apikey;
}
function setTimeout($seconds){
if (is_int($seconds)){
$this->timeout = $seconds;
return true;
}
}
function getTimeout(){
return $this->timeout;
}
function useSecure($val){
if ($val===true){
$this->secure = true;
} else {
$this->secure = false;
}
}
/**
* Unschedule a campaign that is scheduled to be sent in the future
*
* @section Campaign Related
* @example mcapi_campaignUnschedule.php
* @example xml-rpc_campaignUnschedule.php
*
* @param string $cid the id of the campaign to unschedule
* @return boolean true on success
*/
function campaignUnschedule($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignUnschedule", $params);
}
/**
* Schedule a campaign to be sent in the future
*
* @section Campaign Related
* @example mcapi_campaignSchedule.php
* @example xml-rpc_campaignSchedule.php
*
* @param string $cid the id of the campaign to schedule
* @param string $schedule_time the time to schedule the campaign. For A/B Split "schedule" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
* @param string $schedule_time_b optional -the time to schedule Group B of an A/B Split "schedule" campaign - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
* @return boolean true on success
*/
function campaignSchedule($cid, $schedule_time, $schedule_time_b=NULL) {
$params = array();
$params["cid"] = $cid;
$params["schedule_time"] = $schedule_time;
$params["schedule_time_b"] = $schedule_time_b;
return $this->callServer("campaignSchedule", $params);
}
/**
* Schedule a campaign to be sent in batches sometime in the future. Only valid for "regular" campaigns
*
* @section Campaign Related
*
* @param string $cid the id of the campaign to schedule
* @param string $schedule_time the time to schedule the campaign.
* @param string $num_batches optional - the number of batches between 2 and 26 to send. defaults to 2
* @param string $stagger_mins optional - the number of minutes between each batch - 5, 10, 15, 20, 25, 30, or 60. defaults to 5
* @return boolean true on success
*/
function campaignScheduleBatch($cid, $schedule_time, $num_batches=2, $stagger_mins=5) {
$params = array();
$params["cid"] = $cid;
$params["schedule_time"] = $schedule_time;
$params["num_batches"] = $num_batches;
$params["stagger_mins"] = $stagger_mins;
return $this->callServer("campaignScheduleBatch", $params);
}
/**
* Resume sending an AutoResponder or RSS campaign
*
* @section Campaign Related
*
* @param string $cid the id of the campaign to pause
* @return boolean true on success
*/
function campaignResume($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignResume", $params);
}
/**
* Pause an AutoResponder or RSS campaign from sending
*
* @section Campaign Related
*
* @param string $cid the id of the campaign to pause
* @return boolean true on success
*/
function campaignPause($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignPause", $params);
}
/**
* Send a given campaign immediately. For RSS campaigns, this will "start" them.
*
* @section Campaign Related
*
* @example mcapi_campaignSendNow.php
* @example xml-rpc_campaignSendNow.php
*
* @param string $cid the id of the campaign to send
* @return boolean true on success
*/
function campaignSendNow($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignSendNow", $params);
}
/**
* Send a test of this campaign to the provided email address
*
* @section Campaign Related
*
* @example mcapi_campaignSendTest.php
* @example xml-rpc_campaignSendTest.php
*
* @param string $cid the id of the campaign to test
* @param array $test_emails an array of email address to receive the test message
* @param string $send_type optional by default (null) both formats are sent - "html" or "text" send just that format
* @return boolean true on success
*/
function campaignSendTest($cid, $test_emails=array (
), $send_type=NULL) {
$params = array();
$params["cid"] = $cid;
$params["test_emails"] = $test_emails;
$params["send_type"] = $send_type;
return $this->callServer("campaignSendTest", $params);
}
/**
* Allows one to test their segmentation rules before creating a campaign using them
*
* @section Campaign Related
* @example mcapi_campaignSegmentTest.php
* @example xml-rpc_campaignSegmentTest.php
*
* @param string $list_id the list to test segmentation on - get lists using lists()
* @param 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 signup date
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>last_changed</strong>" : Select based on subscriber record last changed date
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-X</strong>": where X is the Grouping Id from listInterestGroupings()
Valid Op(erations): <strong>one</strong> / <strong>none</strong> / <strong>all</strong>
Valid Values: a comma delimited of interest groups for the list - see listInterestGroupings()
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 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>social_gender</strong>" : allows matching against the gender acquired from SocialPro
Valid Op(eration): <strong>eq</strong> (is) / <strong>ne</strong> (is not)
Valid Values: male, female
Field = "<strong>social_age</strong>" : allows matching against the age acquired from SocialPro
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
Valid Values: any number
Field = "<strong>social_influence</strong>" : allows matching against the influence acquired from SocialPro
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>social_network</strong>" :
Valid Op(erations): <strong>member</strong> (is a member of) / <strong>notmember</strong> (is not a member of)
Valid Values: twitter, facebook, myspace, linkedin, flickr
Field = "<strong>static_segment</strong>" :
Valid Op(erations): <strong>eq</strong> (is in) / <strong>ne</strong> (is not in)
Valid Values: an int - get from listStaticSegments()
Field = "<strong>default_location</strong>" : the location we automatically assign to a subscriber based on where we've seen their activity originate
Valid Op(erations): <strong>ipgeostate</strong> (within a US state) / <strong>ipgeonotstate</strong> (not within a US state) / <strong>ipgeocountry</strong> (within a country) / <strong>ipgeonotcountry</strong> (not within a country) / <strong>ipgeoin</strong> (within lat/lng parameters) / <strong>ipgeonotin</strong> (not within lat/lng parameters)
Valid Values:
string ipgeostate/ipgeonotstate a full US state name (not case sensitive)
string ipgeocountry/ipgeonotcountry an ISO3166 2 digit country code (not case sensitive)
int ipgeoin/ipgeonotin a distance in miles centered around a point you must specify by also passing <strong>lat</strong> (latitude) and <strong>lng</strong> (longitude) parameters
Field = A <strong>Birthday</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Brithday fields can <strong>only</strong> use the operations listed here.
Valid Op(erations): <strong>eq</strong> (=) / <strong>starts</strong> (month equals) / <strong>ends</strong> (day equals)
Valid Values: Any valid number for the operation being checked.
Field = A <strong>Zip</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Zip fields can <strong>only</strong> use the operations listed here.
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>geoin</strong> (US only)
Valid Values: For <strong>eq</strong> (=) / <strong>ne</strong>, a Zip Code. For <strong>geoin</strong>, a radius in miles
Extra Value: Only for <strong>geoin</strong> - the Zip Code to be used as the center point
Field = An <strong>Address</strong> type 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 <strong>only</strong> use the operations listed here.
Valid Op(erations): <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>geoin</strong>
Valid Values: For <strong>like</strong> and <strong>nlike</strong>, a string. For <strong>geoin</strong>, a radius in miles
Extra Value: Only for <strong>geoin</strong> - the Zip Code to be used as the center point
Field = A <strong>Number</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Number fields can <strong>only</strong> use the operations listed here.
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) /
Valid Values: Any valid number.
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 int total The total number of subscribers matching your segmentation options
*/
function campaignSegmentTest($list_id, $options) {
$params = array();
$params["list_id"] = $list_id;
$params["options"] = $options;
return $this->callServer("campaignSegmentTest", $params);
}
/**
* Create a new draft campaign to send. You <strong>can not</strong> have more than 32,000 campaigns in your account.
*
* @section Campaign Related
* @example mcapi_campaignCreate.php
* @example xml-rpc_campaignCreate.php
* @example xml-rpc_campaignCreateABSplit.php
* @example xml-rpc_campaignCreateRss.php
*
* @param string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "auto"
* @param array $options 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)
string to_name the To: name recipients will see (not email address)
int template_id optional - use this user-created template to generate the HTML content of the campaign (takes precendence over other template options)
int gallery_template_id optional - use a template from the public gallery to generate the HTML content of the campaign (takes precendence over base template options)
int base_template_id optional - use this a base/start-from-scratch template to generate the HTML content of the campaign
int folder_id optional - automatically file the new campaign in the folder_id passed. Get using folders() - note that Campaigns and Autoresponders have separate folder setupsn
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. Click tracking can not be disabled for Free accounts.
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. Use "google" for Google Analytics, "clicktale" for ClickTale, and "gooal" for Goo.al tracking. The "tag" is any custom text (up to 50 characters) that should be included.
boolean auto_footer optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
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.
boolean auto_tweet optional If set, this campaign will be auto-tweeted when it is sent - defaults to false. Note that if a Twitter account isn't linked, this will be silently ignored.
array auto_fb_post optional If set, this campaign will be auto-posted to the page_ids contained in the array. If a Facebook account isn't linked or the account does not have permission to post to the page_ids requested, those failures will be silently ignored.
boolean fb_comments optional If true, the Facebook comments (and thus the <a href="http://kb.mailchimp.com/article/i-dont-want-an-archiave-of-my-campaign-can-i-turn-it-off/" target="_blank">archive bar</a> will be displayed. If false, Facebook comments will not be enabled (does not imply no archive bar, see previous link). Defaults to "true".
boolean timewarp optional If set, this campaign must be scheduled 24 hours in advance of sending - default to false. Only valid for "regular" campaigns and "absplit" campaigns that split on schedule_time.
boolean ecomm360 optional If set, our <a href="http://www.mailchimp.com/blog/ecommerce-tracking-plugin/" target="_blank">Ecommerce360 tracking</a> will be enabled for links in the campaign
array crm_tracking optional If set, enable CRM tracking for:<div style="padding-left:15px"><table>
array salesforce optional Enable SalesForce push back<div style="padding-left:15px"><table>
bool campaign optional - if true, create a Campaign object and update it with aggregate stats
bool notes optional - if true, attempt to update Contact notes based on email address</table></div>
array highrise optional Enable SalesForce push back<div style="padding-left:15px"><table>
bool campaign optional - if true, create a Kase object and update it with aggregate stats
bool notes optional - if true, attempt to update Contact notes based on email address</table></div>
array capsule optional Enable Capsule push back (only notes are supported)<div style="padding-left:15px"><table>
bool notes optional - if true, attempt to update Contact notes based on email address</table></div></table></div>
* @param array $content the content for this campaign - use a struct with the following keys:
string html for pasted HTML content
string text for the plain-text version
string url to have us pull in content from a URL. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
string archive to send a Base64 encoded archive file for us to import all media from. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
string archive_type optional - only necessary for the "archive" option. Supported formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz . If not included, we will default to zip
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.
* @param array $segment_opts optional - if you wish to do Segmentation with this campaign this array should contain: see campaignSegmentTest(). It's suggested that you test your options against campaignSegmentTest().
* @param 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
string schedule optional one of "daily", "weekly", "monthly" - defaults to "daily"
string schedule_hour optional an hour between 0 and 24 - default to 4 (4am <em>local time</em>) - applies to all schedule types
string schedule_weekday optional for "weekly" only, a number specifying the day of the week to send: 0 (Sunday) - 6 (Saturday) - defaults to 1 (Monday)
string schedule_monthday optional for "monthly" only, a number specifying the day of the month to send (1 - 28) or "last" for the last day of a given month. Defaults to the 1st day of the month
array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on
bool 1 optional Monday, defaults to true
bool 2 optional Tuesday, defaults to true
bool 3 optional Wednesday, defaults to true
bool 4 optional Thursday, defaults to true
bool 5 optional Friday, defaults to true
bool 6 optional Saturday, defaults to true
bool 7 optional Sunday, defaults to true
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)
int wait_units optional the default time unit to wait before auto-selecting a winner - use "3600" for hours, "86400" for days. Defaults to 86400.
int 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.
int 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"
For AutoResponder campaigns, this array should contain:
string offset-units one of "hourly", "day", "week", "month", "year" - required
string offset-time optional, sort of - the number of units must be a number greater than 0 for signup based autoresponders, ignored for "hourly"
string offset-dir either "before" or "after", ignored for "hourly"
string event optional "signup" (default) to base this members added to a list, "date", "annual", or "birthday" to base this on merge field in the list, "campaignOpen" or "campaignClicka" to base this on any activity for a campaign, "campaignClicko" to base this on clicks on a specific URL in a campaign, "mergeChanged" to base this on a specific merge field being changed to a specific value
string event-datemerge optional sort of, this is required if the event is "date", "annual", "birthday", or "mergeChanged"
string campaign_id optional sort of, required for "campaignOpen", "campaignClicka", or "campaignClicko"
string campaign_url optional sort of, required for "campaignClicko"
int schedule_hour The hour of the day - 24 hour format in GMT - the autoresponder should be triggered, ignored for "hourly"
boolean use_import_time whether or not imported subscribers (ie, <em>any</em> non-double optin subscribers) will receive
array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on
bool 1 optional Monday, defaults to true
bool 2 optional Tuesday, defaults to true
bool 3 optional Wednesday, defaults to true
bool 4 optional Thursday, defaults to true
bool 5 optional Friday, defaults to true
bool 6 optional Saturday, defaults to true
bool 7 optional Sunday, defaults to true
*
* @return string the ID for the created campaign
*/
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);
}
/** Update just about any setting for a campaign that has <em>not</em> been sent. See campaignCreate() for details.
*
*
* Caveats:<br/><ul class='simplelist square'>
* <li>If you set list_id, all segmentation options will be deleted and must be re-added.</li>
* <li>If you set template_id, you need to follow that up by setting it's 'content'</li>
* <li>If you set segment_opts, you should have tested your options against campaignSegmentTest() as campaignUpdate() will not allow you to set a segment that includes no members.</li>
* <li>To clear/unset segment_opts, pass an empty string or array as the value. Various wrappers may require one or the other.</li>
* </ul>
* @section Campaign Related
*
* @example mcapi_campaignUpdate.php
* @example mcapi_campaignUpdateAB.php
* @example xml-rpc_campaignUpdate.php
* @example xml-rpc_campaignUpdateAB.php
*
* @param string $cid the Campaign Id to update
* @param string $name the parameter name ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's name (subject, from_email, etc.). Additional parameters will be that option name (content, segment_opts). "type_opts" will be the name of the type - rss, auto, etc.
* @param mixed $value an appropriate value for the parameter ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's value. For additional parameters, this is the same value passed to them.
* @return boolean true if the update succeeds, otherwise an error will be thrown
*/
function campaignUpdate($cid, $name, $value) {
$params = array();
$params["cid"] = $cid;
$params["name"] = $name;
$params["value"] = $value;
return $this->callServer("campaignUpdate", $params);
}
/** Replicate a campaign.
*
* @section Campaign Related
*
* @example mcapi_campaignReplicate.php
*
* @param string $cid the Campaign Id to replicate
* @return string the id of the replicated Campaign created, otherwise an error will be thrown
*/
function campaignReplicate($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignReplicate", $params);
}
/** Delete a campaign. Seriously, "poof, gone!" - be careful!
*
* @section Campaign Related
*
* @example mcapi_campaignDelete.php
*
* @param string $cid the Campaign Id to delete
* @return boolean true if the delete succeeds, otherwise an error will be thrown
*/
function campaignDelete($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignDelete", $params);
}
/**
* Get the list of campaigns and their details matching the specified filters
*
* @section Campaign Related
* @example mcapi_campaigns.php
* @example xml-rpc_campaigns.php
*
* @param array $filters a hash of filters to apply to this query - all are optional:
string campaign_id optional - return the campaign using a know campaign_id. Accepts multiples separated by commas when not using exact matching.
string parent_id optional - return the child campaigns using a know parent campaign_id. Accepts multiples separated by commas when not using exact matching.
string list_id optional - the list to send this campaign to- get lists using lists(). Accepts multiples separated by commas when not using exact matching.
int folder_id optional - only show campaigns from this folder id - get folders using campaignFolders(). Accepts multiples separated by commas when not using exact matching.
int template_id optional - only show campaigns using this template id - get templates using templates(). Accepts multiples separated by commas when not using exact matching.
string status optional - return campaigns of a specific status - one of "sent", "save", "paused", "schedule", "sending". Accepts multiples separated by commas when not using exact matching.
string type optional - return campaigns of a specific type - one of "regular", "plaintext", "absplit", "rss", "auto". Accepts multiples separated by commas when not using exact matching.
string from_name optional - only show campaigns that have this "From Name"
string from_email optional - only show campaigns that have this "Reply-to Email"
string title optional - only show campaigns that have this title
string subject optional - only show campaigns that have this subject
string sendtime_start optional - only show campaigns that have been sent since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
string sendtime_end optional - only show campaigns that have been sent before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
boolean uses_segment - whether to return just campaigns with or without segments
boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true. Using this disables the use of any filters that accept multiples.
* @param int $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
* @param int $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
* @return array an array containing a count of all matching campaigns and the specific ones for the current page (see Returned Fields for description)
int total the total number of campaigns matching the filters passed in
array data the data for each campaign being returned
string id Campaign Id (used for all other campaign functions)
int web_id The Campaign id used in our web app, allows you to create a link directly to it
string list_id The List used for this campaign
int folder_id The Folder this campaign is in
int template_id The Template this campaign uses
string content_type How the campaign's content is put together - one of 'template', 'html', 'url'
string title Title of the campaign
string type The type of campaign this is (regular,plaintext,absplit,rss,inspection,auto)
string create_time Creation time for the campaign
string send_time Send time for the campaign - also the scheduled time for scheduled campaigns.
int emails_sent Number of emails email was sent to
string status Status of the given campaign (save,paused,schedule,sending,sent)
string from_name From name of the given campaign
string from_email Reply-to email of the given campaign
string subject Subject of the given campaign
string to_name Custom "To:" email string using merge variables
string archive_url Archive link for the given campaign
boolean inline_css Whether or not the campaign content's css was auto-inlined
string analytics Either "google" if enabled or "N" if disabled
string analytics_tag The name/tag the campaign's links were tagged with if analytics were enabled.
boolean authenticate Whether or not the campaign was authenticated
boolean ecomm360 Whether or not ecomm360 tracking was appended to links
boolean auto_tweet Whether or not the campaign was auto tweeted after sending
string auto_fb_post A comma delimited list of Facebook Profile/Page Ids the campaign was posted to after sending. If not used, blank.
boolean auto_footer Whether or not the auto_footer was manually turned on
boolean timewarp Whether or not the campaign used Timewarp
string timewarp_schedule The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array
string parent_id the unique id of the parent campaign (currently only valid for rss children)
array tracking the various tracking options used
boolean html_clicks whether or not tracking for html clicks was enabled.
boolean text_clicks whether or not tracking for text clicks was enabled.
boolean opens whether or not opens tracking was enabled.
string segment_text a string marked-up with HTML explaining the segment used for the campaign in plain English
array segment_opts the segment used for the campaign - can be passed to campaignSegmentTest() or campaignCreate()
array type_opts the type-specific options for the campaign - can be passed to campaignCreate()
*/
function campaigns($filters=array (
), $start=0, $limit=25) {
$params = array();
$params["filters"] = $filters;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaigns", $params);
}
/**
* Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)
*
* @section Campaign Stats
*
* @example mcapi_campaignStats.php
* @example xml-rpc_campaignStats.php
*
* @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
* @return array struct of the statistics for this campaign
int syntax_errors Number of email addresses in campaign that had syntactical errors.
int hard_bounces Number of email addresses in campaign that hard bounced.
int soft_bounces Number of email addresses in campaign that soft bounced.
int unsubscribes Number of email addresses in campaign that unsubscribed.
int abuse_reports Number of email addresses in campaign that reported campaign for abuse.
int forwards Number of times email was forwarded to a friend.
int forwards_opens Number of times a forwarded email was opened.
int opens Number of times the campaign was opened.
string last_open Date of the last time the email was opened.
int unique_opens Number of people who opened the campaign.
int clicks Number of times a link in the campaign was clicked.
int unique_clicks Number of unique recipient/click pairs for the campaign.
string last_click Date of the last time a link in the email was clicked.
int users_who_clicked Number of unique recipients who clicked on a link in the campaign.
int emails_sent Number of email addresses campaign was sent to.
int unique_likes total number of unique likes (Facebook)
int recipient_likes total number of recipients who liked (Facebook) the campaign
int facebook_likes total number of likes (Facebook) that came from Facebook
array absplit If this was an absplit campaign, stats for the A and B groups will be returned
int bounces_a bounces for the A group
int bounces_b bounces for the B group
int forwards_a forwards for the A group
int forwards_b forwards for the B group
int abuse_reports_a abuse reports for the A group
int abuse_reports_b abuse reports for the B group
int unsubs_a unsubs for the A group
int unsubs_b unsubs for the B group
int recipients_click_a clicks for the A group
int recipients_click_b clicks for the B group
int forwards_opens_a opened forwards for the A group
int forwards_opens_b opened forwards for the B group
int opens_a total opens for the A group
int opens_b total opens for the B group
string last_open_a date/time of last open for the A group
string last_open_b date/time of last open for the BG group
int unique_opens_a unique opens for the A group
int unique_opens_b unique opens for the B group
array timewarp If this campaign was a Timewarp campaign, an array of stats from each timezone for it, with the GMT offset as they key. Each timezone will contain:
int opens opens for this timezone
string last_open the date/time of the last open for this timezone
int unique_opens the unique opens for this timezone
int clicks the total clicks for this timezone
string last_click the date/time of the last click for this timezone
int unique_opens the unique clicks for this timezone
int bounces the total bounces for this timezone
int total the total number of members sent to in this timezone
int sent the total number of members delivered to in this timezone
array timeseries For the first 24 hours of the campaign, per-hour stats:
string timestamp The timestemp in Y-m-d H:00:00 format
int emails_sent the total emails sent during the hour
int unique_opens unique opens seen during the hour
int recipients_click unique clicks seen during the hour
*/
function campaignStats($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignStats", $params);
}
/**
* Get an array of the urls being tracked, and their click counts for a given campaign
*
* @section Campaign Stats
*
* @example mcapi_campaignClickStats.php
* @example xml-rpc_campaignClickStats.php
*
* @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
* @return array urls will be keys and contain their associated statistics:
int clicks Number of times the specific link was clicked
int unique Number of unique people who clicked on the specific link
*/
function campaignClickStats($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignClickStats", $params);
}
/**
* Get the top 5 performing email domains for this campaign. Users want more than 5 should use campaign campaignEmailStatsAIM()
* or campaignEmailStatsAIMAll() and generate any additional stats they require.
*
* @section Campaign Stats
*
* @example mcapi_campaignEmailDomainPerformance.php
*
* @param string $cid the campaign id to pull email domain performance for (can be gathered using campaigns())
* @return array domains email domains and their associated stats
string domain Domain name or special "Other" to roll-up stats past 5 domains
int total_sent Total Email across all domains - this will be the same in every row
int emails Number of emails sent to this domain
int bounces Number of bounces
int opens Number of opens
int clicks Number of clicks
int unsubs Number of unsubs
int delivered Number of deliveries
int emails_pct Percentage of emails that went to this domain (whole number)
int bounces_pct Percentage of bounces from this domain (whole number)
int opens_pct Percentage of opens from this domain (whole number)
int clicks_pct Percentage of clicks from this domain (whole number)
int unsubs_pct Percentage of unsubs from this domain (whole number)
*/
function campaignEmailDomainPerformance($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignEmailDomainPerformance", $params);
}
/**
* Get all email addresses the campaign was successfully sent to (ie, no bounces)
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull members for (can be gathered using campaigns())
* @param string $status optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
* @return array a total of all matching emails and the specific emails for this page
int total the total number of members for the campaign and status
array data the full campaign member records
string email the email address sent to
string status the status of the send - one of 'sent', 'hard', 'soft'
string absplit_group if this was an absplit campaign, one of 'a','b', or 'winner'
string tz_group if this was an timewarp campaign the timezone GMT offset the member was included in
*/
function campaignMembers($cid, $status=NULL, $start=0, $limit=1000) {
$params = array();
$params["cid"] = $cid;
$params["status"] = $status;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaignMembers", $params);
}
/**
* <strong>DEPRECATED</strong> Get all email addresses with Hard Bounces for a given campaign
*
* @deprecated See campaignMembers() for a replacement
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
* @return array a total of all hard bounced emails and the specific emails for this page
int total the total number of hard bounces for the campaign
array data array of the full email addresses that bounced
*/
function campaignHardBounces($cid, $start=0, $limit=1000) {
$params = array();
$params["cid"] = $cid;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaignHardBounces", $params);
}
/**
* <strong>DEPRECATED</strong> Get all email addresses with Soft Bounces for a given campaign
*
* @deprecated See campaignMembers() for a replacement
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
* @return array a total of all soft bounced emails and the specific emails for this page
int total the total number of soft bounces for the campaign
array data array of the full email addresses that bounced
*/
function campaignSoftBounces($cid, $start=0, $limit=1000) {
$params = array();
$params["cid"] = $cid;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaignSoftBounces", $params);
}
/**
* Get all unsubscribed email addresses for a given campaign
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
* @return array a total of all unsubscribed emails and the specific emails for this page
int total the total number of unsubscribes for the campaign
array data the full email addresses that unsubscribed
string email the email address that unsubscribed
string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
*/
function campaignUnsubscribes($cid, $start=0, $limit=1000) {
$params = array();
$params["cid"] = $cid;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaignUnsubscribes", $params);
}
/**
* Get all email addresses that complained about a given campaign
*
* @section Campaign Stats
*
* @example mcapi_campaignAbuseReports.php
*
* @param string $cid the campaign id to pull abuse reports for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
* @return array reports the abuse reports for this campaign
int total the total reports matched
array data the report data for each, including:
string date date/time the abuse report was received and processed
string email the email address that reported abuse
string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
*/
function campaignAbuseReports($cid, $since=NULL, $start=0, $limit=500) {
$params = array();
$params["cid"] = $cid;
$params["since"] = $since;
$params["start"] = $start;
$params["limit"] = $limit;
return $this->callServer("campaignAbuseReports", $params);
}
/**
* Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
* suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary
*
* @section Campaign Stats
*
* @example mcapi_campaignAdvice.php
*
* @param string $cid the campaign id to pull advice text for (can be gathered using campaigns())
* @return array advice on the campaign's performance, each containing:
msg the advice message
type the "type" of the message. one of: negative, positive, or neutral
*/
function campaignAdvice($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignAdvice", $params);
}
/**
* Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.
*
* @section Campaign Stats
*
* @example mcapi_campaignAnalytics.php
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @return array analytics we've collected for the passed campaign.
int visits number of visits
int pages number of page views
int new_visits new visits recorded
int bounces vistors who "bounced" from your site
double time_on_site the total time visitors spent on your sites
int goal_conversions number of goals converted
double goal_value value of conversion in dollars
double revenue revenue generated by campaign
int transactions number of transactions tracked
int ecomm_conversions number Ecommerce transactions tracked
array goals an array containing goal names and number of conversions
string name the name of the goal
int conversions the number of conversions for the goal
*/
function campaignAnalytics($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignAnalytics", $params);
}
/**
* Retrieve the countries and number of opens tracked for each. Email address are not returned.
*
* @section Campaign Stats
*
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @return array countries an array of countries where opens occurred
string code The ISO3166 2 digit country code
string name A version of the country name, if we have it
int opens The total number of opens that occurred in the country
boolean region_detail Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
*/
function campaignGeoOpens($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignGeoOpens", $params);
}
/**
* Retrieve the regions and number of opens tracked for a certain country. Email address are not returned.
*
* @section Campaign Stats
*
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param string $code An ISO3166 2 digit country code
* @return array regions an array of regions within the provided country where opens occurred.
string code An internal code for the region. When this is blank, it indicates we know the country, but not the region
string name The name of the region, if we have one. For blank "code" values, this will be "Rest of Country"
int opens The total number of opens that occurred in the country
*/
function campaignGeoOpensForCountry($cid, $code) {
$params = array();
$params["cid"] = $cid;
$params["code"] = $code;
return $this->callServer("campaignGeoOpensForCountry", $params);
}
/**
* Retrieve the tracked eepurl mentions on Twitter
*
* @section Campaign Stats
*
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @return array stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl
array twitter various Twitter related stats
int tweets Total number of tweets seen
string first_tweet date and time of the first tweet seen
string last_tweet date and time of the last tweet seen
int retweets Total number of retweets seen
string first_retweet date and time of the first retweet seen
string last_retweet date and time of the last retweet seen
array statuses an array of statuses recorded inclduing:
string status the text of the tweet/update
string screen_name the screen name as recorded when first seen
string status_id the status id of the tweet (they are really unsigned 64 bit ints)
string datetime the date/time of the tweet
bool is_retweet whether or not this was a retweet
array clicks stats related to click-throughs on the eepurl
int clicks Total number of clicks seen
string first_click date and time of the first click seen
string last_click date and time of the first click seen
array locations an array of geographic locations including:
string country the country name the click was tracked to
string region the region in the country the click was tracked to (if available)
int total clicks total clicks occuring in this country+region pair
array referrers an array of arrays, each containing
string referrer the referrer, truncated to 100 bytes
int clicks Total number of clicks seen from this referrer
string first_click date and time of the first click seen from this referrer
string last_click date and time of the first click seen from this referrer
*/
function campaignEepUrlStats($cid) {
$params = array();
$params["cid"] = $cid;
return $this->callServer("campaignEepUrlStats", $params);
}
/**
* Retrieve the most recent full bounce message for a specific email address on the given campaign.
* Messages over 30 days old are subject to being removed
*
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param string $email the email address or unique id of the member to pull a bounce message for.
* @return array the full bounce message for this email+campaign along with some extra data.
string date date/time the bounce was received and processed
string email the email address that bounced
string message the entire bounce message received
*/
function campaignBounceMessage($cid, $email) {
$params = array();
$params["cid"] = $cid;
$params["email"] = $email;
return $this->callServer("campaignBounceMessage", $params);
}
/**
* Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts
* of data depending on how large the campaign was and how much cruft the bounce provider returned. Also,
* message over 30 days old are subject to being removed
*
* @section Campaign Stats
*
* @example mcapi_campaignBounceMessages.php
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 25, upper limit set at 50
* @param string $since optional pull only messages since this time - use YYYY-MM-DD format in <strong>GMT</strong> (we only store the date, not the time)
* @return array bounces the full bounce messages for this campaign
int total that total number of bounce messages for the campaign
array data an array containing the data for this page
string date date/time the bounce was received and processed
string email the email address that bounced
string message the entire bounce message received
*/
function campaignBounceMessages($cid, $start=0, $limit=25, $since=NULL) {
$params = array();
$params["cid"] = $cid;
$params["start"] = $start;
$params["limit"] = $limit;
$params["since"] = $since;
return $this->callServer("campaignBounceMessages", $params);
}
/**
* Retrieve the Ecommerce Orders tracked by campaignEcommOrderAdd()
*
* @section Campaign Stats
*
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
* @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
* @return array the total matching orders and the specific orders for the requested page
int total the total matching orders
array data the actual data for each order being returned
string store_id the store id generated by the plugin used to uniquely identify a store
string store_name the store name collected by the plugin - often the domain name
string order_id the internal order id the store tracked this order by
string email the email address that received this campaign and is associated with this order
double order_total the order total
double tax_total the total tax for the order (if collected)
double ship_total the shipping total for the order (if collected)
string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we received it
array lines containing detail of the order:
int line_num the line number assigned to this line
int product_id the product id assigned to this item
string product_name the product name
string product_sku the sku for the product
int product_category_id the id for the product category
string product_category_name the product category name
int qty the quantity of items ordered
cost the total cost of items ordered
*/
function campaignEcommOrders($cid, $start=0, $limit=100, $since=NULL) {
$params = array();
$params["cid"] = $cid;
$params["start"] = $start;
$params["limit"] = $limit;
$params["since"] = $since;
return $this->callServer("campaignEcommOrders", $params);
}