« Back to Documentation OverviewcampaignEmailDomainPerformance – v1.3
campaignEmailDomainPerformance(string apikey, string cid)
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.
| Parameters | mcapi_campaignEmailDomainPerformance.php| apikey | a valid API Key for your user account. Get by visiting your API dashboard |
| cid | the campaign id to pull email domain performance for (can be gathered using campaigns()) |
| Returns | | 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)
| |
Examples (1)
download example code
[1] mcapi_campaignEmailDomainPerformance.php
<?php
/**
This Example shows how to retrieve email domain performance for a campaign via
the API and do some basic error checking.
**/
// Include the MailChimp API code. Do Not Edit This!
require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey
$api = new MCAPI($apikey);
$domains = $api->campaignEmailDomainPerformance($campaignId);
if ($api->errorCode){
echo "\tCode=".$api->errorCode."\n"; echo "\tMsg=".$api->errorMessage."\n"; } else {
echo "No Email Domain stats yet!\n"; } else {
foreach($domains as $domain){
echo $domain['domain']."\n"; echo "\tEmails: ".$domain['emails']."\n"; echo "\tOpens: ".$domain['opens']."\n"; echo "\tClicks: ".$domain['clicks']."\n"; }
}
}
?>