campaignForwardStats()

Data is obtained about forwarded emails for a particular campaign if Mailigen forwarding code is embedded in the campaign.

campaignForwardStats(string $cid, integer $start, integer $limit) : array
Input parameters
  • cid - campaign ID
  • start - page number starting from which selection will be made (optional). Default value is 0.
  • limit - number of results returned in one page (optional). Default value is 1000. Maximum allowable value is 15000.
Information obtained
  • email list (array)

Examples

mgapi_campaignForwardStats.php
campaignForwardStats($cid, $start, $limit);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load campaignForwardStats()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    if (sizeof($retval) == 0) {
        echo "No stats for this campaign yet!\n";
    } else {
        foreach ($retval as $email => $detail) {
            echo "E-mail: " . $email . "\n";
            echo "\tFriend name = " . $detail['friend_name'] . "\n";
        }
    }
}
xml-rpc_campaignForwardStats.php
 new xmlrpcval($apikey),
                    'cid' => new xmlrpcval($campaignId),
                    'start' => new xmlrpcval(0),
                    'limit' => new xmlrpcval(25)
                ),
                'struct');
$f = new xmlrpcmsg('campaignForwardStats', 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 stats for this campaign yet!\n";
    } else {
        foreach ($retval as $email => $detail) {
            echo "E-mail: " . $email . "\n";
            echo "\tFriend name = " . $detail['friend_name'] . "\n";
        }
    }
} else {
    echo "Unable to run campaignForwardStats()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
xml-rpc_campaignForwardStats.php
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
start = 0
limit = 1000
 
retval = api.campaignForwardStats(cid, start, limit)
if api.errorCode:
    print "Unable to load campaignForwardStats()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    if len(retval) == 0:
        print "No stats for this campaign yet!"
    else:
        for email, detail in retval.items():
            print "E-mail: ", email
            print "\tFriend name = ", detail['friend_name']

© 2010-2017 Mailigen. All rights reserved.