Skip to main content

itemStatistics Query

Description

Returns aggregated page view and sales statistics for an item.

query itemStatistics(
$itemRef: ID!
$from: Date
$to: Date
$granularity: StatisticsGranularity
) {
itemStatistics(
itemRef: $itemRef
from: $from
to: $to
granularity: $granularity
) {
granularity
pageViews
sold
series {
date
pageViews
sold
}
campaignEvents {
campaignRef
title
listTitle
date
recipientsCount
}
stockHistory {
date
quantity
}
lastSoldAt
countrySales {
alpha2
count
}
}
}

Variables

{
"itemRef": "549871d0b1522d6052152424",
"from": 1752355238578,
"to": 1749708390178,
"granularity": "hour"
}

Response

{
"itemStatistics": {
"granularity": "hour",
"pageViews": 42,
"sold": 42,
"series": [
{
"date": 1770692779564,
"pageViews": 42,
"sold": 42
}
],
"campaignEvents": [
{
"campaignRef": "d3f47b27a9ec3c3ac7615983",
"title": "example",
"listTitle": "example",
"date": 1739338054998,
"recipientsCount": 42
}
],
"stockHistory": [
{
"date": 1772071147033,
"quantity": 1
}
],
"lastSoldAt": 1773373507537,
"countrySales": [
{
"alpha2": "example",
"count": 10
}
]
}
}

Arguments

NameTypeDescription
itemRefID!Item reference (_id).
fromDateStart of the date range (inclusive). Omit for all-time statistics.
toDateEnd of the date range (inclusive). Omit for all-time statistics.
granularityStatisticsGranularityForce a specific bucket granularity. Omit to let the server pick automatically.

Returns

ItemStatistics