统计分析
复制一个包含安装步骤和此插件的完整Markdown指南的设置提示.
统计 API 提供了关于您的应用和组织的详细分析。您可以跟踪每月活跃用户 (MAU)、存储使用情况和带宽消耗情况,跨不同时间段。这些数据对于监控应用增长、资源使用情况和规划容量至关重要。
理解指标
标题:理解指标- 每月活跃用户 (MAU): 最近 30 天内访问您的应用的唯一设备数量
- 存储: 所有捆绑包和资源的总大小(以字节为单位)
- 带宽: 捆绑包下载的总数据传输量(以字节为单位)
- 常规监控: 定期检查统计数据以跟踪增长和使用模式
- 资源规划: 使用存储和带宽指标进行容量规划
- 用户参与度: 跟踪活跃用户数以了解用户参与度趋势
- 成本管理: 监控资源使用以优化成本
GET /statistics/app/:app_id/
Section titled “GET /statistics/app/:app_id/”获取某个应用的统计数据。这个端点对于监控单个应用的性能非常有用。
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/
GET /statistics/org/:org_id/获取特定组织的统计数据。有助于监控组织级别的使用情况。
Query Parameters
Query Parametersinterface 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}示例请求
终端窗口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"Section titled “GET /statistics/org/:org_id/”
Section titled “Query Parameters”[ { "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/
GET /statistics/user/ 的部分获取您有权访问的所有组织的聚合统计数据。适合用于监控整体使用情况。
查询参数
查询参数 的部分interface StatsQuery { from: Date // Start date for the statistics (format: YYYY-MM-DD) to: Date // End date for the statistics (format: YYYY-MM-DD)}示例请求
示例请求 的部分curl -H "authorization: your-api-key" \ "https://api.capgo.app/statistics/user/?from=2024-01-01&to=2024-02-01"[ { "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”获取特定应用的包使用统计信息,显示用户在指定时间段内对包(版本)的分布。
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)}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"示例响应
标题:示例响应{ "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] } ]}错误处理
标题:错误处理常见错误场景和响应:
// 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"}常见用例
标题:常见用例- 增长跟踪: 监控 MAU 增长
- 资源优化: 根据存储和带宽使用情况来优化成本
- 容量规划根据需求趋势规划未来资源需求
- 使用报告为利益相关者生成周期性使用报告
- 打包(版本)分发分析了解不同应用程序包(版本)中的用户分布情况,通过包使用统计数据
数据分析提示
分析技巧- 比较时间段查看月度或年度的趋势
- 跟踪比例: 监控每个用户的带宽或每个应用的存储
- 设置警报: 为异常的使用峰值创建警报
- 定期备份: 定期导出统计数据以进行历史分析
- 版本 (版本) 采用: 使用捆绑包使用率来跟踪新捆绑包 (版本) 的采用率
从统计数据继续
标题:从统计数据继续如果您正在使用 统计 来规划存储和文件处理,连接它与 __CAPGO_KEEP_0__ @capgo/capacitor-data-storage-sqlite 了解@capgo/capacitor-data-storage-sqlite的实现细节 使用@capgo/capacitor-data-storage-sqlite 了解@capgo/capacitor-data-storage-sqlite的原生能力 @capgo/capacitor-file 了解@capgo/capacitor-file的实现细节 使用@capgo/capacitor-file 了解@capgo/capacitor-file的原生能力 @capgo/capacitor-uploader 了解@capgo/capacitor-uploader的实现细节