統計
インストール手順と、このプラグインの完全なMarkdownガイドを含むセットアッププロンプトをコピーします。
Statistics エンドポイントを使用すると、アプリや組織に関する詳細な分析データを確認できます。MAU(月間アクティブユーザー数)、ストレージ使用量、帯域幅の消費量をさまざまな期間で追跡可能です。これらのデータは、アプリの成長、リソース使用状況の監視、およびキャパシティプランニングに不可欠です。
メトリクスを理解する
「メトリクスの理解」セクション- MAU (月間アクティブユーザー数):過去30日間にアプリにアクセスしたユニークデバイス数
- ストレージ:保存されているすべての bundle とリソースの合計サイズ(バイト単位)
- 帯域幅:bundle ダウンロードの総データ転送量(バイト単位)
ベストプラクティス
「ベストプラクティス」セクション- 定期的なモニタリング: 定期的に統計を確認し、成長や利用パターンを把握します
- リソース計画: ストレージや帯域幅のメトリクスを活用してキャパシティプランニングを行います
- ユーザーエンゲージメント: MAUを追跡して、ユーザーのエンゲージメント傾向を理解します
- コスト管理: リソースの使用状況を監視し、コストを最適化します
エンドポイント
「Endpoints」セクションGET /statistics/app/:app_id/
「GET /statistics/app/:app_id/」セクション特定のアプリの統計情報を取得します。このエンドポイントは、個別のアプリのパフォーマンスをモニタリングする際に便利です。
クエリパラメータ
「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)}リクエスト例
「リクエスト例」のセクション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/」セクション特定の組織の統計情報を取得します。組織レベルの使用状況をモニタリングする際に便利です。
クエリパラメータ
「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}リクエスト例
「リクエスト例」のセクション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/」アクセス権を持つすべての組織の集計統計を取得します。全体の利用状況をモニタリングするのに最適です。
クエリパラメータ
「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)}リクエスト例
「リクエスト例」のセクション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(バージョン)の分布を表示します。
クエリパラメータ
「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] } ]}エラーハンドリング
「エラーハンドリング」セクションすべてのエラーは、以下に記載されている標準的なエラー形式に従います: 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の使用統計により、ユーザーが各アプリBundle (バージョン) にどのように分散しているかを把握します
分析のヒント
「分析のヒント」セクション- 期間比較: 前月比や前年比のトレンドを確認
- 比率の追跡: ユーザーあたりの帯域幅やアプリごとのストレージを監視
- アラート設定: 使用量の異常な急増に対してアラートを作成
- 定期的なバックアップ: 履歴分析のために統計データを定期的にエクスポート
- Bundle (バージョン) の採用率: Bundleの使用状況から、新しいBundle (バージョン) の採用率を追跡
Statistics から次のステップへ
「Statistics」からの次のステップ使用している場合 統計 ストレージとファイル処理を計画するには、以下と連携してください: @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 を使用する場合の Native Build 機能、および @capgo/capacitor-uploader @capgo/capacitor-uploader. の実装の詳細については