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/attribute | Type | Notes |
|---|---|---|
| apiKey | string | Your API key, required for authentication. Required. |
| ID | int | Message ID. Required as a part of address (not GET parameter). See example below. |
| startDate | date | Start date. Optional. Both parameters (startDate, endDate) are required to specify statistics range. Otherwise they are ignored. YYYY-MM-DD format. |
| endDate | date | See 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-22Response
Response Data element:
| Element/attribute | Type | Notes |
|---|---|---|
| LinkStatistics | array[complex] | Array of LinkStatistic elements. |
LinkStatistic element children:
| Element/attribute | Type | Notes |
|---|---|---|
| Url | string | Link URL. |
| Title | string | Link title. Serialized only when not empty. |
| Clicks | int | Total number of clicks. |
| UniqueClicks | int | Total 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>