« Back to Documentation Overview

campaignEmailDomainPerformance – 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.

Section
Campaign Stats
mcapi_campaignEmailDomainPerformance.php
Parameters
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
stringdomainDomain name or special "Other" to roll-up stats past 5 domains
inttotal_sentTotal Email across all domains - this will be the same in every row
intemailsNumber of emails sent to this domain
intbouncesNumber of bounces
intopensNumber of opens
intclicksNumber of clicks
intunsubsNumber of unsubs
intdeliveredNumber of deliveries
intemails_pctPercentage of emails that went to this domain (whole number)
intbounces_pctPercentage of bounces from this domain (whole number)
intopens_pctPercentage of opens from this domain (whole number)
intclicks_pctPercentage of clicks from this domain (whole number)
intunsubs_pctPercentage of unsubs from this domain (whole number)

Examples (1)

download example code

[1] mcapi_campaignEmailDomainPerformance.php

  1. <?php
  2. /**
  3. This Example shows how to retrieve email domain performance for a campaign via
  4. the API and do some basic error checking.
  5. **/
  6. // Include the MailChimp API code. Do Not Edit This!
  7. require_once 'inc/MCAPI.class.php';
  8. require_once 'inc/config.inc.php'; //contains apikey
  9.  
  10. $api = new MCAPI($apikey);
  11.  
  12. $domains = $api->campaignEmailDomainPerformance($campaignId);
  13.  
  14. if ($api->errorCode){
  15. echo "\tCode=".$api->errorCode."\n";
  16. echo "\tMsg=".$api->errorMessage."\n";
  17. } else {
  18. if (sizeof($domains)==0){
  19. echo "No Email Domain stats yet!\n";
  20. } else {
  21. foreach($domains as $domain){
  22. echo $domain['domain']."\n";
  23. echo "\tEmails: ".$domain['emails']."\n";
  24. echo "\tOpens: ".$domain['opens']."\n";
  25. echo "\tClicks: ".$domain['clicks']."\n";
  26. }
  27. }
  28. }
  29.  
  30. ?>
  31.  
  32.