campaignEmailDomainPerformance()

List of recipients’ email domains (array) is obtained, as well as statistics about each of these email domains.

campaignEmailDomainPerformance(string $cid) : array

Input parameters
  • cid - campaign ID
Obtained information

Array of domains. Each domain is represented as an array consisting of:

  • domain - domain name
  • total_sent - number of sent emails (for the whole campaign)
  • emails - number of sent emails (for a specific domain)
  • bounces - number of hard bounces
  • opens - number of unique opens
  • clicks - number of unique clicks
  • unsubs - number of unsubscribes
  • delivered - number of delivered emails
  • emails_pct - percentage of sent emails
  • bounces_pct - percentage of bounced emails
  • opens_pct - percentage of open rate
  • clicks_pct - percentage of click rate
  • unsubs_pct - percentage of unsubscribe rate

Examples

mgapi_campaignEmailDomainPerformance.php
campaignEmailDomainPerformance($cid);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load campaignEmailDomainPerformance()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    if (sizeof($retval) == 0) {
        echo "No Email Domain stats yet!\n";
    } else {
        foreach ($retval as $domain) {
            echo $domain['domain'] . "\n";
            echo "\tEmails: " . $domain['emails'] . "\n";
            echo "\tOpens: " . $domain['opens'] . "\n";
            echo "\tClicks: " . $domain['clicks'] . "\n";
        }
    }
}
xml-rpc_campaignEmailDomainPerformance.php
 new xmlrpcval($apikey),
                    'cid' => new xmlrpcval($campaignId),
                    'start' => new xmlrpcval(0),
                    'limit' => new xmlrpcval(1000)
                ),
                'struct');
$f = new xmlrpcmsg('campaignEmailDomainPerformance', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$c->setDebug($debug);
$r = &$c->send($f);
 
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    if (sizeof($retval) == 0) {
        echo "No Email Domain stats yet!\n";
    } else {
        foreach ($retval as $domain) {
            echo $domain['domain'] . "\n";
            echo "\tEmails: " . $domain['emails'] . "\n";
            echo "\tOpens: " . $domain['opens'] . "\n";
            echo "\tClicks: " . $domain['clicks'] . "\n";
        }
    }
} else {
    echo "Unable to run campaignEmailDomainPerformance()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_campaignEmailDomainPerformance.py
from lib.config import * #contains apikey
from lib.MGAPI import MGAPI
 
# This Example shows how to ping using the MGAPI.php class and do some basic error checking.
 
api = MGAPI(apikey)
 
cid = campaignId
 
retval = api.campaignEmailDomainPerformance(cid)
if api.errorCode:
    print "Unable to load campaignEmailDomainPerformance()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    if len(retval) == 0:
        print "No Email Domain stats yet!"
    else:
        for domain in retval:
            print domain['domain']
            print "\tEmails: ", domain['emails']
            print "\tOpens: ", domain['opens']
            print "\tClicks: ", domain['clicks']

© 2010-2017 Mailigen. All rights reserved.