Performance
Performance by category
GET
https://thoughtmetric.io/api/v1/performance_data_by_product_category
Sales performance grouped by the product categories in your catalog, ranked by total sales and capped at 100 rows.
Example request
curl -G https://thoughtmetric.io/api/v1/performance_data_by_product_category \
-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_category?' . $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_category?${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 category, ordered by total_sales descending.
| product_category number | Product category from your catalog. Null for SKUs with no category on record. |
| 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_category": "Knitwear",
"total_sales": 48210.25,
"orders": 540.0,
"spend": 11204.80,
"roas": 4.30,
"item_quantity": 622.0,
"total_discounts": 2140.00,
"total_refund": 480.50,
"net_sales": 45589.75
}
]
}
Notes
- There is no
over_timeseries on this endpoint. - Products with no category on record are grouped into a single row with a null
product_category.