GET /api/v3/accounts/{lcuid}/analytics/by-item¶
Summary¶
GET accounts/{id}/analytics/by-item
Description¶
Return the analytics data, by-item, for an account across a specified timeframe
Tags: analytics
Parameters¶
Header Parameters¶
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization |
string |
✓ Yes | Bearer {AuthToken} |
|
Content-Type |
string |
✓ Yes | application/json |
|
Accept |
string |
✓ Yes | application/json |
|
AppIdV3 |
string |
✓ Yes | LCUID-LAP-********-****-****-****-************ |
Request Body¶
Required: Yes
Content Type: application/json¶
Schema¶
Type: object
Required fields: timeframe
Properties:
timeframe(string) (required): The timeframe to use. One of the defined timeframes, or passcustomin order to pass custom dates See timeframes reference.timeframe_opts(string): The timeframe options to use when timeframe is set tocustomThis is formated as a json string containing thestart_dateandend_datekeys inYYYY-MM-DDformat. Must be a valid JSON string.
Responses¶
Response: 200¶
Description: Sample Response
Content Type: application/json¶
Schema¶
Type: object
Properties:
success(boolean): trueanalytics(array): The analytics data-
Array items:
objectType:objectProperties:
lcuid(string): The lcuid of the itemname(string): The name of the itemunique_id(string): The vendor supplied unique_id of the itemtotal_plays(integer): The total number of playstotal_impressions(integer): The total number of impressionstotal_play_duration(integer): The total play duration in secondscreatives(array)-
Array items:
objectType:objectProperties:
lcuid(string)total_plays(integer)total_impressions(integer)total_play_duration(integer)
Example Response¶
{
"success": true,
"analytics": [
{
"lcuid": "LCUID-LI-87244b06-afab-46fe-a422-b757dfe1056f",
"name": "Spring Bunnies Ad",
"unique_id": "spb-123-5676",
"total_plays": 445,
"total_impressions": 445,
"total_play_duration": 3560,
"creatives": [
{
"lcuid": "LCUID-LP-bad4f682-7cb8-42a5-bdfc-92f18fe4b324",
"total_plays": 445,
"total_impressions": 445,
"total_play_duration": 3560
}
]
},
{
"lcuid": "LCUID-LI-382dbb26-ce25-464d-b99b-64bb0052afa4",
"name": "Spring Flowers Ad",
"unique_id": "spf-434-2424",
"total_plays": 445,
"total_impressions": 445,
"total_play_duration": 3560,
"creatives": [
{
"lcuid": "LCUID-LP-49cda013-9b6a-4fe0-8754-4185098d9027",
"total_plays": 445,
"total_impressions": 445,
"total_play_duration": 3560
}
]
}
]
}
Example Implementations¶
Bash (cURL)¶
curl --request GET \
--get "https://api.lucit.app/api/v3/accounts/LCUID-LA-506fc585-77be-11ec-acb9-c2cdb617d190/analytics/by-item" \
--header "Authorization: Bearer {AuthToken}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "AppIdV3: LCUID-LAP-********-****-****-****-************" \
--data "{
\"timeframe\": \"custom\",
\"timeframe_opts\": \"{\\\"start_date\\\":\\\"2021-09-01\\\",\\\"end_date\\\":\\\"2021-09-30\\\"}\"
}"
JavaScript (Fetch API)¶
const url = new URL(
"https://api.lucit.app/api/v3/accounts/LCUID-LA-506fc585-77be-11ec-acb9-c2cdb617d190/analytics/by-item"
);
const headers = {
"Authorization": "Bearer {AuthToken}",
"Content-Type": "application/json",
"Accept": "application/json",
"AppIdV3": "LCUID-LAP-********-****-****-****-************",
};
let body = {
"timeframe": "custom",
"timeframe_opts": "{\"start_date\":\"2021-09-01\",\"end_date\":\"2021-09-30\"}"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
PHP (Guzzle)¶
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.lucit.app/api/v3/accounts/LCUID-LA-506fc585-77be-11ec-acb9-c2cdb617d190/analytics/by-item',
[
'headers' => [
'Authorization' => 'Bearer {AuthToken}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'AppIdV3' => 'LCUID-LAP-********-****-****-****-************',
],
'json' => [
'timeframe' => 'custom',
'timeframe_opts' => '{"start_date":"2021-09-01","end_date":"2021-09-30"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Python (Requests)¶
import requests
import json
url = 'https://api.lucit.app/api/v3/accounts/LCUID-LA-506fc585-77be-11ec-acb9-c2cdb617d190/analytics/by-item'
payload = {
"timeframe": "custom",
"timeframe_opts": "{\"start_date\":\"2021-09-01\",\"end_date\":\"2021-09-30\"}"
}
headers = {
'Authorization': 'Bearer {AuthToken}',
'Content-Type': 'application/json',
'Accept': 'application/json',
'AppIdV3': 'LCUID-LAP-********-****-****-****-************'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()