跳过内容

统计信息

The Statistics endpoints provide detailed analytics about your apps and organizations. You can track Monthly Active Users (MAU), storage usage, and bandwidth consumption across different time periods. This data is essential for monitoring app growth, resource usage, and planning capacity.

  • MAU (Monthly Active Users): 每月活跃设备数量(MAU)
  • Storage: 所有捆绑包和资源的总大小(字节)
  • Bandwidth: 捆绑包下载的总数据传输量(字节)
  1. 定期监控: 定期查看统计数据以跟踪增长和使用模式
  2. Resource Planning: 使用存储和带宽指标进行容量规划
  3. User Engagement: 跟踪活跃用户数(MAU)以了解用户参与趋势
  4. Cost Management: 监控资源使用以优化成本

Get statistics for a specific app. This endpoint is useful for monitoring individual app performance.

请求参数

请求参数部分
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
}
]

获取所有您有访问权限的组织的聚合统计数据。适合用于监控整体使用情况。

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/应用包使用统计

GET /statistics/app/:app_id/应用包使用统计

获取特定应用的应用包使用统计,显示应用包(版本)在指定时间段内的分布。

请求参数

请求参数
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"
}
  1. 增长跟踪: 监控月活跃用户数(MAU)随时间的增长
  2. 资源优化: 跟踪存储和带宽使用情况以优化成本
  3. 容量规划: 根据趋势规划未来资源需求
  4. Usage Reports: 为利益相关者生成周期性使用报告
  5. Bundle (version) Distribution Analysis: 了解用户如何在不同应用程序包(版本)之间分布,使用包使用统计

Tips for Analysis

分析建议
  1. Compare Periods: 查看月度或年度趋势
  2. Track Ratios: 监控每用户带宽或每应用程序存储
  3. Set Alerts: Create alerts for unusual spikes in usage
  4. 定期备份: Export statistics regularly for historical analysis
  5. 版本采用率: Use bundle usage to track adoption rates of new bundles (versions)

从统计中继续

如果您正在使用

统计 来规划存储和文件处理,连接它与 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-data-storage-sqlite 查看@capgo/capacitor-data-storage-sqlite的实现细节 for the implementation detail in @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。