Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add orders, orders stats, revenue stats analytics reports to API doc #250

Conversation

ianlin
Copy link
Member

@ianlin ianlin commented Aug 22, 2024

Part of #248. This PR intends to merge into a feature branch feature/add-wc-analytics-reports-api-doc. But since the PR #248 hasn't been merged, the base branch of this PR is set to the add/248-analytics-reports-products-api-doc branch.

This PR adds orders, orders stats, and revenue stats APIs to the analytics doc:

  • Add orders reports section (/wc-analytics/reports/orders)
  • Add orders stats reports section (/wc-analytics/reports/orders/stats)
  • Add revenue stats reports section (/wc-analytics/reports/revenue/stats)

Detailed test instruction

  1. Build the doc by running ./build.sh
  2. Open build/index.html
  3. Click Analytics docs
  4. Verify the API docs under Revenue Stats, Orders, and Orders Stats.

@ianlin ianlin requested a review from a team August 22, 2024 13:53
@ianlin ianlin self-assigned this Aug 22, 2024
ianlin added 2 commits August 23, 2024 16:22
…ts-api-doc' into add/248-analytics-reports-revenue-and-orders-api-doc
@ianlin ianlin marked this pull request as ready for review August 23, 2024 09:32
Copy link

@martynmjones martynmjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ianlin, thanks for adding the wc-analytics documentation.

I've left a few comments, mostly related to formatting, but overall the changes look good to me.

Although not introduced in this branch, I also noticed that we're mixing type definitions in a few places. For example under Revenue Stats total_sales is listed as number whereas under Orders total_sales is listed as float.

| `num_items_sold` | integer | Items sold. <i class="label label-info">read-only</i> |
| `coupons` | integer | Amount discounted by coupons. <i class="label label-info">read-only</i> |
| `coupons_count` | integer | Unique coupons count. <i class="label label-info">read-only</i> |
| `total_customers` | integer | Total _customers. <i class="label label-info">read-only</i> |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an underscore in the description here _customers.

| Attribute | Type | Description |
|--------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `segment_id` | integer | Segment identificator. <i class="label label-info">read-only</i> |
| `subtotals` | object | Interval subtotals. See [Orders Stats Reports - Totals properties](#orders-stats-reports-totals-properties), but without `segments` atttribute. <i class="label label-info">read-only</i> |
Copy link

@martynmjones martynmjones Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here atttribute should be attribute

| `date_start_gmt` | string | The date the report start, as GMT. <i class="label label-info">read-only</i> |
| `date_end` | string | The date the report end, in the site's timezone. <i class="label label-info">read-only</i> |
| `date_end_gmt` | string | The date the report end, as GMT. <i class="label label-info">read-only</i> |
| `subtotals` | object | Interval subtotals. See [Orders Stats Reports - Totals properties](#orders-stats-reports-totals-properties), but without `products` atttribute. <i class="label label-info">read-only</i> |
Copy link

@martynmjones martynmjones Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here atttribute should be attribute


| Attribute | Type | Description |
|--------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `segment_id` | integer | Segment identificator. <i class="label label-info">read-only</i> |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read Segment identifier?

| `tax_rate_excludes` | array | Limit result set to items that don't have the specified tax rate(s) assigned. |
| `customer` | string | Alias for `customer_type` (deprecated). |
| `customer_type` | string | Limit result set to returning or new customers. |
| `refunds` | string | Limit result set to specific types of refunds. Options: ``, `all`, `partial`, `full`, `none`. |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an issue with how the options are being formatted here as inline code blocks:

Screenshot 2024-08-29 at 16 43 18


| Parameter | Type | Description |
|-----------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to be consistent in how options are listed in descriptions. For most of them we're wrapping the values in inline code blocks but for the different context parameters we're not.

ianlin and others added 3 commits September 2, 2024 15:45
…oducts-api-doc

Add products and product stats analytics reports to API doc
…analytics-reports-revenue-and-orders-api-doc
@ianlin
Copy link
Member Author

ianlin commented Sep 2, 2024

@martynmjones Thanks for reviewing and the nice suggestions, I've updated the PR and it's ready for another round.

@ianlin ianlin requested a review from martynmjones September 2, 2024 08:49
Copy link

@martynmjones martynmjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the changes @ianlin!

Left one comment re. one last typo but other than that the changes look good to me.

| `gross_sales` | number | Gross sales. <i class="label label-info">read-only</i> |
| `avg_items_per_order` | integer | Average items per order. <i class="label label-info">read-only</i> |
| `avg_order_value` | number | Average order value. <i class="label label-info">read-only</i> |
| `total_customers` | integer | Total _customers. <i class="label label-info">read-only</i> |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one remaining typo here with _customers in the description

@ianlin ianlin merged commit dd11d75 into add/248-analytics-reports-products-api-doc Sep 3, 2024
@ianlin ianlin deleted the add/248-analytics-reports-revenue-and-orders-api-doc branch September 3, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants