Getting Started
Copiez une commande de configuration avec les étapes d'installation et la guide markdown complète pour ce plugin.
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.
Installation
Sous-titre : "Installation"bun add @capgo/capacitor-facebook-analyticsbunx cap syncImporter
Section intitulée “Importer”import { FacebookAnalytics, FacebookEventName, FacebookEventParameterName,} from '@capgo/capacitor-facebook-analytics';Configuration native
Section intitulée “Configuration native”Configurez votre ID d'application Meta et votre jeton client dans l'application native. Le plugin ne crée pas ces valeurs pour vous.
Ajoutez vos valeurs 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
Section intitulée “Android”Ajoutez vos valeurs Meta à 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" />Ajoutez les ressources de chaîne dans 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>Activer le suivi de l'annonceur
Section intitulée “Activer le suivi de l'annonceur”Appelez cela après que votre flux de consentement autorise le suivi.
await FacebookAnalytics.enableAdvertiserTracking();Sur iOS 17 et au-dessus, FBSDK v17+ lit directement la transparence du suivi de l'application. Utilisez votre flux de ATT avant d'enregistrer les événements dépendants du suivi.
Enregistrer un événement standard
Section intitulée « Log Un Événement Standard »await FacebookAnalytics.logEvent({ event: FacebookEventName.CompletedRegistration, params: { [FacebookEventParameterName.RegistrationMethod]: 'email', },});Loguer Un Événement De Valeur Avec Devise
Section intitulée « Loguer Un Événement De Valeur Avec Devise »await FacebookAnalytics.logEvent({ event: FacebookEventName.AddedToCart, valueToSum: 19.99, currency: 'USD', params: { [FacebookEventParameterName.ContentType]: 'product', [FacebookEventParameterName.ContentId]: 'sku-123', },});Loguer Un Achat
Section intitulée « Loguer Un Achat »await FacebookAnalytics.logPurchase({ amount: 9.99, currency: 'USD',});Lire L'État De Suivi
Section intitulée « Lire L'État De Suivi »const { status } = await FacebookAnalytics.getAdvertiserTrackingStatus();console.log('Advertiser tracking enabled:', status);Source De Vérité
Section intitulée « Source De Vérité »Cette page est générée à partir du plugin’s src/definitions.tsRe-faites la synchronisation lorsque les public API changent en amont.
Continuez depuis Getting Started
Section intitulée « Continuez depuis Getting Started »Si vous utilisez Getting Started pour planifier le travail de plugin natif, connectez-le avec Utilisez @capgo/capacitor-facebook-analytics pour la capacité native dans Utilisez @capgo/capacitor-facebook-analytics, Capgo Répertoire des plugins pour le flux de travail du produit dans Capgo Répertoire des plugins, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Ajouter ou Mettre à Jour les Plugins pour le détail d'implémentation dans Ajouter ou Mettre à Jour les Plugins, et Alternatives de Plugins Entreprise Ionic pour le flux de travail du produit dans Alternatives de Plugins Entreprise Ionic.