跳转到内容

统计

统计端点提供有关您的应用程序和组织的详细分析。您可以跟踪不同时间段的每月活跃用户 (MAU)、存储使用情况和带宽消耗。这些数据对于监控应用程序增长、资源使用情况和规划容量至关重要。

  • MAU(每月活跃用户):过去 30 天内访问您的应用的唯一设备数量
  • 存储:存储的所有捆绑包和资源的总大小(以字节为单位)
  • 带宽:捆绑包下载的总数据传输量(以字节为单位)
  1. 定期监控:定期检查统计数据以跟踪增长和使用模式
  2. 资源规划:使用存储和带宽指标进行容量规划
  3. 用户参与度:跟踪 MAU 以了解用户参与度趋势
  4. 成本管理:监控资源使用情况以优化成本

获取特定应用程序的统计信息。此端点对于监控单个应用程序性能非常有用。

interface StatsQuery {
from: Date // Start date for the statistics (format: YYYY-MM-DD)
to: Date // End date for the statistics (format: YYYY-MM-DD)
}
Terminal window
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
}
]

获取特定组织的统计数据。对于监控组织级别的使用情况很有用。

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
}
Terminal window
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)
}
Terminal window
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
}
]

获取特定应用程序的捆绑包使用情况统计信息,显示指定时间段内用户之间的捆绑包(版本)分布情况。

interface BundleUsageQuery {
from: Date // Start date for the statistics (format: YYYY-MM-DD)
to: Date // End date for the statistics (format: YYYY-MM-DD)
}
Terminal window
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. 使用报告:为利益相关者生成定期使用报告
  5. 捆绑包(版本)分布分析:通过捆绑包使用统计信息了解用户如何分布在不同的应用程序捆绑包(版本)中
  1. 比较期间:查看环比或同比趋势
  2. 跟踪比率:监控每个用户的带宽或每个应用程序的存储
  3. 设置警报:针对异常使用高峰创建警报
  4. 定期备份:定期导出统计数据以进行历史分析
  5. 捆绑包(版本)采用:使用捆绑包使用情况来跟踪新捆绑包(版本)的采用率