total_sales
and gross_sales
are different. Return gross_sales
in the API response.Monetary Values and Counts are now returned as numbers
We now have derived net and gross sales in the API responses in addition to the existing data points.
Let me know if you need anything else here @psealock
Confirmed API response is correct. Thanks @westi, closing issue...
@westi This is a simple calculation, but could we return Average Order Value in the response as well?
d.average_order_value = d.orders === 0 ? 0 : d.gross_sales / d.orders;
Or is it d.net_sales / d.orders;
?
While you are here, other things we will need
For items per order I assume you want the average number of items?
average_daily_gross_revenue - is this for the whole period?
For items per order I assume you want the average number of items?
Yes
average_daily_gross_revenue - is this for the whole period?
@greenafrican Seems right to me, can you confirm?
Actually, are the other two for the whole period or for the individual date aggregations (day/week/month) ??
average_order_value
and items_per_order
are for individual date aggregations.
API responses now contain avg_order_value
rounded to 4dp.
API responses also now contain avg_products_per_order
rounded to 4dp
Do we need to return an additional period before the series' first period so that we can calculate the deltas? For example:
{
"date": "2017-05-03",
"unit": "day",
"quantity": "7",
"fields": ["period", "orders", "products", "coupons", "coupon_discount", "total_sales", "total_tax", "total_shipping", "total_shipping_tax", "total_refund", "total_tax_refund", "total_shipping_refund", "total_shipping_tax_refund", "currency", "gross_sales", "net_sales", "avg_order_value", "avg_products_per_order"],
"data": [
["2017-04-27", ...],
["2017-04-28", ...],
["2017-04-29", ...],
["2017-04-30", ...],
["2017-05-01", ...],
["2017-05-02", ...],
["2017-05-03", ...]
]
We'd need a 'phantom' 26th April entry, which shouldn't be included in the series or totals, but is needed to calculate the deltas for the 27th April.
cc @westi @psealock
@greenafrican rather than returning another period would it not be better for the deltas to be calculated server side and included as fields?
calculated server side
@westi - I like that!
Have you got a clear list of the deltas you want, or shall I just add deltas for all the per-period values?
We'd need a 'phantom' 26th April entry, which shouldn't be included in the series or totals, but is needed to calculate the deltas for the 27th April.
I would rather display a "0%" and the gray box @greenafrican designed. Showing a +/- introduces the question "compared to what?". Will it be clear to the user if the period being compared is not rendered. The sparklines would further confuse when the dot is all the way to the left.
Have you got a clear list of the deltas you want, or shall I just add deltas for all the per-period values?
I will continue this discussion on @westi's p2 post/comment (internal reference: p8vlZR-cU-p2##comment-469).
compared to what?
In our latest design iteration, it will always be clear what it is being compared to. Even when the highlight is on the left.
I think we leave this as all front end code for now as I mentioned on the p2.
Also, I think that we don't need to show deltas for the first day in the sparkline as @psealock hints.
I wouldn't show a 0% change because that implies something that will likely not be true.
Also, I think that we don't need to show deltas for the first day in the sparkline
This has been addressed. I'm marking this one as closed