Analytics & Reports
Analytics & Reports
Get powerful insights into your pharmacy’s performance — sales trends, customer behavior, popular products, and financial metrics.
Platform Analytics
Get a comprehensive overview of your pharmacy’s performance.
# Get analytics for date rangegetProviderAnalytics({ startDate: "2026-01-01", endDate: "2026-04-30", groupBy: "month" // day, week, month})Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
startDate | string | Yes | Start date (YYYY-MM-DD) |
endDate | string | Yes | End date (YYYY-MM-DD) |
groupBy | string | No | Grouping period (default: “day”) |
Response:
{ "period": { "start": "2026-01-01", "end": "2026-04-30" }, "summary": { "totalRevenue": 2450000, "totalOrders": 456, "totalCustomers": 123, "averageOrderValue": 5373, "newCustomers": 34 }, "trends": [ { "period": "2026-01", "revenue": 520000, "orders": 98, "customers": 45 }, { "period": "2026-02", "revenue": 580000, "orders": 105, "customers": 48 }, { "period": "2026-03", "revenue": 650000, "orders": 120, "customers": 52 }, { "period": "2026-04", "revenue": 700000, "orders": 133, "customers": 58 } ], "topProducts": [ { "name": "Paracetamol 500mg", "sales": 245, "revenue": 196000 }, { "name": "Amoxicillin 500mg", "sales": 189, "revenue": 472500 } ], "topCustomers": [ { "name": "John Doe", "orders": 15, "spent": 125000 }, { "name": "Jane Smith", "orders": 12, "spent": 98000 } ]}Order Analytics
Detailed analysis of order patterns and metrics.
# Get order analyticsgetProviderOrderAnalytics({ period: "month", year: 2026, month: 4})Response:
{ "period": "April 2026", "orders": { "total": 133, "completed": 128, "cancelled": 3, "pending": 2 }, "delivery": { "delivery": 89, "pickup": 44 }, "payment": { "card": 95, "cash": 25, "transfer": 13 }, "peakDays": ["Monday", "Friday"], "peakHours": ["9AM-11AM", "4PM-6PM"], "averageFulfillmentTime": "25 minutes"}Order Statistics
Quick stats dashboard data.
# Get current order statsgetProviderOrderStats()Response:
{ "today": { "orders": 12, "revenue": 85000, "pending": 3, "processing": 2 }, "thisWeek": { "orders": 78, "revenue": 520000 }, "thisMonth": { "orders": 312, "revenue": 2100000 }, "comparison": { "daily": { "current": 12, "previous": 10, "change": 20 }, "weekly": { "current": 78, "previous": 72, "change": 8.3 } }}Customer Analytics
Understand your customer base.
# Get customer insightsgetProviderCustomerAnalytics({ startDate: "2026-01-01", endDate: "2026-04-30"})Response:
{ "totalCustomers": 245, "newCustomers": 34, "returningCustomers": 211, "retentionRate": 86.1, "averageLifetimeValue": 150000, "segments": { "highValue": 25, // Spent > ₦100k "regular": 120, // Monthly orders "occasional": 85, // < Monthly "inactive": 15 // 90+ days since last order }, "acquisition": { "organic": 45, "referral": 32, "social": 28, "walkIn": 140 }}Product Analytics
Analyze product performance.
# Get product sales analyticsgetProviderProductAnalytics({ startDate: "2026-04-01", endDate: "2026-04-30", category: "antibiotics"})Response:
{ "totalProductsSold": 567, "revenue": 890000, "byCategory": [ { "category": "Antibiotics", "sales": 145, "revenue": 320000 }, { "category": "Analgesics", "sales": 234, "revenue": 187000 }, { "category": "Antimalarial", "sales": 89, "revenue": 156000 } ], "topSelling": [ { "product": "Paracetamol 500mg", "quantity": 234, "revenue": 187000 }, { "product": "Amoxicillin 500mg", "quantity": 145, "revenue": 362500 } ], "lowSelling": [ { "product": "Vitamin D3", "quantity": 5, "revenue": 15000 } ], "outOfStockImpact": { "lostSales": 45000, "customersAffected": 12 }}Export Reports
Export analytics data for further analysis.
# Export sales reportexportProviderReport({ type: "sales", format: "csv", // csv, excel, pdf startDate: "2026-04-01", endDate: "2026-04-30"})Report Types:
| Type | Description |
|---|---|
sales | Sales transactions |
orders | Order details |
inventory | Stock levels and movements |
customers | Customer activity |
financial | Revenue and expenses |
Example: Monthly Review
# Get monthly overviewgetProviderAnalytics({ startDate: "2026-04-01", endDate: "2026-04-30", groupBy: "week"})# → Shows weekly trends for the month
# Check order patternsgetProviderOrderAnalytics({ period: "month", month: 4 })# → Shows delivery vs pickup, peak times
# Review customer growthgetProviderCustomerAnalytics({ startDate: "2026-04-01", endDate: "2026-04-30"})# → Shows new vs returning customersDashboard Integration
Use these analytics to power your dashboard:
- Real-time Stats —
getProviderOrderStats()for live numbers - Trend Charts —
getProviderAnalytics()for historical data - Top Products — Product analytics for inventory decisions
- Customer Insights — Customer analytics for marketing