统计
统计端点提供有关应用和组织的详细分析。您可以跟踪不同时间段的月活跃用户(MAU)、存储使用情况和带宽消耗。这些数据对于监控应用增长、资源使用和规划容量至关重要。
- MAU(月活跃用户): 在过去 30 天内访问应用的唯一设备数量
- 存储: 存储的所有 bundle 和资源的总大小(以字节为单位)
- 带宽: bundle 下载的总数据传输量(以字节为单位)
- 定期监控: 定期检查统计信息以跟踪增长和使用模式
- 资源规划: 使用存储和带宽指标进行容量规划
- 用户参与度: 跟踪 MAU 以了解用户参与度趋势
- 成本管理: 监控资源使用情况以优化成本
Endpoints
Section titled “Endpoints”GET /statistics/app/:app_id/
Section titled “GET /statistics/app/:app_id/”Get statistics for a specific app. This endpoint is useful for monitoring individual app performance.
Query Parameters
Section titled “Query Parameters”interface StatsQuery { from: Date // Start date for the statistics (format: YYYY-MM-DD) to: Date // End date for the statistics (format: YYYY-MM-DD)}Example Request
Section titled “Example Request”curl -H "authorization: your-api-key" \ "https://api.capgo.app/statistics/app/com.demo.app/?from=2024-01-01&to=2024-02-01"Example Response
Section titled “Example Response”[ { "date": "2024-01-01", "mau": 1500, "storage": 536870912, // 512MB in bytes "bandwidth": 1073741824 // 1GB in bytes }, { "date": "2024-01-02", "mau": 1550, "storage": 537919488, // 513MB in bytes "bandwidth": 1074790400 // 1.01GB in bytes }]GET /statistics/org/:org_id/
Section titled “GET /statistics/org/:org_id/”Get statistics for a specific organization. Useful for monitoring organization-level usage.
Query Parameters
Section titled “Query Parameters”interface StatsQuery { from: Date // Start date for the statistics (format: YYYY-MM-DD) to: Date // End date for the statistics (format: YYYY-MM-DD) breakdown: boolean // default false, optional if true it return the breakdown by app noAccumulate: boolean // default false, optional if true it will not accumulate data and just return day by day result}Example Request
Section titled “Example Request”curl -H "authorization: your-api-key" \ "https://api.capgo.app/statistics/org/046a36ac-e03c-4590-9257-bd6c9dba9ee8/?from=2024-01-01&to=2024-02-01"Example Response
Section titled “Example Response”[ { "date": "2024-01-01", "mau": 10000, "storage": 536870912, // 512MB in bytes "bandwidth": 1073741824 // 1GB in bytes }, { "date": "2024-01-02", "mau": 10200, "storage": 537919488, // 513MB in bytes "bandwidth": 1074790400 // 1.01GB in bytes }]GET /statistics/user/
Section titled “GET /statistics/user/”Get aggregated statistics across all organizations you have access to. Perfect for overall usage monitoring.
Query Parameters
Section titled “Query Parameters”interface StatsQuery { from: Date // Start date for the statistics (format: YYYY-MM-DD) to: Date // End date for the statistics (format: YYYY-MM-DD)}Example Request
Section titled “Example Request”curl -H "authorization: your-api-key" \ "https://api.capgo.app/statistics/user/?from=2024-01-01&to=2024-02-01"Example Response
Section titled “Example Response”[ { "date": "2024-01-01", "mau": 25000, "storage": 1073741824, // 1GB in bytes "bandwidth": 2147483648 // 2GB in bytes }, { "date": "2024-01-02", "mau": 25500, "storage": 1074790400, // 1.01GB in bytes "bandwidth": 2148532224 // 2.01GB in bytes }]GET /statistics/app/:app_id/bundle_usage
Section titled “GET /statistics/app/:app_id/bundle_usage”Get bundle usage statistics for a specific app, showing the distribution of versions among users over a specified period.
Query Parameters
Section titled “Query Parameters”interface BundleUsageQuery { from: Date // Start date for the statistics (format: YYYY-MM-DD) to: Date // End date for the statistics (format: YYYY-MM-DD)}Example Request
Section titled “Example Request”curl -H "authorization: your-api-key" \ "https://api.capgo.app/statistics/app/com.demo.app/bundle_usage?from=2024-01-01&to=2024-02-01"Example Response
Section titled “Example Response”{ "labels": ["2024-01-01", "2024-01-02", "2024-01-03"], "datasets": [ { "label": "1.0.0", "data": [60.5, 58.2, 55.3] }, { "label": "1.0.1", "data": [39.5, 41.8, 44.7] } ]}Error Handling
Section titled “Error Handling”Common error scenarios and their responses:
// Invalid body{ "status": "Invalid body", "error": "Invalid date format or missing parameters"}
// Permission denied{ "status": "You can't access this app", "error": "Insufficient permissions to access statistics"}
// Permission denied for organization{ "status": "You can't access this organization", "error": "Insufficient permissions to access organization statistics"}
// No organizations found for user statistics{ "status": "No organizations found", "error": "No organizations found"}
// Internal server error{ "status": "Cannot get app statistics", "error": "Internal server error message"}Common Use Cases
Section titled “Common Use Cases”- Growth Tracking: Monitor MAU growth over time
- Resource Optimization: Track storage and bandwidth usage to optimize costs
- Capacity Planning: Use trends to plan for future resource needs
- Usage Reports: Generate periodic usage reports for stakeholders
- Version Distribution Analysis: Understand how users are distributed across different app versions with bundle usage statistics
Tips for Analysis
Section titled “Tips for Analysis”- Compare Periods: Look at month-over-month or year-over-year trends
- Track Ratios: Monitor bandwidth per user or storage per app
- Set Alerts: Create alerts for unusual spikes in usage
- Regular Backups: Export statistics regularly for historical analysis
- Version Adoption: Use bundle usage to track adoption rates of new versions