« Back to Documentation Overview

campaignEmailDomainPerformance – v1.2

 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
Returned Fields
stringdomainDomain name or special "Other" to roll-up stats past 5 domains
integertotal_sentTotal Email across all domains - this will be the same in every row
integeremailsNumber of emails sent to this domain
integerbouncesNumber of bounces
integeropensNumber of opens
integerclicksNumber of clicks
integerunsubsNumber of unsubs
integerdeliveredNumber of deliveries
integeremails_pctPercentage of emails that went to this domain (whole number)
integerbounces_pctPercentage of bounces from this domain (whole number)
integeropens_pctPercentage of opens from this domain (whole number)
integerclicks_pctPercentage of clicks from this domain (whole number)
integerunsubs_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.