Analytics

Markdown

View as Markdown

A store's sales, sales breakdowns and fulfillment for a period. Sales leave out cancelled, unpaid and test orders. Traffic sources, referrers, product views and carts aren't recorded. Needs a plan with analytics.

All paths are relative to the base URL https://api.store.link/v1. Every request needs your API key; see Overview.

Endpoints

EndpointWhat it does
GET /stores/{storeId}/analytics/salesGet a sales summary
GET /stores/{storeId}/analytics/sales/breakdownBreak down sales
GET /stores/{storeId}/analytics/fulfillmentGet a fulfillment summary

Periods

Every analytics endpoint takes the same period parameters:

NameTypeDescription
periodstringcustom takes start_date and end_date. One of: today, last7days, lastweek, thismonth, last30days, lastmonth, last90days, custom. Default: last90days.
start_datestring (date)With period custom. Format: YYYY-MM-DD.
end_datestring (date)With period custom. Format: YYYY-MM-DD.
timezonestringThe IANA timezone the period is in, e.g. America/New_York. Default: UTC.

Responses echo period and timezone, and give the period's start_date and end_date (YYYY-MM-DD) in that timezone.

Get a sales summary

GET /stores/{storeId}/analytics/sales

Orders, sales, average order value, visitors, conversion rate and searches for a period, the 10 products sold most, and orders, sales and visitors over time. With compare, the same for the period before or the same period a year earlier.

Your role in the store needs to read analytics.

Path parameters

NameTypeDescription
storeIdstring
required
A store id from GET /stores.

Query parameters

NameTypeDescription
period, start_date, end_date, timezoneSee Periods above.
comparestringAlso return the period to compare with. One of: previous_period, previous_year.

Example request

curl 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/analytics/sales?period=thismonth&timezone=America/New_York&compare=previous_period' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Response

FieldTypeDescription
periodstringThe period asked for.
timezonestringThe IANA timezone the period and its dates are in.
currencystring, nullableISO 4217 code.
currentobject
current.start_datestring (date)
current.end_datestring (date)
current.ordersinteger
current.salesnumber
current.average_order_valuenumber
current.visitorsinteger
current.conversion_ratenumber, nullableOrders per 100 visitors; null without visitors.
current.searchesobject
current.searches.totalinteger
current.searches.top_termsarray of objectAt most 10, most searched first.
current.searches.top_terms[].termstring
current.searches.top_terms[].searchesinteger
current.searches.top_terms[].without_resultsinteger
current.searches.terms_without_resultsarray of objectAt most 10, most searched first.
current.searches.terms_without_results[].termstring
current.searches.terms_without_results[].searchesinteger
current.top_productsarray of objectAt most 10, by units sold. GET /analytics/sales/breakdown?by=product has more.
current.top_products[].namestring
current.top_products[].quantitynumber
current.over_timeobject
current.over_time.intervalstringhour for periods of 2 days or less, month for periods over 3 months, else day. One of: hour, day, month.
current.over_time.rowsarray of objectOldest first, leaving out intervals with no orders or visits.
current.over_time.rows[].startstringThe start of the interval in the timezone: 2026-10-12T14:00, 2026-10-12 or 2026-10.
current.over_time.rows[].ordersinteger
current.over_time.rows[].salesnumber
current.over_time.rows[].visitorsinteger, nullablenull on hourly rows, as visits are counted per day.
previousobject, nullableThe period compared with, when compare is set, with the same fields as current.

Example response

{
  "period": "thismonth",
  "timezone": "America/New_York",
  "currency": "USD",
  "current": {
    "start_date": "2026-11-01",
    "end_date": "2026-11-23",
    "orders": 48,
    "sales": 1250,
    "average_order_value": 26.04,
    "visitors": 1600,
    "conversion_rate": 3,
    "searches": {
      "total": 120,
      "top_terms": [
        { "term": "tee", "searches": 34, "without_results": 0 }
      ],
      "terms_without_results": [
        { "term": "hoodie", "searches": 9 }
      ]
    },
    "top_products": [
      { "name": "Classic Tee", "quantity": 31 }
    ],
    "over_time": {
      "interval": "day",
      "rows": [
        { "start": "2026-11-01", "orders": 3, "sales": 75, "visitors": 82 }
      ]
    }
  },
  "previous": {
    "start_date": "2026-10-09",
    "end_date": "2026-10-31",
    "orders": 41,
    "sales": 1080,
    "average_order_value": 26.34,
    "visitors": 1450,
    "conversion_rate": 2.83,
    "searches": { "total": 98, "top_terms": [], "terms_without_results": [] },
    "top_products": [],
    "over_time": { "interval": "day", "rows": [] }
  }
}

Errors

  • 403 plan_upgrade_required: The store's plan doesn't include this. The message names the plan it needs.

Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.

Break down sales

GET /stores/{storeId}/analytics/sales/breakdown

A period's sales grouped by one dimension: orders, units, sales and share of the period's sales per row, best first.

  • product: units and item sales per product
  • variant: per product variant, e.g. a size or colour
  • category: per product category; a product in two categories counts in both, so shares can add up past 100%
  • product_pair: products bought together, among the 50 products in the most orders, ranked by the orders that had both; units and sales are those two products' lines, so shares can add up past 100%
  • coupon: per coupon code, with the discount given
  • payment_method: per payment method
  • shipping_method: per shipping or pickup method
  • customer_type: customers whose first order fell in the period (new) vs those who ordered before (returning), and orders without a customer account; customers counts accounts
  • customer: top customers by what they spent; needs permission to read orders
  • weekday: per day of the week, Monday to Sunday
  • hour: per hour of the day, 00:00 to 23:00

weekday and hour return every row in calendar order, in the timezone, and ignore limit and sort_by.

Your role in the store needs to read analytics.

Path parameters

NameTypeDescription
storeIdstring
required
A store id from GET /stores.

Query parameters

NameTypeDescription
bystring
required
One of: product, variant, category, product_pair, coupon, payment_method, shipping_method, customer_type, customer, weekday, hour.
period, start_date, end_date, timezoneSee Periods above.
sort_bystringDefault sales, and orders for product_pair. One of: sales, units, orders.
limitintegerRows to return. Default: 10. 1 to 50.

Example request

curl 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/analytics/sales/breakdown?by=product&period=last30days' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Response

FieldTypeDescription
bystringThe dimension asked for.
periodstringThe period asked for.
timezonestringThe IANA timezone the period and its dates are in.
start_datestring (date)
end_datestring (date)
currencystring, nullableISO 4217 code.
basisstringitem: sales are item sales, before shipping and after item discounts. order: sales are order totals. One of: item, order.
sorted_bystringOne of: sales, units, orders, calendar.
totalsobject
totals.ordersinteger
totals.unitsnumber
totals.salesnumber
total_groupsintegerRows there are, before limit.
rowsarray of object
rows[].keystring or number or array of string, nullableproduct: a product slug, or its name when the order has none. variant: a cart item id. category, coupon, payment_method and shipping_method: the name or code, null for none. product_pair: two product keys. customer_type: new, returning or no_account. customer: a customer id, null for orders without one. weekday: 1 (Monday) to 7. hour: 0 to 23.
rows[].labelstring, nullable
rows[].ordersinteger
rows[].unitsnumber
rows[].salesnumber
rows[].sharenumberPercent of the period's sales. category and product_pair shares can add up past 100.
rows[].average_order_valuenumber, nullableOn the order basis; null on the item basis.
rows[].discountnumber, nullableby coupon: the discount given. null otherwise.
rows[].customersinteger, nullableby customer_type: customer accounts. null otherwise.

Example response

{
  "by": "product",
  "period": "last30days",
  "timezone": "UTC",
  "start_date": "2026-10-25",
  "end_date": "2026-11-23",
  "currency": "USD",
  "basis": "item",
  "sorted_by": "sales",
  "totals": {
    "orders": 48,
    "units": 96,
    "sales": 1250
  },
  "total_groups": 8,
  "rows": [
    {
      "key": "classic-tee",
      "label": "Classic Tee",
      "orders": 22,
      "units": 31,
      "sales": 620,
      "share": 49.6,
      "average_order_value": null,
      "discount": null,
      "customers": null
    }
  ]
}

Errors

  • 403 plan_upgrade_required: The store's plan doesn't include this. The message names the plan it needs.

Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.

Get a fulfillment summary

GET /stores/{storeId}/analytics/fulfillment

For orders placed in a period: how many were cancelled, the cancellation rate, and the median and average hours from an order being placed to its first shipped or completed status. Unpaid and test orders are not placed orders, and ship times leave out cancelled orders.

Your role in the store needs to read analytics.

Path parameters

NameTypeDescription
storeIdstring
required
A store id from GET /stores.

Query parameters

NameTypeDescription
period, start_date, end_date, timezoneSee Periods above.

Example request

curl 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/analytics/fulfillment?period=custom&start_date=2026-11-01&end_date=2026-11-23' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Response

FieldTypeDescription
periodstringThe period asked for.
timezonestringThe IANA timezone the period and its dates are in.
start_datestring (date)
end_datestring (date)
placed_ordersinteger
cancelled_ordersinteger
cancellation_ratenumber, nullablePercent of placed orders; null without any.
shipped_ordersintegerOrders that reached shipped or completed, leaving out cancelled ones.
median_hours_to_shipnumber, nullable
average_hours_to_shipnumber, nullable

Example response

{
  "period": "custom",
  "timezone": "UTC",
  "start_date": "2026-11-01",
  "end_date": "2026-11-23",
  "placed_orders": 50,
  "cancelled_orders": 1,
  "cancellation_rate": 2,
  "shipped_orders": 45,
  "median_hours_to_ship": 18,
  "average_hours_to_ship": 22.5
}

Errors

  • 403 plan_upgrade_required: The store's plan doesn't include this. The message names the plan it needs.

Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.

Related Articles

Was this article helpful?