Facebook events tracking in Capacitor applications
npm i --save capacitor-facebook-events
npx cap sync
{ enabled: boolean; }
|
--------------------
### logEvent(...)
```typescript
logEvent(options: { event: string; params?: any; }) => Promise{ event: string; params?: any; }
|
--------------------
To log a registration event, use the 'fb_mobile_complete_registration' event name:
import { FacebookEvents } from 'capacitor-facebook-events';
// ...
FacebookEvents.logEvent({
event: 'fb_mobile_complete_registration',
params: {
// Additional parameters (optional)
}
});
For logging a purchase event, use the 'fb_mobile_purchase' event name with relevant parameters:
import { FacebookEvents } from 'capacitor-facebook-events';
// ...
FacebookEvents.logEvent({
event: 'fb_mobile_purchase',
params: {
fb_content_id: 'item_id', // Item ID
fb_content_type: 'product',
fb_currency: 'currency_code',
_valueToSum: amount // Purchase amount
}
});
For a comprehensive list of events, refer to the Facebook App Events API documentation.