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
}
}
}
Variables
{
"itemRef": "7c1b718d45408080aaf47352",
"from": 1718465086545,
"to": 1770275750145,
"granularity": "hour"
}
Response
{
"itemStatistics": {
"granularity": "hour",
"pageViews": 42,
"sold": 42,
"series": [
{
"date": 1718162842759,
"pageViews": 42,
"sold": 42
}
],
"campaignEvents": [
{
"campaignRef": "fd50c623426f75adf09d9202",
"title": "example",
"listTitle": "example",
"date": 1753833532366,
"recipientsCount": 42
}
],
"stockHistory": [
{
"date": 1763458230824,
"quantity": 1
}
]
}
}
Arguments
| Name | Type | Description |
|---|---|---|
itemRef | ID! | Item reference (_id). |
from | Date | Start of the date range (inclusive). Omit for all-time statistics. |
to | Date | End of the date range (inclusive). Omit for all-time statistics. |
granularity | StatisticsGranularity | Force a specific bucket granularity. Omit to let the server pick automatically. |