始めて
このプラグインのインストール手順と完全なマークダウン ガイドを含むセットアッププロンプトをコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-facebook-analytics`
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/facebook-analytics/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.
Install
Section titled “Install”CapgoのAI-Assisted Setupを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-facebook-analytics` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-facebook-analyticsbunx cap syncインポート
セクション「インポート」import { FacebookAnalytics, FacebookEventName, FacebookEventParameterName,} from '@capgo/capacitor-facebook-analytics';ネイティブセットアップ
セクション「ネイティブセットアップ」ネイティブアプリでMetaアプリIDとクライアントトークンを設定してください。このプラグインはこれらの値を自動生成しません。
iOS
セクション「iOS」Metaの値を追加してください Info.plist:
<key>FacebookAppID</key><string>YOUR_FACEBOOK_APP_ID</string><key>FacebookClientToken</key><string>YOUR_FACEBOOK_CLIENT_TOKEN</string><key>FacebookDisplayName</key><string>YOUR_APP_NAME</string>Android
セクション「Android」Add your Meta values to AndroidManifest.xml:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" /><meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token" />Add the string resources in android/app/src/main/res/values/strings.xml:
<string name="facebook_app_id">YOUR_FACEBOOK_APP_ID</string><string name="facebook_client_token">YOUR_FACEBOOK_CLIENT_TOKEN</string>Enable Advertiser Tracking
Section titled “Enable Advertiser Tracking”Call this after your consent flow allows tracking.
await FacebookAnalytics.enableAdvertiserTracking();On iOS 17 and above, FBSDK v17+ reads App Tracking Transparency directly. Use your app’s ATT flow before logging tracking-dependent events.
Log A Standard Event
Section titled “Log A Standard Event”await FacebookAnalytics.logEvent({ event: FacebookEventName.CompletedRegistration, params: { [FacebookEventParameterName.RegistrationMethod]: 'email', },});金額をログするイベントに値をログする
「金額をログするイベントに値をログする」のセクションawait FacebookAnalytics.logEvent({ event: FacebookEventName.AddedToCart, valueToSum: 19.99, currency: 'USD', params: { [FacebookEventParameterName.ContentType]: 'product', [FacebookEventParameterName.ContentId]: 'sku-123', },});購入をログする
「購入をログする」のセクションawait FacebookAnalytics.logPurchase({ amount: 9.99, currency: 'USD',});トラッキングのステータスを読み取る
「トラッキングのステータスを読み取る」のセクションconst { status } = await FacebookAnalytics.getAdvertiserTrackingStatus();console.log('Advertiser tracking enabled:', status);真実の源
「真実の源」のセクションこのページはプラグインから生成されています src/definitions.ts. upstream の API が変更されたときに、再度 sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。あなたが「Getting Started」を使用している場合 Getting Started native plugin の作業を計画する場合、native capability を「を接続してください。 native capability の「@capgo/capacitor-facebook-analytics」を使用します。 native capability の「@capgo/capacitor-facebook-analytics」の実装詳細 Capgo Plugin Directory Capgo Plugin Directory の製品ワークフロー Capacitor Plugins by Capgo Capacitor Plugins by Capgo の実装詳細 プラグインの追加または更新 __CAPGO_KEEP_0__の実装詳細については、プラグインの追加または更新のページを参照してください。 Ionic Enterprise プラグインの代替 __CAPGO_KEEP_0__の製品ワークフローについては、Ionic Enterprise プラグインの代替のページを参照してください。