Facebook App Events
Collect analytics, measure Facebook Ad performance and build audiences for Facebook Ad targeting by integrating Facebook App Events into your app. This guide provides detailed instructions on configuring and using Facebook App Events, including both automatically logged and custom events.
Setup and Configuration of Facebook App Events
1. Add Facebook App Events
Click on "Add" button to add Facebook App Events. Once you add, it will appear in Add-ons menu.
2. Configure Facebook App Events
After adding the add-on, you will see the settings option in the section. Then, Go to the Facebook App Events settings.
- Autolog FB Events: Enable or disable automatic logging of events.
- Client Token: Enter your Facebook app's client token.
- App ID: Enter your Facebook app ID.
Save your changes and Rebuild your app to see the changes are in action, after configuring the Facebook App Event settings.
Automatically Logged Events
When using the Facebook SDK, certain events in your app are automatically logged and collected for Facebook Events Manager unless you disable this feature. These events are useful for targeting, measurement, and optimization.
Learn More:
- Automatically Log Events for Android (opens in a new tab)
- Automatically Logged Events for iOS (opens in a new tab)
Manually Log Events (Custom Events)
To send custom events to Facebook, use the following methods:
1. Regular Events
Plain JavaScript:
const { events: FacebookEvents } = window.WTN.facebook;
FacebookEvents.send({
event: "MY_EVENT",
valueToSum: 10, // optional
parameters: { // optional
name: "webtonative"
}
});
ES6+ Syntax:
import { send } from "webtonative/Facebook/events";
send({
event: "MY_EVENT",
valueToSum: 10, // optional
parameters: { // optional
name: "webtonative"
}
});
2. Purchase Events
There is a special case for purchases where Facebook's SDK will send the event more immediately.
Plain JavaScript:
const { events: FacebookEvents } = window.WTN.facebook;
FacebookEvents.sendPurchase({
amount: 3.14,
currency: "INR",
parameters: { // optional
name: "webtonative"
}
});
ES6+ Syntax:
import { sendPurchase } from "webtonative/Facebook/events";
sendPurchase({
amount: 3.14,
currency: "INR",
parameters: { // optional
name: "webtonative"
}
});
Event Names and Parameter Keys
To ensure correct event names and parameter keys, refer to the official documentation:
- String Constants for Event Names and Parameter Keys for Android (opens in a new tab)
- String Constants for Event Names and Parameter Keys for iOS (opens in a new tab)