Jump to content

CampaignOpens()

Returns the unique and total opens for a given campaign

Parameters

ApiKey (Required)
    Your application authentication key. Click here to find out more.
CampaignReportID (Required)
    The ID number of the sent email campaign, as seen in the Reports tab.  Note: in API version 1, this parameter was named EmailID.  Click here to find out more.

Return Value

On success, this method returns two values:

  • Total Opens - the number of times the received campaign email was opened by all who received it. This includes multiple opens by the same subcriber.
  • Unique Opens - the number of subscribers who opened the received campaign email at least once. This does not factor in multiple opens by the same subscriber, so this number may be smaller than the Total Opens number.

On failure, a SOAP fault exception is thrown with one of the fault codes below.

Usage Notes

Note that CampaignReportID values are not the same as CampaignID values. CampaignReportIDs are retrieved from the Reports tab, as explained here.

Fault Codes

200 - Invalid CampaignReportID
    The Associated Campaign Report is not valid

100 - Invalid API Key
    The API key is not valid or expired

SOAP Sample Request


    
    
        
            
                STRING
                INT
            
        
    

SOAP Sample Response


    
    
        
            
                INT
                INT
            
        
    

Code Sample - PHP

// Import the eConnect Email API Toolkit
require_once('eConnectEmail_API_Toolkit.php');

$eConnectEmailApi = TheKeyMakerClient('YOUR_API_KEY');

$result = $eConnectEmailApi->CampaignOpens(CAMPAIGN_REPORT_ID);

// Show the results
print 'Response: <pre>';
print_r($result);
print '</pre>';

Code Sample - ASP.NET C#

            TheKeyMaker_v20 api = new TheKeyMaker_v20();
            // Set up input parameters
            CampaignParams campaignParams = new CampaignParams();
            campaignParams.ApiKey = txtApiKey.Text;
            campaignParams.CampaignReportID = int.Parse(txtCOCampaignReportID.Text);

            // Invoke method and store result
            CampaignOpensReturn campaignOpens = api.CampaignOpens(campaignParams);

            // Display results
            lblResult.Text = FormatValue("Unique Opens", campaignOpens.UniqueOpens.ToString())
                + FormatValue("Total Opens", campaignOpens.TotalOpens.ToString());