Performance
Performance by product
GET
https://thoughtmetric.io/api/v1/performance_data_by_product
Sales performance per product, ranked by total sales and capped at 100 rows. Ad spend is allocated to products from your product-level ad metrics, so return on ad spend is available per product.
Example request
curl -G https://thoughtmetric.io/api/v1/performance_data_by_product \
-H "Authorization: Bearer 2019962dcf7a7b1fedc4563b9aaf9fc87426f278" \
-d projectId=ID-bcd0aa692ce7e6b2 \
-d startDate=2024-01-01 \
-d endDate=2024-01-31 \
-d interval=day
<?php
$query = http_build_query([
'projectId' => 'ID-bcd0aa692ce7e6b2',
'startDate' => '2024-01-01',
'endDate' => '2024-01-31',
'interval' => 'day',
]);
$ch = curl_init('https://thoughtmetric.io/api/v1/performance_data_by_product?' . $query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer 2019962dcf7a7b1fedc4563b9aaf9fc87426f278',
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
const params = new URLSearchParams({
projectId: 'ID-bcd0aa692ce7e6b2',
startDate: '2024-01-01',
endDate: '2024-01-31',
interval: 'day',
});
const response = await fetch(
`https://thoughtmetric.io/api/v1/performance_data_by_product?${params}`,
{ headers: { Authorization: 'Bearer 2019962dcf7a7b1fedc4563b9aaf9fc87426f278' } }
);
const data = await response.json();
Query parameters
| projectId string, required | The Project ID of the store you are querying, e.g. ID-bcd0aa692ce7e6b2. Find it under Configure → API in the dashboard. The older numeric project ID is also accepted. |
| startDate string, required | Start of the reporting window, YYYY-MM-DD. Inclusive. |
| endDate string, required | End of the reporting window, YYYY-MM-DD. Inclusive. The window may not exceed six months. |
| interval string, required | Bucket size for the over_time series: day, week, month or year. |
| model string, optional | Attribution model: first, last, position, linearNonDirect or linearPaid. Defaults to the model configured on the project. |
Response
total
array
Up to 100 objects, one per product, ordered by total_sales descending.
| product_name number | Product name as reported by your e-commerce platform. |
| total_sales number | Total value of attributed orders. |
| orders number | Orders attributed to this row. |
| spend number | Ad spend as reported by the ad platform, in the platform's own currency. |
| roas number | Return on ad spend, total_sales divided by converted_spend. |
| item_quantity number | Units sold across attributed orders. |
| total_discounts number | Discounts applied to attributed orders. |
| total_refund number | Amount refunded on attributed orders. |
| net_sales number | Sales after refunds, excluding shipping and tax. |
Example response
200 OK
{
"total": [
{
"product_name": "Merino Wool Crew - Charcoal",
"total_sales": 18422.50,
"orders": 204.0,
"spend": 4210.15,
"roas": 4.37,
"item_quantity": 231.0,
"total_discounts": 810.00,
"total_refund": 220.50,
"net_sales": 17392.00
},
{
"product_name": "Merino Wool Crew - Navy",
"total_sales": 14108.75,
"orders": 168.0,
"spend": 3902.44,
"roas": 3.61,
"item_quantity": 179.0,
"total_discounts": 640.00,
"total_refund": 0.0,
"net_sales": 13468.75
}
]
}
Notes
- There is no
over_timeseries on this endpoint. - Rows are grouped by product name, so a product sold under more than one SKU is combined into a single row.