getBatchDeviceStatistics

Returns statistics for a Batch.

getBatchDeviceStatistics

Returns statistics for a Batch.

Top ↑

Syntax

object getBatchDeviceStatistics( string api_key, int batch_id );

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

batch_id (int)

The ID of the Batch.

Return Value

Returns an object containing statistics for the Batch. See the remarks section below for the list of values this method returns.

Examples

$batch_id = 1234567;

$api        = new Api($url, 'YOURAPIKEY');
$statistics = $api->invokeMethod('getBatchDeviceStatistics', $batch_id);
{
    "id": 1,
    "method": "getBatchDeviceStatistics",
    "params": [
        "YOURAPIKEY",
        1234567
    ]
}
{
    "id": 1,
    "result": {
        "device_statistics": {
            "desktop": {
                "total_count": 2,
                "percentage": 66.67
            },
            "mobile": {
                "total_count": 0,
                "percentage": 0
            },
            "unknown": {
                "total_count": 1,
                "percentage": 33.33
            }
        },
        "mail_clients": {
            "webmail_other": {
                "title": "Webmail (Other)",
                "total": 2,
                "percent": 100
            }
        }
    },
    "error": null
}

Remarks

The following table shows the values that are returned.

Field Type Description
device_statistics array An array of different devices and some details about the emails opened on them if available
mail_clients array An array of the different email clients used to open batch messages if available

Error Codes

This method may return the following error code in addition to the standard error codes:

Code Error Description
308 Unable to load Batch The system could not load batch_id.

See Also