Getting Started
コピー可能なプラグインの設定プロンプトにインストールステップと完全なマークダウンガイドを含めます。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-performance`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-performance/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションAIアシスタントセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsコンテキスト: Capgo マーケティング ウェブサイト。役割: UI ラベル。表示: ページエージェント/[slug].astro。メッセージキー `agents_page_copy_label` (エージェント ページ コピー ラベル)。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-performance` plugin in my project.次に、以下のプロンプトを使用してください。
bun add @capgo/capacitor-firebase-performancenpx cap syncImport
インポートimport { FirebasePerformance } from '@capgo/capacitor-firebase-performance';クイックスタート
クイックスタートimport { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({ traceName: 'trace' });例: stopTrace
例: stopTraceimport { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({ traceName: 'trace' });例: incrementMetric
例: incrementMetricimport { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({ traceName: 'trace', metricName: 'metric',});よくある間違い
よくある間違い- ネイティブ同期:実行
npx cap syncプラグインアップグレード後 - 真実の源:信頼
src/definitions.tsGitHubの概要
APIの概要
APIガイドstartTrace
開始トレースクリップボードにコピー
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({ traceName: 'trace' });stopTrace
トレースの停止停止を実行します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({ traceName: 'trace' });incrementMetric
「incrementMetric」与えられた名前のメトリックを選択したトレースで、指定された値で incrementBy 「setEnabled」
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({ traceName: 'trace', metricName: 'metric',});「isEnabled」
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.setEnabled({ enabled: true });isEnabled
パフォーマンスモニタリングが有効か無効かを判断します。「value」
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.isEnabled();console.log(result);putAttribute
putAttributetraceにカスタム属性を指定した値に設定します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putAttribute({ traceName: 'trace', attribute: "experiment", value: "A",});getAttribute
getAttributetraceのカスタム属性の値を取得します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getAttribute({ traceName: 'trace', attribute: 'attribute',});console.log(result);getAttributes
「getAttributes」traceのすべてのカスタム属性と値を取得します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getAttributes({ traceName: 'trace' });console.log(result);removeAttribute
removeAttributetraceから指定した名前のカスタム属性を削除します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.removeAttribute({ traceName: 'trace', attribute: 'attribute',});putMetric
「putMetric」セクションカスタムメトリックの値を設定します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putMetric({ traceName: 'trace', metricName: 'metric', num: 1,});getMetric
「getMetric」セクション指定された名前のカスタムメトリックの値を取得します。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getMetric({ traceName: 'trace', metricName: 'metric',});console.log(result);record
「レコード」セクション指定された名前とオプションでトレースを記録します。
ウェブ上のみ利用可能です。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.record({ traceName: 'trace', startTime: 10, duration: 1000,});型の参照
「型の参照」セクションStartTraceOptions
StartTraceOptionsexport interface StartTraceOptions { /** * Custom trace name. * * Names for custom code traces must meet the following requirements: * no leading or trailing whitespace, no leading underscore (_) character, * and max length is 100 characters. * * @since 0.1.0 */ traceName: string;}StopTraceOptions
クリップボードにコピーexport interface StopTraceOptions { /** * Name of the trace that was set with `startTrace`. * * @since 0.1.0 */ traceName: string;}IncrementMetricOptions
StopTraceOptionsexport interface IncrementMetricOptions { /** * Name of the trace that was set with `startTrace`. * * @since 0.1.0 */ traceName: string; /** * Name of the metric to be incremented. * * @since 0.1.0 */ metricName: string; /** * Amount by which the metric has to be incremented. * * @default 1 * @since 0.1.0 */ incrementBy?: number;}SetEnabledOptions
IncrementMetricOptionsexport interface SetEnabledOptions { /** * Should performance monitoring be enabled. * * @since 0.1.0 */ enabled: boolean;}IsEnabledResult
SetEnabledOptionsexport interface IsEnabledResult { /** * `true` if performance monitoring is enabled, otherwise `false`. * * @since 0.1.0 */ enabled: boolean;}PutAttributeOptions
IsEnabledResultexport interface PutAttributeOptions { /** * Name of the trace to set its attribute. * * @since 6.3.0 */ traceName: string; /** * Name of the attribute to set its value. * * @since 6.3.0 * @example "experiment" */ attribute: string; /** * The value to set to the attribute. * * @since 6.3.0 * @example "A" */ value: string;}GetAttributeOptions
「GetAttributeOptions」export interface GetAttributeOptions { /** * Name of the trace to set its attribute. * * @since 6.3.0 */ traceName: string; /** * Name of the attribute to retrieve its value. * * @since 6.3.0 */ attribute: string;}GetAttributeResult
「GetAttributeResult」export interface GetAttributeResult { /** * The value of the custom attribute. * * @since 6.3.0 */ value: string | null;}GetAttributesOptions
「GetAttributesOptions」export interface GetAttributesOptions { /** * Name of the trace to get its attributes. * * @since 6.3.0 */ traceName: string;}GetAttributesResult
「GetAttributesResult」export interface GetAttributesResult { /** * A map of all custom attributes of a trace with their values. * * @since 6.3.0 */ attributes: { [key: string]: string };}RemoveAttributeOptions
RemoveAttributeOptionsexport type RemoveAttributeOptions = GetAttributeOptions;PutMetricOptions
「メトリクスオプションを設定する」export interface PutMetricOptions { /** * Name of the trace to set its metric. * * @since 6.3.0 */ traceName: string; /** * The metric name. * * @since 6.3.0 */ metricName: string; /** * The value to set for the metric. * The given value is floored down to the nearest integer. * * @since 6.3.0 */ num: number;}真実の源
「真実の源」このページはプラグインの src/definitions.ts公開されたAPIがアップストリームで変更されたときに再度同期してください。
「始めから始める」
「始めから始める」あなたが 「始めから始める」 を使用してダッシュボードとAPIの実行を計画している場合、APIの概要と接続してください。 APIの概要 APIの概要 Introduction 導入の詳細については、Introduction を参照してください。 API キー 導入の詳細については、API キーを参照してください。 デバイス デバイスの実装詳細について 導入の詳細についてはデバイス、 バンドル