Przejdź do treści

Get link statistics

LinkStatistics collection allows retrieving performance statistics for a specified message that are grouped by links such message contains. For every found link numbers of clicks, unique clicks etc. are available.

Request data format

Request URL parameters:

Element/attributeTypeNotes
apiKeystringYour API key, required for authentication. Required.
IDintMessage ID. Required as a part of address (not GET parameter). See example below.
startDatedateStart date. Optional. Both parameters (startDate, endDate) are required to specify statistics range. Otherwise they are ignored. YYYY-MM-DD format.
endDatedateSee startDate.

Examples:

https://api.esv2.com/v2/Api/LinkStatistics/123?apiKey=YOUR_API_KEY_HERE 

https://api.esv2.com/v2/Api/LinkStatistics/123?apiKey=YOUR_API_KEY_HERE&startDate=2010-05-20&endDate=2010-05-22

Response

Response Data element:

Element/attributeTypeNotes
LinkStatisticsarray[complex]Array of LinkStatistic elements.

LinkStatistic element children:

Element/attributeTypeNotes
UrlstringLink URL.
TitlestringLink title. Serialized only when not empty.
ClicksintTotal number of clicks.
UniqueClicksintTotal number of unique clicks.

Examples

Request:

GET https://api.esv2.com/v2/Api/LinkStatistics/123?apiKey=test_api_key1 HTTP/1.1
Accept-Encoding: gzip,deflate
Host: api.esv2.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

OK response:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319
Set-Cookie: TEMP_DATA=52936639-f1a2-4537-acba-c405471a1203; path=/
X-Powered-By: ASP.NET
Date: Thu, 26 Nov 2015 14:22:15 GMT
Content-Length: 1954

<ApiResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Data>
        <LinkStatistics>
            <LinkStatistic>
                <Url>https://www.example.com/products/summer-sale</Url>
                <Title>Summer Sale</Title>
                <Clicks>400</Clicks>
                <UniqueClicks>201</UniqueClicks>
            </LinkStatistic>
            <LinkStatistic>
                <Url>*[link_preferencecenter]*</Url>
                <Clicks>399</Clicks>
                <UniqueClicks>201</UniqueClicks>
            </LinkStatistic>
            <LinkStatistic>
                <Url>https://www.example.com/blog/welcome</Url>
                <Title>Read more</Title>
                <Clicks>128</Clicks>
                <UniqueClicks>97</UniqueClicks>
            </LinkStatistic>
        </LinkStatistics>
    </Data>
</ApiResponse>