Jump to content

CampaignClicks()

Returns the unique and total clicks 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.Click here to find out more.

Return Value

On success, this method returns two values:

  • Total Clicks - the number of link clicks between all links and subscribers. This includes links that are clicked more than once by the same subscriber.
  • Unique Clicks - the number of distinct link clicks. Links clicked more than once by any given subscriber are counted just once, so this number may be smaller than the Total Clicks 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->CampaignClicks(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(txtCCCampaignReportID.Text);

            // Invoke method and store result
            CampaignClicksReturn campaignClicks = api.CampaignClicks(campaignParams);

            // Display results
            lblResult.Text = FormatValue("Unique Clicks", campaignClicks.UniqueClicks.ToString())
                + FormatValue("Total Clicks", campaignClicks.TotalClicks.ToString());