Fetch Sitewide Analytics

Get sitewide order distribution

Retrieve order value distribution data and unit mix breakdowns for a time window.

Parameters

  • start — optional ISO 8601 datetime string. Beginning of the analysis window. Defaults to the start of the week (Monday, store timezone) containing the date 12 weeks ago.
  • end — optional ISO 8601 datetime string. End of the analysis window. Defaults to now (rounded to the cache interval).
  • filters — optional shared sitewide filters object. See the Filters Reference.

The window is start / end, not startTs / endTs. Every /analytics/sitewide/* endpoint takes ISO 8601 datetime strings under start and end. The epoch-seconds startTs / endTs pair used by the experience endpoints (/analytics/resource/{experienceId}, /analytics/experience/{experienceId}/timeseries, /analytics/experience/{experienceId}/export) is not accepted here: unknown fields are stripped rather than rejected, so a request sending startTs / endTs returns 200 over this endpoint's default window — from the start of the week (Monday, store timezone) 12 weeks ago until now — instead of the range you asked for, and nothing in the response flags the substitution. The default differs per sitewide endpoint, so always pass an explicit start when you need a specific window. Date-only strings and datetimes without an offset are rejected — send a full datetime with Z or an offset ("2026-06-01T00:00:00Z", not "2026-06-01" or "2026-06-01T00:00:00").

Response

The response returns orderValueDistribution.kernel_density_estimate and orderValueDistribution.cumulative_distribution_function, plus orderBreakdown and currency.

Both distribution arrays hold one entry per sampled order-value point, each with x (the order value) and the two series current_period and previous_period. The two arrays share the same x grid, so they can be zipped by index.

orderBreakdown is an array of unit-mix rows. Each row carries dt (the start of its weekly bucket, in the store's timezone, formatted "YYYY-MM-DD HH:MM:SS"), a plain-number unit_quantity, plus n_orders, net_revenue, gross_profit, and the share metrics pct_orders_by_unit_quantity, pct_revenue_by_unit_quantity, and pct_profit_by_unit_quantity. Each metric is a { value } object.

Rows are per week, not per unit quantity. The unit mix is computed per weekly bucket, so the array holds one row per (dt × unit_quantity), and the share metrics are shares within that week. The buckets cover both the requested window and the equally long comparison window immediately before it. Rows whose dt is before start belong to the comparison window. When start is not a Monday, the bucket containing it mixes both windows. To build a window-level breakdown, keep the rows inside your window and sum n_orders, net_revenue, and gross_profit per unit_quantity. Do not sum the pct_* values; recompute shares from the summed counts.

gross_profit and pct_profit_by_unit_quantity are not COGS-suppressed here. Every other analytics endpoint nulls profit metrics for a store with no COGS coverage, because the profit formula (net_revenue - total_cost) degenerates to net_revenue when total_cogs is 0. This endpoint does not: the unit-mix rows carry no pct_revenue_with_cogs cell, so there is no coverage signal to suppress on, and gross_profit comes back as a raw revenue-shaped figure. Check COGS status with POST /analytics/sitewide/snapshot (its cogs_configured / cogs_coverage_pct) before reporting either field from this endpoint, and ignore both when cogs_configured is false. n_orders, net_revenue, pct_orders_by_unit_quantity, pct_revenue_by_unit_quantity, and the two distribution curves are unaffected.

This is the endpoint to use for an order-value distribution. The histogram, kde, and cdf fields on POST /analytics/resource/{experienceId} are always returned empty and are not populated there.

Rate Limit: 10 requests per 30s window, refilling 5 tokens every 30s.

post/v25-10-beta/analytics/sitewide/order-distribution

Request

Request body

startstring date-time

Start of analysis period as an ISO 8601 datetime string (e.g. '2025-01-01T00:00:00.000-05:00'). Defaults to the start of the week containing the date 12 weeks ago, in the store's timezone (weeks start Monday), so the default start is week-aligned rather than exactly 84 days back. Note the default differs per sitewide endpoint, so pass an explicit start if you need a specific window.

endstring date-time

End of analysis period as an ISO 8601 datetime string. Defaults to now.

Response

OK

currencystring required

ISO 4217 currency code for monetary values (e.g. 'USD').

Example response

{
  "currency": "USD",
  "orderValueDistribution": {
    "kernel_density_estimate": [
      {
        "x": 25,
        "current_period": 0.0042,
        "previous_period": 0.0038
      },
      {
        "x": 50,
        "current_period": 0.0121,
        "previous_period": 0.0109
      },
      {
        "x": 100,
        "current_period": 0.0087,
        "previous_period": 0.0093
      }
    ],
    "cumulative_distribution_function": [
      {
        "x": 25,
        "current_period": 0.18,
        "previous_period": 0.16
      },
      {
        "x": 50,
        "current_period": 0.54,
        "previous_period": 0.5
      },
      {
        "x": 100,
        "current_period": 0.91,
        "previous_period": 0.89
      }
    ]
  },
  "orderBreakdown": [
    {
      "dt": "2025-01-06 00:00:00",
      "unit_quantity": 1,
      "n_orders": {
        "value": 8420
      },
      "net_revenue": {
        "value": 421000.5
      },
      "gross_profit": {
        "value": 168400.2
      },
      "pct_orders_by_unit_quantity": {
        "value": 0.68
      },
      "pct_revenue_by_unit_quantity": {
        "value": 0.55
      },
      "pct_profit_by_unit_quantity": {
        "value": 0.52
      }
    },
    {
      "dt": "2025-01-06 00:00:00",
      "unit_quantity": 2,
      "n_orders": {
        "value": 3960
      },
      "net_revenue": {
        "value": 344520.75
      },
      "gross_profit": {
        "value": 155534.3
      },
      "pct_orders_by_unit_quantity": {
        "value": 0.32
      },
      "pct_revenue_by_unit_quantity": {
        "value": 0.45
      },
      "pct_profit_by_unit_quantity": {
        "value": null
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.