Events & ExportRevenue and units per product

Revenue and units per product

Top products by revenue, units or orders, grouped by product id, SKU, variant, name, category or brand. Reads one row per line item, expanded from the ecommerce spec's items array at ingest — which is why this is a separate endpoint rather than an explore query: items is an array, and the typed events table the explore engine reads holds only scalars.

revenue is sum(unit price x quantity) across line items. It excludes shipping and tax, so it will NOT equal GET /commerce/summary revenue. Both are correct for their own question; revenue_basis says which you got.

Set event to add_to_cart or view_item to get the same rollup at an earlier funnel stage — which products get looked at versus bought.

Labels (item_name, item_brand, item_category) are reported as the most recent value seen rather than grouped on, so a product renamed mid-window stays one row instead of splitting its revenue in two.

Rows come back ordered by order_by descending and truncated at limit; truncated: true means the catalogue's tail was dropped, never its top sellers. Currencies are never summed together.

curl -X GET "https://mythic-analytics.gulp.workers.dev/client/v1/data/commerce/items?event=purchase&group_by=item_id&order_by=revenue&date_from=example_string&date_to=example_string&currency=example_string&limit=100" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": {
    "event": "purchase",
    "group_by": "item_id",
    "order_by": "revenue",
    "revenue_basis": "line_items",
    "truncated": false,
    "items": [
      {
        "item_key": "7734115",
        "currency": "USD",
        "item_name": "The Collection Snowboard",
        "item_brand": "Hydrogen",
        "item_category": "Snowboards",
        "sku": "SNOW-01",
        "revenue": 2700,
        "units": 90,
        "orders": 61,
        "buyers": 58,
        "average_unit_price": 30,
        "discount_total": 145
      }
    ],
    "note_on_revenue": "example_string"
  }
}
GET
/commerce/items
GET
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.

Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.
query
eventstring

Commerce event name. Default purchase.

query
group_bystring

Product dimension to group on.

Options: item_id, sku, item_variant_id, item_name, item_category, item_brand
query
order_bystring
Options: revenue, units, orders
query
date_fromstring

ISO date (YYYY-MM-DD) or timestamp. Default 30 days ago.

query
date_tostring

ISO date or timestamp, inclusive.

query
currencystring

ISO 4217 code.

Min length: 3 • Max length: 3
query
limitinteger

Max rows, 1-1000. Default 100.

Min: 1 • Max: 1000
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.

Query Parameters

eventstring

Commerce event name. Default purchase.

group_bystring

Product dimension to group on.

Allowed values:item_idskuitem_variant_iditem_nameitem_categoryitem_brand
order_bystring
Allowed values:revenueunitsorders
date_fromstring

ISO date (YYYY-MM-DD) or timestamp. Default 30 days ago.

date_tostring

ISO date or timestamp, inclusive.

currencystring

ISO 4217 code.

limitinteger

Max rows, 1-1000. Default 100.

Responses

successboolean
dataobject