/shops/{SHOP_ID}/analytics/saleThống kê đơn hàngGET/shops/{SHOP_ID}/analytics/get_list_formulaDanh sách công thức tùy chỉnhGET/shops/{SHOP_ID}/analytics/get_analytic_fieldsDanh sách số liệu mặc địnhGET/shops/{SHOP_ID}/statistic_custom/foldersDanh sách thư mục báo cáo tùy chỉnhThống kê đơn hàng
/shops/{SHOP_ID}/analytics/saleLấy thống kê đơn hàng
Tham số đường dẫn
SHOP_IDintegerbắt buộcMã shop
Tham số truy vấn
sincestring · date-timeThời gian bắt đầu thống kê
untilstring · date-timeThời gian kết thúc thống kê
split_by[]array<string>Thống kê theo một hoặc nhiều chiều, mỗi giá trị là khoá <Table>.<field>.
Time.hour/Time.day/Time.month/Time.year— theo giờ / ngày / tháng / nămOrder.source/Order.order_sources— theo nguồn đơn / tài khoảnOrder.status— theo trạng thái đơnOrder.warehouse_id— theo khoOrder.post_id— theo bài viết FacebookOrder.partner_id— theo đối tác vận chuyểnOrder.marketplace_id— theo sàn TMĐTOrder.country_code/Order.province_id/Order.district_id/Order.commune_id/Order.region_filter— theo địa lý giao hàngOrder.tag— theo tag đơn hàngOrder.is_wholesale/Order.is_livestream— đơn buôn / đơn livestreamOrder.livestream_manager_ids— theo người quản lý livestreamOrder.total_price— theo khoảng tổng tiền đơnOrder.ads_or_normal/Order.ad_account_id/Order.ad_id— phân nhóm quảng cáoUser.id/User.sale_group/User.department_id— theo nhân viên / nhóm bán / phòng banCustomer.id/Customer.level_id/Customer.new— theo khách hàng / hạng / khách mớiVariation.id/Variation.product_id— theo mẫu mã / sản phẩmVariation.category/Variation.supplier/Variation.brand_id/Variation.tag— theo danh mục / NCC / thương hiệu / tag SPVariation.price_range/Variation.quantity_range— theo khoảng giá / khoảng SLVariation.upsale/Variation.quantity— cờ upsell / SL bánUTM.p_utm_source/UTM.p_utm_campaign/UTM.p_utm_medium/UTM.p_utm_term/UTM.p_utm_content— theo UTMPromotion.default/Promotion.advance/Promotion.combo— theo khuyến mại / comboAds.ad_id/Ads.ad_set_id/Ads.ad_campaign_id— theo ad / ad set / chiến dịch
"Time.hour""Time.day""Time.month""Time.year""Order.source""Order.order_sources""Order.status""Order.warehouse_id""Order.post_id""Order.partner_id""Order.marketplace_id""Order.country_code""Order.province_id""Order.district_id""Order.commune_id""Order.region_filter""Order.tag""Order.is_wholesale""Order.is_livestream""Order.livestream_manager_ids""Order.total_price""Order.ads_or_normal""Order.ad_account_id""Order.ad_id""User.id""User.sale_group""User.department_id""Customer.id""Customer.level_id""Customer.new""Variation.id""Variation.product_id""Variation.category""Variation.supplier""Variation.brand_id""Variation.tag""Variation.price_range""Variation.quantity_range""Variation.upsale""Variation.quantity""UTM.p_utm_source""UTM.p_utm_campaign""UTM.p_utm_medium""UTM.p_utm_term""UTM.p_utm_content""Promotion.default""Promotion.advance""Promotion.combo""Ads.ad_id""Ads.ad_set_id""Ads.ad_campaign_id"filterobjectBộ lọc áp dụng cho tập đơn hàng. Object có khoá dạng <Table>.<field>, giá trị là mảng chuỗi.
Thêm hậu tố _exclude để loại trừ (ví dụ Order.status_exclude, Variation.category_exclude).
Thêm hậu tố _and để AND-kết hợp các filter dạng danh sách (ví dụ Variation.tags_and).
Các khoá thường dùng:
Variation.id/Variation.product_id— theo mẫu mã / sản phẩmVariation.category/Variation.supplier/Variation.brand_id/Variation.brand— theo danh mục / NCC / thương hiệuVariation.tag/Variation.tags/Variation.attribute— theo tag / thuộc tính SPVariation.price_range/Variation.quantity_range/Variation.quantity— theo khoảng giá / khoảng SLVariation.upsale/Variation.one_time_product/Variation.is_bonus_product/Variation.product_price_of_zero/Variation.unlink_ecommerce— các cờ SPOrder.source/Order.source_exclude/Order.order_sources— nguồn đơnOrder.status— mã trạng thái đơnOrder.warehouse_id/Order.post_id/Order.partner_id/Order.shop_partner_id/Order.marketplace_id— vận hànhOrder.country_code/Order.province_id/Order.district_id/Order.commune_id/Order.region_filter/Order.region_filter_phil— địa lý giao hàngOrder.tag/Order.is_wholesale/Order.is_livestream/Order.received_at_shop/Order.is_upsale_order— cờ đơnOrder.total_price/Order.revenue— theo khoảng tổng tiền / doanh thuOrder.ad_id/Order.ads_source/Order.ad_account_id/Order.ads_or_normal— quảng cáoOrder.order_currency— tiền tệ đơnOrder.id/Order.project— theo mã đơn / dự ánOrder.p_utm_source/Order.p_utm_campaign/Order.p_utm_medium/Order.p_utm_term/Order.p_utm_content/Order.utm_affiliate/Order.link— UTMOrder.instant/Order.N24H/Order.GSGN— dịch vụ vận chuyểnOrder.livestream_manager_id/Order.livestream_manager_ids— người quản lý livestreamUser.id/User.sale_group/User.department_id/User.pke_mkter/User.assigning_seller_id/User.assigning_care_id/User.item_assign_seller_id— nhân viênCustomer.id/Customer.level_id/Customer.gender/Customer.tag/Customer.conversation_tags/Customer.new/Customer.referral_code— khách hàngPromotion.default/Promotion.advance/Promotion.id/Promotion.combo— khuyến mại / combo
success_statusstring'send_to_partner': Tính đơn chốt khi đẩy sang ĐVVC
'1': Tính đơn chốt khi cập nhật sang trạng thái đã xác nhận
success_recordstring'inserted_at': Doanh thu cộng vào thời điểm tạo đơn
'updated_at': Doanh thu cộng vào thời điểm cập nhật trạng thái
user_typestringTính đơn cho nhân viên ('create': Tạo đơn, 'update': Cập nhật trạng thái, 'assign': NV được phân công, 'care': NV chăm sóc, 'marketer': NV Marketing)
returned_recordstringDoanh thu sẽ trừ vào thời điểm ('inserted_at': Tạo đơn, 'updated_at': Cập nhật trạng thái, 'success_record': Chốt đơn)
select_fields[]array<string>Các số liệu cần lấy
Phản hồi
dataarray<object>Dữ liệu thống kê
successbooleanTrạng thái thành công
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/analytics/sale?api_key=API_KEY"{
"success": true,
"data": [
{
"Time.day": "2020-07-22",
"returned": null,
"success": {
"cod": 1710000,
"discount": 0,
"order_count": 3,
"price": 1800000,
"product_count": 18,
"shipping_fee": 0,
"custom_formula_d6ae-ad02-be3d-b26e-3f65-d497-33c4": 1000000
}
},
{
"Time.day": "2020-07-27",
"returned": null,
"success": {
"cod": 570000,
"discount": 0,
"order_count": 1,
"price": 600000,
"avg_price": 600000,
"product_count": 6,
"shipping_fee": 0,
"custom_formula_d6ae-ad02-be3d-b26e-3f65-d497-33c4": 1000000
}
},
{
"Time.day": "2020-07-28",
"returned": null,
"success": {
"cod": 5130000,
"discount": 0,
"order_count": 9,
"price": 5400000,
"avg_price": 600000,
"product_count": 54,
"shipping_fee": 0,
"custom_formula_d6ae-ad02-be3d-b26e-3f65-d497-33c4": 1200000
}
},
{
"Time.day": "2020-07-30",
"returned": null,
"success": {
"cod": 570000,
"discount": 0,
"order_count": 1,
"price": 600000,
"avg_price": 600000,
"product_count": 6,
"shipping_fee": 0,
"custom_formula_d6ae-ad02-be3d-b26e-3f65-d497-33c4": 1200000
}
}
]
}Danh sách công thức tùy chỉnh
/shops/{SHOP_ID}/analytics/get_list_formulaLấy danh sách công thức tùy chỉnh
Tham số đường dẫn
SHOP_IDintegerbắt buộcMã shop
Phản hồi
dataarray<object>Danh sách công thức tùy chỉnh
successbooleanTrạng thái thành công
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/analytics/get_list_formula?api_key=API_KEY"{
"success": true,
"data": [
{
"formula": "{price} - {shipping_fee}",
"id": "0ea7-bc72-ae51-0769-a7c9-ca34-fff6",
"name": "tien hang - phi ship",
"unit": "currency"
},
{
"formula": "{revenue} + {transfer_money}",
"id": "3db3-72a7-c426-066a-4eed-a63b-be49",
"name": "doanh thu + ck$",
"unit": "currency"
}
]
}Danh sách số liệu mặc định
/shops/{SHOP_ID}/analytics/get_analytic_fieldsLấy danh sách số liệu mặc định
Tham số đường dẫn
SHOP_IDintegerbắt buộcMã shop
Phản hồi
dataarray<object>Danh sách số liệu mặc định
successbooleanTrạng thái thành công
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/analytics/get_analytic_fields?api_key=API_KEY"{
"success": true,
"data": [
{
"id": "price",
"name": "Tiền hàng"
},
{
"id": "avg_price",
"name": "Giá bán trung bình"
},
{
"id": "shipping_fee",
"name": "Phí VC thu của khách",
"description": "Tiền vận chuyển thu của khách."
},
{
"id": "discount",
"name": "Chiết khấu",
"description": "Tổng số tiền giảm giá trên từng sản phẩm."
},
{
"id": "product_count",
"name": "SL bán thực",
"description": "Hàng bán ra đã trừ SL hoàn/đổi trả"
},
{
"id": "close_rate",
"name": "Tỷ lệ chốt",
"description": "Số đơn chốt / (Tổng số đơn - SL đơn xoá)."
},
{
"id": "commissions",
"name": "Hoa hồng",
"description": "Hoa hồng cho nhân viên, có thể cài đặt trong phần cấu hình."
}
]
}Danh sách thư mục báo cáo tùy chỉnh
/shops/{SHOP_ID}/statistic_custom/foldersLấy danh sách thư mục báo cáo tùy chỉnh và các báo cáo bên trong (folder_items). Mỗi thư mục gom nhóm các báo cáo tùy chỉnh được cấu hình cho cửa hàng (ví dụ doanh thu, đơn hàng, sản phẩm, tài chính, công nợ).
Tham số đường dẫn
SHOP_IDintegerbắt buộcMã shop
Phản hồi
successbooleanTrạng thái thành công
foldersarray<object>Danh sách thư mục báo cáo tùy chỉnh
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/statistic_custom/folders?api_key=API_KEY"{
"success": true,
"folders": [
{
"name": "OtherReports",
"label": "Báo cáo khác",
"order": -1,
"shop_id": 4,
"creator_id": null,
"last_editor_id": null,
"can_remove": false,
"is_removed": null,
"setting": null,
"total_price_ranges": null,
"inserted_at": "2024-02-26T08:21:01",
"updated_at": "2024-02-26T08:21:01",
"folder_items": [
{
"id": "9d80f8b9-1c68-4026-81e6-70ed2381d360",
"name": "pages.shop.statistic.salesStatistics",
"label": "Doanh số",
"description": null,
"folder_name": "employee",
"parent_id": null,
"order": 0,
"shop_id": 4,
"creator_id": null,
"last_editor_id": null,
"can_remove": false,
"is_removed": null,
"attributes": null,
"fields": [
"total_order_count",
"order_count",
"price",
"shipping_fee",
"discount",
"capital",
"product_count"
],
"filter": null,
"children": [],
"charts": null,
"compare_ranges": {
"chart": "bar-chart",
"field": "product_count",
"ranges": [
{
"range": "7"
},
{
"range": "-7"
}
]
},
"fill_color": false,
"setting": {
"returned_record": "success_record",
"success_record": "inserted_at",
"success_status": 0,
"user_type": "assign"
},
"sort_by_field": null,
"time_range": [
"90"
],
"users_can_see": null,
"inserted_at": "2024-02-26T08:21:01",
"updated_at": "2024-02-26T08:21:01"
}
]
},
{
"name": "Revenue",
"label": "Báo cáo doanh thu",
"order": 1,
"shop_id": 4,
"creator_id": null,
"last_editor_id": null,
"can_remove": false,
"is_removed": null,
"setting": null,
"total_price_ranges": null,
"inserted_at": "2023-09-20T03:01:25",
"updated_at": "2023-09-20T03:01:25",
"folder_items": [
{
"id": "9783d2e9-d973-4f6f-a735-f5883f4e678f",
"name": "commons.time",
"label": "Thời gian",
"description": null,
"folder_name": "Revenue",
"parent_id": null,
"order": 0,
"shop_id": 4,
"creator_id": null,
"last_editor_id": null,
"can_remove": false,
"is_removed": null,
"attributes": [
"Variation.product_id"
],
"fields": [
"success_order_count",
"returned_order_count",
"price",
"sales",
"revenue",
"capital",
"profit"
],
"filter": [],
"children": [],
"charts": [
{
"field": "success_order_count",
"top": "all",
"type": "bar-chart",
"width": 100
}
],
"compare_ranges": {
"chart": "bar-chart",
"field": "profit",
"ranges": [
{
"range": "7"
},
{
"range": "-7"
}
]
},
"fill_color": false,
"setting": {
"returned_record": "success_record",
"success_record": "updated_at",
"success_status": 1,
"user_type": "update"
},
"sort_by_field": {
"multi": [
{
"columnKey": "product_count",
"field": "product_count",
"order": "descend"
}
]
},
"time_range": [
"30"
],
"users_can_see": null,
"inserted_at": "2023-09-20T03:01:25",
"updated_at": "2026-05-05T04:33:58"
}
]
}
]
}