统计数据
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
Statistics API 端点提供有关您的应用和组织的详细分析数据。您可以追踪不同时间段内的月活跃用户数 (MAU)、存储占用以及带宽消耗。这些数据对于监控应用增长、资源使用情况以及容量规划至关重要。
指标详解
“理解指标”章节- MAU (月活跃用户数):过去 30 天内访问过您应用的唯一设备数量
- 存储空间:所有存储的 bundle 和资源的字节总大小
- 带宽:bundle 下载产生的总数据传输量(字节)
最佳实践
标题为“最佳实践”的章节- 定期监控: 定期查看统计数据,跟踪增长和使用模式
- 资源规划: 利用存储和带宽指标进行容量规划
- 用户参与度: 跟踪 MAU,了解用户参与度趋势
- 成本管理: 监控资源使用情况以优化成本
GET /statistics/app/:app_id/
“GET /statistics/app/:app_id/” 章节获取特定 App 的统计数据。此端点适用于监控单个 App 的性能。
查询参数
标题为“查询参数”的章节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/app/com.demo.app/?from=2024-01-01&to=2024-02-01"响应示例
标题为“响应示例”的章节[ { "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/” 章节获取特定组织的统计数据。适用于监控组织层级的用量情况。
查询参数
标题为“查询参数”的章节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}请求示例
标题为“请求示例”的章节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"响应示例
标题为“响应示例”的章节[ { "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
标题为“GET /statistics/app/:app_id/bundle_usage”的章节获取指定应用的 bundle 使用统计,展示指定时间段内 bundle(版本)在用户中的分布情况。
查询参数
标题为“查询参数”的章节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] } ]}错误处理
“错误处理”章节所有错误均采用以下文档中描述的标准错误格式: API 概览.
常见的错误场景及其响应:
// The API key cannot read this app (HTTP 401){ "error": "no_access_to_app", "message": "No access to app", "moreInfo": { "data": "6aa76066-55ef-4238-ade6-0b32334a4097" }}
// The API key cannot read this organization (HTTP 401){ "error": "no_access_to_organization", "message": "No access to organization", "moreInfo": { "data": "6aa76066-55ef-4238-ade6-0b32334a4097" }}
// Organization statistics require an active plan (HTTP 402){ "error": "subscription_required", "message": "Organization subscription required or plan invalid", "moreInfo": { "orgId": "046a36ac-e03c-4590-9257-bd6c9dba9ee8", "isPayingAndGoodPlan": false }}
// User statistics when the user belongs to no organization (HTTP 401){ "error": "no_organizations_found", "message": "No organizations found", "moreInfo": { "data": "6aa76066-55ef-4238-ade6-0b32334a4097" }}常见用例
“常见用例”章节- 增长追踪: 监控 MAU 的随时间增长趋势
- 资源优化: 追踪存储和带宽使用情况以优化成本
- 容量规划: 利用趋势预测未来的资源需求
- 使用报告: 为利益相关者生成定期使用报告
- Bundle (版本) 分布分析: 通过 bundle 使用统计数据了解用户在不同 app bundles (版本) 中的分布情况
分析技巧
标题为“分析技巧”的章节- 对比周期: 查看环比或同比趋势
- 追踪比例: 监控单用户带宽或单应用存储量
- 设置告警: 针对异常的使用量激增创建告警
- 定期备份: 定期导出统计数据进行历史分析
- Bundle (版本) 采用率: 利用 bundle 使用情况追踪新 bundle (版本) 的采用率
继续查看统计
标题为“从统计数据继续”的章节如果你正在使用 统计数据 要规划存储和文件处理,请将其与 @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. 的实现细节