zaycon/whatcounts

WhatCounts HTTP API的PHP API包装器

1.1.1 2016-03-15 21:24 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:06:54 UTC


README

Latest Stable Version Total Downloads Build Status Coverage Status

WhatCounts HTTP API的PHP API包装器 (https://support.whatcounts.com/hc/en-us/categories/200372375-API-HTTP)

目录

安装

将ZayconWhatCounts添加到您的composer.json文件中。如果您没有使用Composer,那么您应该使用它。它是管理PHP应用程序依赖项的绝佳方式。

{
  "require": {
    "zaycon/whatcounts": "1.0.*"
  }
}

文档

初始化您的对象

$whatcounts = new ZayconWhatCounts\WhatCounts( [YOUR_API_REALM], [YOUR_API_PASSWORD] );

###领域

####获取领域设置

$realm = $whatcounts->getRealmSettings();

###列表

####显示列表

$lists = $whatcounts->showLists();

####通过ID获取列表

$list_id = 10;
$list = $whatcounts->getListById($list_id);

####通过名称获取列表

$list_name = "Marketing List";
$list = $whatcounts->getListByName($list_name);

####创建列表

$list = new ZayconWhatCounts\MailingList;
$list
	->setListName('API Test');
	->setDescription('This is a test list');
	->setFromAddress('from@example.com');
	->setReplyToAddress('reply-to@example.com');
	->setBounceAddress('bounce@example.com');
	->setTrackClicks(true);
	->setTrackOpens(true);

$new_list = $whatcounts->createList($list);

####更新列表

$list_id = 10;
$list = $whatcounts->showList($list_id);
$list->setListName('API Test');

$is_updated = $whatcounts->updateList($list);

文章

显示文章

$articles = $whatcounts->showArticles();

通过ID获取文章

$article = new ZayconWhatCounts\Article();
$article->setId(5);

$whatcounts->getArticleById($article);

通过名称获取文章

$article = new ZayconWhatCounts\Article();
$article->setName('article-1');

$whatcounts->getArticleByName($article);

复制文章

$article_name = 'article-1';
$destination_article_name = 'article-1-copy';

$destination_article_id = $whatcounts->copyArticle($article_name, $destination_article_name);

创建空白文章

$article = new ZayconWhatCounts\Article();
$article
    ->setName('blank-test');

$whatcounts->createBlankArticle($article);

创建文章(不工作)

$article = new ZayconWhatCounts\Article();
$article
    ->setName('test')
    ->setTitle('Test Article Title')
    ->setDescription('Test Article Description')
    ->setDeck('This is the actual article deck.')
    ->setCallout('Test Article Callout')
    ->setBody('Test Article Body')
    ->setAuthorName('Joe Smith')
    ->setAuthorBio('This is the bio for Joe Smith')
    ->setAuthorEmail('joe@example.com')
    ->setFolderId(0);

$whatcounts->createArticle($article);

更新文章

$article = new ZayconWhatCounts\Article();
$article
    ->setId(5)
    ->setName('article-1')
    ->setTitle('Test Article Title')
    ->setDescription('Test Article Description')
    ->setDeck('This is the actual article deck.')
    ->setCallout('Test Article Callout')
    ->setBody('Test Article Body')
    ->setAuthorName('Joe Smith')
    ->setAuthorBio('This is the bio for Joe Smith')
    ->setAuthorEmail('joe@example.com')
    ->setFolderId(0);

$is_updated = $whatcounts->updateArticle($article);

删除文章

$article_name = 'article-1-copy';

$is_deleted = $whatcounts->deleteArticle($article_name);

###订阅者管理 ####查找订阅者

$subscriber = new ZayconWhatCounts\Subscriber;
$subscriber
	->setFirstName("Joe");
	->setLastName("Smith");

$subscribers = $whatcounts->findSubscribers($subscriber);

####在列表中查找订阅者

$list_id = 10;

$subscriber = new ZayconWhatCounts\Subscriber;
$subscriber
	->setFirstName("Joe");
	->setLastName("Smith");
	->setEmail("joe@example.com");

$subscribers = $whatcounts->findSubscriberInList($subscriber, $list_id, TRUE);

####订阅

$subscriber = new ZayconWhatCounts\Subscriber;
$subscriber
	->setFirstName("Joe");
	->setLastName("Smith");
	->setEmail("joe@example.com");
	->setAddress1("1234 Main St");
	->setAddress2("Suite 100");
	->setCity("Spokane");
	->setState("WA");
	->setZip("99201");
	->setCountry("US");
	->setPhone("5095551212");
	->setFax("5095551213");
	->setCompany("Zaycon");
	->setForceSub(false);
	->setFormat(99);
	->setOverrideConfirmation(false);
	->setListId(10);

$subscribers = $whatcounts->subscribe($subscriber);

####取消订阅

$subscriber = new ZayconWhatCounts\Subscriber;
$subscriber
	->setFirstName("Joe");
	->setLastName("Smith");
	->setEmail("joe@example.com");
	->setListId(10);

$unsubscriber = $whatcounts->unsubscribe($subscriber, $subscriber->getListId(), FALSE);

####删除订阅者

$subscriber_id = 123456;
$subscriber = $whatcounts->showSubscriber($subscriber_id);

$deleted_subscriber = $whatcounts->deleteSubscriber($subscriber);

####删除多个订阅者

$subscriber_emails = [
	'marc.freeman@example.com',
	'amelia.lowe@example.com'
];

$deleted_subscribers = $whatcounts->deleteSubscribers($subscriber_emails);

####显示订阅者详细信息

$subscriber_id = 123456;
$subscriber = $whatcounts->showSubscriber($subscriber_id);

####更新订阅者

$subscriber_id = 123456;
$subscriber = $whatcounts->showSubscriber($subscriber_id);

$subscriber_lists = $subscriber->getLists();

$subscriber
	->setListId($subscriber_lists[0]->getListId());
	->setLastName("Smith Jr.");

$updated_subscriber = $whatcounts->updateSubscriber($subscriber);

####更改电子邮件地址

$subscriber_id = 123456;
$subscriber = $whatcounts->showSubscriber($subscriber_id);
$whatcounts->changeEmailAddress($subscriber, "joejr@example.com");

####将订阅者添加到生命周期活动

$campaign_name = "test_automation_campaign";
		
$subscriber_id = 123456;
$subscriber = $whatcounts->showSubscriber($subscriber_id);

$updated_subscriber = $whatcounts->addSubscriberToLifecycleCampaign($subscriber, $campaign_name);

###发送邮件 ####发送一次性信息

$message = new \ZayconWhatCounts\Mail();
$message
	->setListId(10);
	->setFromAddress('marketing@example.com');
	->setReplyToAddress('reply-to@example.com');
	->setBounceAddress('bounce@example.com');
	->setSenderAddress(NULL);
	->setSendToAddress('joe@example.com');
	->setCcToAddress('others@example.com');
	->setTemplateId(3);
	->setBodyText('This is plain text.'); // This is usually defined in the template.
	->setBodyHtml('<h2>This is a test</h2>'); // This is usually defined in the template.
	->setSubject('Test from API'); // This is usually defined in the template.
	->setFormat(99);
	->setCampaignName(NULL);
	->setVirtualMta(NULL);
	->setDuplicate(FALSE);
	->setIgnoreOptout(TRUE); // Set to TRUE if sending a transactional email, which ignores any opt out.
	->setCharacterEncoding(NULL); // This is usually defined in the template.
	->setData('customLastname,customSalutation^Smith,Mr');

$output = $whatcounts->sendOneOffMessage($message);

####订阅并发送一次性信息

$message = new \ZayconWhatCounts\Mail();
$message
	->setListId(10);
	->setFromAddress('marketing@example.com');
	->setReplyToAddress('reply-to@example.com');
	->setBounceAddress('bounce@example.com');
	->setSenderAddress(NULL);
	->setSendToAddress('joe@example.com');
	->setCcToAddress('others@example.com');
	->setTemplateId(3);
	->setBodyText('This is plain text.'); // This is usually defined in the template.
	->setBodyHtml('<h2>This is a test</h2>'); // This is usually defined in the template.
	->setSubject('Test from API'); // This is usually defined in the template.
	->setFormat(99);
	->setCampaignName(NULL);
	->setVirtualMta(NULL);
	->setDuplicate(FALSE);
	->setIgnoreOptout(TRUE); // Set to TRUE if sending a transactional email, which ignores any opt out.
	->setCharacterEncoding(NULL); // This is usually defined in the template.
	->setData('customLastname,customSalutation^Smith,Mr');

$output = $whatcounts->subscribeAndSendOneOffMessage($message);

####启动活动

$campaign = new ZayconWhatCounts\Campaign();
$campaign
	->setListId(23)
	->setTemplateId(35)
	->setSubject('Test Campaign')
	->setSeedListId(0)
	->setSegmentationId(0)
	->setFormat(99)
	->setAlias('')
	->setRss(0)
	->setVmta('vmta1')
	->setAbDefinitionId(0)
	->setDeployedByEmail('')
	->setReturnTaskId(1)
	->setSeedDelivery(0)
	->setSendNotification('user@example.com');

$output = $whatcounts->launchCampaign($campaign);

###报告 ####显示用户事件

$subscriber = $whatcounts->showSubscriber(123456);

$output = $whatcounts->showUserEvents($subscriber);

####报告订阅者事件

$subscriber = $whatcounts->showSubscriber(123456);

$output = $whatcounts->reportSubscriberEvents($subscriber);

####报告取消订阅

$list_id = 10;
$output = $whatcounts->reportUnsubscribes($list_id);

####显示退出

$list_id = 10;
$days = 30;

$output = $whatcounts->showOptouts($list_id, $days);

####显示全局退出

$days = 30;

$output = $whatcounts->showGlobalOptouts($days);

###A/B测试 ####显示A/B定义

$output = $whatcounts->showABDefinitions();

####获取A/B定义

$ab_definition = new ZayconWhatCounts\ABTest();
$ab_definition->setId(4);

$whatcounts->getABDefinition($ab_definition);

####报告A/B测试统计信息

$ab_definition_id = 4;
$output = $whatcounts->reportABTestStatistics($ab_definition_id);

###模板 ####显示模板

$output = $whatcounts->showTemplates();

####通过ID获取模板

$template_id = 14;
$output = $whatcounts->getTemplateById($template_id);

####通过名称获取模板

$template_name = 'Test Template';
$output = $whatcounts->getTemplateByName();

####创建模板

$template = new ZayconWhatCounts\Template;
$template
	->setFolderId(0)
	->setName("Another Test Template")
	->setSubject("Another Test from WhatCounts")
	->setBodyPlain("Hello %%set salutation = \$customSalutation%%%%\$salutation%% %%set last_name = \$customLastname%%%%\$last_name%%!")
	->setBodyHtml("<html><head><title></title></head><body><h2>Hello %%set salutation = \$customSalutation%%%%\$salutation%% %%set last_name = \$customLastname%%%%\$last_name%%!</h2></body></html>")
	->setDescription("This is the description");

$whatcounts->createTemplate($template);

####更新模板

$template = new ZayconWhatCounts\Template;
$template
	->setTemplateId(35)
	->setFolderId(0)
	->setName("Another Test Template")
	->setSubject("Another Test from WhatCounts (updated)")
	->setBodyPlain("(updated) Hello %%set salutation = \$customSalutation%%%%\$salutation%% %%set last_name = \$customLastname%%%%\$last_name%%!")
	->setBodyHtml("<html><head><title></title></head><body><h2>(updated) Hello %%set salutation = \$customSalutation%%%%\$salutation%% %%set last_name = \$customLastname%%%%\$last_name%%!</h2></body></html>")
	->setDescription("This is the description (updated)");

$output = $whatcounts->updateTemplate($template);

####预览模板

define('TEMPLATE_TYPE_PLAIN', 1);
define('TEMPLATE_TYPE_HTML', 2);
	
$template = new ZayconWhatCounts\Template;
$template
	->setName("Another Test Template");

$output = $whatcounts->previewTemplate($template, TEMPLATE_TYPE_HTML);

###分割规则 ####显示分割规则

$output = $whatcounts->showSegmentationRules();

####创建分割规则

$segmentation_rule = new ZayconWhatCounts\SegmentationRule();
$segmentation_rule->setListId(14);
$segmentation_rule->setName('Test Segmentation Rule');
$segmentation_rule->setDescription('This is a test segmentation rule.');
$segmentation_rule->setType('adv');
$segmentation_rule->setRules("email='user@example.com'");

$output = $whatcounts->createSegmentationRule($segmentation_rule);

####更新分割规则

$segmentation_rule = new ZayconWhatCounts\SegmentationRule();
$segmentation_rule->setId(7);
$segmentation_rule->setListId(14);
$segmentation_rule->setName('Test Segmentation Rule (updated)');
$segmentation_rule->setDescription('This is a test segmentation rule.');
$segmentation_rule->setType('adv');
$segmentation_rule->setRules("email='user@example.com'");

$output = $whatcounts->updateSegmentationRule($segmentation_rule);

####删除分割规则

$segmentation_rule = new ZayconWhatCounts\SegmentationRule();
$segmentation_rule->setId(7);

$output = $whatcounts->deleteSegmentationRule($segmentation_rule);

####测试分割规则

$segmentation_rule = new ZayconWhatCounts\SegmentationRule();
$segmentation_rule->setId(8);
$segmentation_rule->setListId(14);

$output = $whatcounts->testSegmentationRule($segmentation_rule);

###社交 ####获取所有社交提供商

$output = $whatcounts->getSocialProviders();

####通过ID获取社交提供商

$social_provider = new ZayconWhatCounts\SocialProvider();
$social_provider->setProviderId(522);

$whatcounts->getSocialProviderById($social_provider);

####通过用户名获取社交提供商

$social_provider = new ZayconWhatCounts\SocialProvider();
$social_provider
	->setUsername('user@example.com')
	->setProviderName('facebook');

$whatcounts->getSocialProviderByUserName($social_provider);

####通过ID删除社交提供商

$social_provider = new ZayconWhatCounts\SocialProvider();
$social_provider->setProviderId(522);

$is_deleted = $whatcounts->deleteSocialProviderById($social_provider);

####通过用户名删除社交提供商

$social_provider = new ZayconWhatCounts\SocialProvider();
$social_provider
	->setUsername('Joe Smith')
	->setProviderName('linkedin');

$is_deleted = $whatcounts->deleteSocialProviderByUserName($social_provider);

####为模板设置社交帖子

$template = new ZayconWhatCounts\Template();	$template->setTemplateId(14);

$social_provider = new ZayconWhatCounts\SocialProvider();
$social_provider->setProviderName('twitter');

$social_post = new ZayconWhatCounts\SocialPost();
$social_post->setPost('This is a post created from the API.');

$output = $whatcounts->setSocialPostForTemplate($template, $social_provider, $social_post);

####通过模板ID获取社交帖子

$template = new ZayconWhatCounts\Template();
$template->setTemplateId(14);

$output = $whatcounts->getSocialPostsByTemplateId($template);

####通过模板名称获取社交帖子

$template = new ZayconWhatCounts\Template();
$template->setName('Test Template');

$output = $whatcounts->getSocialPostsByTemplateName($template);

###报告 ####显示活动

$count = 5;
$output = $whatcounts->showCampaigns($count);

####报告活动列表

$start_date = "01/01/2016";
$end_date = "03/01/2016";
$show_hidden = 0;

$output = $whatcounts->reportCampaignList($start_date, $end_date, $show_hidden);

####显示活动统计信息

$campaign_statistics = new ZayconWhatCounts\Report();
$campaign_statistics->setCampaignId(43);

$whatcounts->showCampaignStatistics($campaign_statistics);

####显示多个活动统计信息

$campaign_ids = array(43,7);

$output = $whatcounts->showMultipleCampaginStatistics($campaign_ids);

####报告活动点击

$campaign_id = 47;
$output = $whatcounts->reportCampaignClicks($campaign_id);

####报告订阅者点击

$campaign_id = 47;
$url = 'https://www.example.com';
$is_exact = FALSE;
$is_unique = FALSE;

$output = $whatcounts->reportSubscriberClicks($campaign_id, $url, $is_exact, $is_unique);

####报告每日统计信息

$campaign_id = 47;
$start_date = '2/1/2016';
$end_date = '4/1/2016';

$output = $whatcounts->reportDailyStatistics($campaign_id, $start_date, $end_date);

####报告浏览器信息

$campaign_id = 13;
$by_subscriber = 1;
$os_name = 'ios';
$browser = 'safari';
$client_type = 'iphone';

$output = $whatcounts->reportBrowserInfo($campaign_id, $by_subscriber, $os_name, $browser, $client_type);

####报告退订统计信息

define('BOUNCE_TYPE_SOFT', 30);
define('BOUNCE_TYPE_HARD', 31);
define('BOUNCE_TYPE_COMPLAINT', 34);
define('BOUNCE_TYPE_BLOCK', 36);

$campaign_id = 47;
$start_date = '2/1/2016';
$end_date = '4/1/2016';
$bounce_type = BOUNCE_TYPE_HARD;

$output = $whatcounts->reportBounceStatistics($campaign_id, $bounce_type, $start_date, $end_date);

####报告跟踪事件

define('EVENT_TYPE_NONE', 0);
define('EVENT_TYPE_SENT', 9);
define('EVENT_TYPE_OPEN', 10);
define('EVENT_TYPE_CLICKTHROUGH', 11);
define('EVENT_TYPE_SNA_SHARING', 13);
define('EVENT_TYPE_SUBSCRIBE', 20);
define('EVENT_TYPE_UNSUBSCRIBE', 21);
define('EVENT_TYPE_GLOBAL_UNSUBSCRIBE', 22);
define('EVENT_TYPE_UNIVERSAL_UNSUBSCRIBE', 23);
define('EVENT_TYPE_SOFT_BOUNCE', 30);
define('EVENT_TYPE_HARD_BOUNCE', 31);
define('EVENT_TYPE_DATA_SET', 32);
define('EVENT_TYPE_CONFIRMATION MESSAGE', 33);
define('EVENT_TYPE_ABUSE', 34);
define('EVENT_TYPE_INVALID_EMAIL_ADDRESS', 35);
define('EVENT_TYPE_BLOCKED', 36);
define('EVENT_TYPE_DISPLAY_MSG', 40);
define('EVENT_TYPE_SNA_DISPLAY_MESSAGE', 41);
define('EVENT_TYPE_VIDEO_DISPLAY_MSG', 42);
define('EVENT_TYPE_MOBILE_DISPLAY_MSG', 43);
define('EVENT_TYPE_FTAF', 50);
define('EVENT_TYPE_FTAF_ANON', 51);
define('EVENT_TYPE_USER_LOGIN', 60);
define('EVENT_TYPE_USER_LOGOUT', 61);
define('EVENT_TYPE_USER_PASSWORD_CHANGE', 62);
define('EVENT_TYPE_SENDMESSAGE', 70);
define('EVENT_TYPE_SNA_POST_MESSAGE', 71);
define('EVENT_TYPE_SENDMESSAGE_CC', 72);
define('EVENT_TYPE_CONVERSION_DEEPLINK_TRACKING', 80);
define('EVENT_TYPE_CLICK_PREF_UNSUB', 81);
define('EVENT_TYPE_CLICK_PREF_MANAGER', 82);
define('EVENT_TYPE_CLICK_PREF_SUB', 83);
define('EVENT_TYPE_RSS_VISIT', 102);
define('EVENT_TYPE_SUPPRESS', 103);
define('EVENT_TYPE_ANALYTICS_ABANDONMENT', 121);
define('EVENT_TYPE_ANALYTICS_PURCHASES', 122);
define('EVENT_TYPE_ANALYTICS_VIEWS', 123);
define('EVENT_TYPE_VIDEO_LOADED', 130);
define('EVENT_TYPE_VIDEO_PLAYED', 131);
define('EVENT_TYPE_VIDEO_PAUSED', 132);
define('EVENT_TYPE_VIDEO_STOPPED', 133);
define('EVENT_TYPE_VIDEO_INTERRUPTED', 134);
define('EVENT_TYPE_VIDEO_CHECK_POINT_25', 135);
define('EVENT_TYPE_VIDEO_CHECK_POINT_50', 136);
define('EVENT_TYPE_VIDEO_CHECK_POINT_75', 137);
define('EVENT_TYPE_VIDEO_COMPLETED', 138);
define('EVENT_TYPE_SNA_DIGG_VIEW', 151);
define('EVENT_TYPE_SNA_DIGG_SHARE', 152);
define('EVENT_TYPE_SNA_FACEBOOK_VIEW', 153);
define('EVENT_TYPE_SNA_FACEBOOK_SHARE', 154);
define('EVENT_TYPE_SNA_LINKEDIN_VIEW', 155);
define('EVENT_TYPE_SNA_LINKEDIN_SHARE', 156);
define('EVENT_TYPE_SNA_MYSPACE_VIEW', 157);
define('EVENT_TYPE_SNA_MYSPACE_SHARE', 158);
define('EVENT_TYPE_SNA_PING_VIEW', 159);
define('EVENT_TYPE_SNA_PING_SHARE', 160);
define('EVENT_TYPE_SNA_TWITTER_VIEW', 161);	define('EVENT_TYPE_SNA_TWITTER_SHARE', 162);
define('EVENT_TYPE_SNA_GOOGLEPLUS_VIEW', 163);
define('EVENT_TYPE_SNA_GOOGLEPLUS_SHARE', 164);
define('EVENT_TYPE_SNA_STUMBLEUPON_VIEW', 165);
define('EVENT_TYPE_SNA_STUMBLEUPON_SHARE', 166);
define('EVENT_TYPE_SNA_PINTEREST_VIEW', 167);
define('EVENT_TYPE_SNA_PINTEREST_SHARE', 168);
define('EVENT_TYPE_SOFT_BOUNCE_UNSUBSCRIBE', 230);
define('EVENT_TYPE_SNA_DIGG_CLICKTHROUGH', 301);
define('EVENT_TYPE_SNA_FACEBOOK_CLICKTHROUGH', 302);
define('EVENT_TYPE_SNA_LINKEDIN_CLICKTHROUGH', 303);
define('EVENT_TYPE_SNA_MYSPACE_CLICKTHROUGH', 304);
define('EVENT_TYPE_SNA_PING_CLICKTHROUGH', 305);	define('EVENT_TYPE_SNA_TWITTER_CLICKTHROUGH', 306);
define('EVENT_TYPE_SNA_GOOGLEPLUS_CLICKTHROUGH', 307);
define('EVENT_TYPE_SNA_STUMBLEUPON_CLICKTHROUGH', 308);
define('EVENT_TYPE_SNA_PINTEREST_CLICKTHROUGH', 309);
define('EVENT_TYPE_SNA_FACEBOOK_POST', 401);
define('EVENT_TYPE_SNA_LINKEDIN_POST', 402);
define('EVENT_TYPE_SNA_TWITTER_POST', 403);
define('EVENT_TYPE_PROFILE_MANAGER', 999999);

$event_type = EVENT_TYPE_CLICKTHROUGH;
$start_datetime = '02/01/2016 13:00:00';
$end_datetime = '03/01/2016 13:00:00';
$offset = 0;

$output = $whatcounts->reportTrackedEvents($event_type, $start_datetime, $end_datetime, $offset);

####按活动报告跟踪事件

define('EVENT_TYPE_NONE', 0);
define('EVENT_TYPE_SENT', 9);
define('EVENT_TYPE_OPEN', 10);
define('EVENT_TYPE_CLICKTHROUGH', 11);
define('EVENT_TYPE_SNA_SHARING', 13);
define('EVENT_TYPE_SUBSCRIBE', 20);
define('EVENT_TYPE_UNSUBSCRIBE', 21);
define('EVENT_TYPE_GLOBAL_UNSUBSCRIBE', 22);
define('EVENT_TYPE_UNIVERSAL_UNSUBSCRIBE', 23);
define('EVENT_TYPE_SOFT_BOUNCE', 30);
define('EVENT_TYPE_HARD_BOUNCE', 31);
define('EVENT_TYPE_DATA_SET', 32);
define('EVENT_TYPE_CONFIRMATION MESSAGE', 33);
define('EVENT_TYPE_ABUSE', 34);
define('EVENT_TYPE_INVALID_EMAIL_ADDRESS', 35);
define('EVENT_TYPE_BLOCKED', 36);
define('EVENT_TYPE_DISPLAY_MSG', 40);
define('EVENT_TYPE_SNA_DISPLAY_MESSAGE', 41);
define('EVENT_TYPE_VIDEO_DISPLAY_MSG', 42);
define('EVENT_TYPE_MOBILE_DISPLAY_MSG', 43);
define('EVENT_TYPE_FTAF', 50);
define('EVENT_TYPE_FTAF_ANON', 51);
define('EVENT_TYPE_USER_LOGIN', 60);
define('EVENT_TYPE_USER_LOGOUT', 61);
define('EVENT_TYPE_USER_PASSWORD_CHANGE', 62);
define('EVENT_TYPE_SENDMESSAGE', 70);
define('EVENT_TYPE_SNA_POST_MESSAGE', 71);
define('EVENT_TYPE_SENDMESSAGE_CC', 72);
define('EVENT_TYPE_CONVERSION_DEEPLINK_TRACKING', 80);
define('EVENT_TYPE_CLICK_PREF_UNSUB', 81);
define('EVENT_TYPE_CLICK_PREF_MANAGER', 82);
define('EVENT_TYPE_CLICK_PREF_SUB', 83);
define('EVENT_TYPE_RSS_VISIT', 102);
define('EVENT_TYPE_SUPPRESS', 103);
define('EVENT_TYPE_ANALYTICS_ABANDONMENT', 121);
define('EVENT_TYPE_ANALYTICS_PURCHASES', 122);
define('EVENT_TYPE_ANALYTICS_VIEWS', 123);
define('EVENT_TYPE_VIDEO_LOADED', 130);
define('EVENT_TYPE_VIDEO_PLAYED', 131);
define('EVENT_TYPE_VIDEO_PAUSED', 132);
define('EVENT_TYPE_VIDEO_STOPPED', 133);
define('EVENT_TYPE_VIDEO_INTERRUPTED', 134);
define('EVENT_TYPE_VIDEO_CHECK_POINT_25', 135);
define('EVENT_TYPE_VIDEO_CHECK_POINT_50', 136);
define('EVENT_TYPE_VIDEO_CHECK_POINT_75', 137);
define('EVENT_TYPE_VIDEO_COMPLETED', 138);
define('EVENT_TYPE_SNA_DIGG_VIEW', 151);
define('EVENT_TYPE_SNA_DIGG_SHARE', 152);
define('EVENT_TYPE_SNA_FACEBOOK_VIEW', 153);
define('EVENT_TYPE_SNA_FACEBOOK_SHARE', 154);
define('EVENT_TYPE_SNA_LINKEDIN_VIEW', 155);
define('EVENT_TYPE_SNA_LINKEDIN_SHARE', 156);
define('EVENT_TYPE_SNA_MYSPACE_VIEW', 157);
define('EVENT_TYPE_SNA_MYSPACE_SHARE', 158);
define('EVENT_TYPE_SNA_PING_VIEW', 159);
define('EVENT_TYPE_SNA_PING_SHARE', 160);
define('EVENT_TYPE_SNA_TWITTER_VIEW', 161);	define('EVENT_TYPE_SNA_TWITTER_SHARE', 162);
define('EVENT_TYPE_SNA_GOOGLEPLUS_VIEW', 163);
define('EVENT_TYPE_SNA_GOOGLEPLUS_SHARE', 164);
define('EVENT_TYPE_SNA_STUMBLEUPON_VIEW', 165);
define('EVENT_TYPE_SNA_STUMBLEUPON_SHARE', 166);
define('EVENT_TYPE_SNA_PINTEREST_VIEW', 167);
define('EVENT_TYPE_SNA_PINTEREST_SHARE', 168);
define('EVENT_TYPE_SOFT_BOUNCE_UNSUBSCRIBE', 230);
define('EVENT_TYPE_SNA_DIGG_CLICKTHROUGH', 301);
define('EVENT_TYPE_SNA_FACEBOOK_CLICKTHROUGH', 302);
define('EVENT_TYPE_SNA_LINKEDIN_CLICKTHROUGH', 303);
define('EVENT_TYPE_SNA_MYSPACE_CLICKTHROUGH', 304);
define('EVENT_TYPE_SNA_PING_CLICKTHROUGH', 305);	define('EVENT_TYPE_SNA_TWITTER_CLICKTHROUGH', 306);
define('EVENT_TYPE_SNA_GOOGLEPLUS_CLICKTHROUGH', 307);
define('EVENT_TYPE_SNA_STUMBLEUPON_CLICKTHROUGH', 308);
define('EVENT_TYPE_SNA_PINTEREST_CLICKTHROUGH', 309);
define('EVENT_TYPE_SNA_FACEBOOK_POST', 401);
define('EVENT_TYPE_SNA_LINKEDIN_POST', 402);
define('EVENT_TYPE_SNA_TWITTER_POST', 403);
define('EVENT_TYPE_PROFILE_MANAGER', 999999);

$campaign_id = 47;
$event_type = EVENT_TYPE_CLICKTHROUGH;
$start_datetime = '02/01/2016 13:00:00';	$end_datetime = '03/16/2016 13:00:00';
$offset = 0;

$output = $whatcounts->reportTrackedEventsByCampaign($campaign_id, $event_type, $start_datetime, $end_datetime, $offset);

####显示硬退订

$list_id = 13;
$days = 45;

$output = $whatcounts->showHardBounces($list_id, $days);

####显示软退订

$list_id = 13;
$days = 45;

$output = $whatcounts->showSoftBounces($list_id, $days);

####显示阻止退订

$list_id = 13;
$days = 45;

$output = $whatcounts->showBlockBounces($list_id, $days);

####显示投诉

$list_id = 13;
$days = 45;

$output = $whatcounts->showComplaints($list_id, $days);

####通过更新报告订阅者

$list_id = 13;
$start_datetime = '2/1/2016 12:00:00';
$end_datetime = '4/1/2016 11:59:59';

$output = $whatcounts->reportSubscriberByUpdate($list_id, $start_datetime, $end_datetime);

####报告列表中的订阅者

$list_id = 13;
$offset = 0;

$output = $whatcounts->reportSubscribersInList($list_id, $offset);

@todo

####A/B测试

  • chooseABWinner: 选择A/B赢家

####文章

  • createArticle: 创建文章

####文件夹

  • createFolder: 创建文件夹
  • getFolderById: 通过ID获取文件夹

####发送邮件

  • scheduleCampaignt: 安排活动部署
  • processSpringbotAbandonedCart: 处理遗弃购物车

####关系数据

这些命令(https://support.whatcounts.com/hc/en-us/articles/204669685-Commands)没有API文档

  • relationalactivatefield: 激活字段
  • relationalactivatetable: 激活表
  • relationaladdfield: 添加字段
  • relationaladdtable: 添加表
  • relationaldelete: 删除数据
  • relationalfind: 查找数据
  • relationalfindfield: 查找字段
  • relationalfindtables: 查找表
  • relationalsave: 保存数据

###API问题

这些命令不能返回格式良好的XML,因此需要以CSV形式返回数据

  • rpt_bounce_stats
  • rpt_abstats
  • showarticlelist
  • show_campaigns
  • show_campaign_stats_multi
  • show_lists
  • show_seg
  • show_templates
  • show_user_events

这些命令不能正确返回失败(当测试没有返回结果时)

  • findinlist
  • find

使用API版本8.4.0会导致命令'detail'返回不完整的XML

执行命令subandsend会发送电子邮件并添加订阅者,但似乎不会添加到列表中。

createarticle返回"FAILURE: cannot create article [article_name]"

show_campaign_list返回track_clicks两次。一次作为true/false,一次作为yes/no。

rpt_bounce_stats似乎忽略了bounce_type,并返回所有bounce_type值。

关于

Zaycon Fresh开发