Commerce Metrics

The AggregateMetric Object

Rutter performs various computations over your commerce data. The results of these computations are called aggregate metrics.

You can find the metrics we support, their corresponding metric name, and the formula used to compute them here.

Metrics are bucketed by month by default, covering the last 13 monthly reports.

Pass granularity=day for daily buckets, which default to the last 30 days. Use start_date / end_date to pick a different window. Buckets are aligned to UTC, so a daily bucket runs from 00:00:00Z to 23:59:59.999Z regardless of where the store trades.

A single request may span at most 90 daily buckets or 13 monthly buckets; a wider window is rejected with a 400.

Properties

start_datestring

The starting date from which we start aggregating activity (revenue, expenses, etc).

end_datestring

The date at which we stop aggregating activity (revenue, expenses, etc).

currencystring

If applicable, the currency used for the value returned.

valuestring

The value of the requested metric for the time range described by the start and end date.

Endpoints
GET
/commerce/metrics/:metricName

Fetch a Metric

GEThttps://production.rutterapi.com/versioned/commerce/metrics/:metricName

The object returned will use a key matching the value of the parameter "Metric Name". It will also have a connection and checkpoint key. All other keys will be undefined.

For example, if you send a request to '/metrics/commerce/total_revenue', you will receive an object with values for the keys "total_revenue", "connection", and "checkpoint", nothing else.

Request Parameters

    metricNameenumpathRequired

    The path of the commerce metric.

    One oftotal_revenue, total_orders, active_customers, or refund_rate.
    access_tokenstringqueryRequired

    The access token of the connection.

    start_datestringqueryOptional

    ISO 8601 date or datetime the first bucket starts at, floored to the start of its bucket. Defaults to the last 30 days for day granularity, or the last 13 months for month.

    end_datestringqueryOptional

    ISO 8601 date or datetime the last bucket ends at. A date without a time covers the whole day. Defaults to now. A window may span at most 90 day buckets or 13 month buckets.

    granularityenumqueryOptional

    The size of each bucket in the response. Defaults to month. Buckets are aligned to UTC, so a day bucket runs from 00:00:00Z to 23:59:59.999Z.

    One ofday or month.
    force_fetchenumqueryOptional

    Used to force a response even if the underlying connection has not finished its initial sync.

    One oftrue or false.

Response Body

Commerce Metrics Formula

Rutter supports the ability to fetch commerce metrics from a commerce connection. This can be used to compute metrics such as Total Revenue without additional engineering work.

The metrics supported are listed below, along with the formula used to compute them:

Commerce MetricMetric Name (Used as Param)Formula
Total Revenuetotal_revenueSum of all order totals in the bucket
Total Orderstotal_ordersCount of all orders in the bucket
Active Customersactive_customersCount of all distinct customers who placed an order in the bucket (Note: Does not include customers who don't sign in)
Refund Raterefund_rateSum of all refunded orders in the bucket / Sum of all orders in the bucket

Have questions?

Contact support for personalized guidance.

Contact support
Previous
Store