This guide shows you how to add App Events to your new or existing app by integrating the Facebook SDK then logging these events.
This Facebook SDK (JS) App Events API has been deprecated and is no longer supported starting July 1, 2022. There are no plans to add new features to this product.
Instead of using FB.AppEvents.LogEvent
, we recommend that you send these events through the Meta Pixel.
Go to the App Dashboard, click My Apps, and create a new app if you don't already have one. Navigate to Settings > Basic to view the App Details Panel with your App ID, your App Secret, and other details about your app.
Set up your app for advertising by adding the following details:
Save your changes.
To learn more about adding details to your app, such as an icon or category, visit the App Development docs.
To run ads and measure installs in the Ads Manager, you need to associate at least one Ad Account with your app.
We provide two ways to integrate the Facebook into your web page, using a Quickstart or adding the SDK manually.
By using the Quickstart Guide from your App Dashboard to add the Facebook SDK to your Website, the code provided will already include your App ID.
To add the SDK manually copy and paste the following code but be sure to replace {your-app-id}
with your App ID and {version}
with the Graph API version your app is using.
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{your-app-id}',
xfbml : true,
version : '{version}'
});
FB.AppEvents.logPageView();
};
</script>
<script async defer
src="https://connect.facebook.net/en_US/sdk.js"></script>
</script>
There are three ways events are tracked in your app:
For websites, we recommend triggering the page view event on all pages to ensure accurate user accounts and session durations.
After you integrate the Facebook SDK into your app, these events are automatically logged.
이벤트 | 상세 정보 |
---|---|
앱 설치 | 새 사용자가 처음으로 앱을 활성화하거나 앱이 특정 기기에서 처음으로 시작된 경우. |
앱 실행 | 사용자가 앱을 실행하면 Facebook SDK가 초기화되고 이벤트가 로깅됩니다. 그러나 첫 번째 앱 실행 이벤트 이후로 60초 이내에 두 번째로 앱 실행 이벤트가 발생하면 두 번째 이벤트가 로깅되지 않습니다. |
앱 내 구매 | Apple App Store 또는 Google Play에 의해 처리된 구매가 완료된 경우. 다른 결제 플랫폼을 사용하는 경우 수동으로 구매 이벤트 코드를 추가해야 합니다. |
Facebook SDK 충돌 보고서 (Facebook 전용) | Facebook SDK로 인해 앱이 충돌할 경우 충돌 보고서가 생성되고 앱이 다시 시작되었을 때 Facebook으로 전송됩니다. 이 보고서에는 사용자 데이터가 포함되지 않으며 Facebook이 SDK의 품질과 안정성을 보장하는 데 도움이 됩니다. 이 이벤트 로깅을 옵트아웃하려면 자동 로깅된 이벤트를 비활성화하세요. |
To log a custom event, just pass the name of the event as a string:
function onButtonClick() {
// Add this to a button's onclick handler
FB.AppEvents.logEvent("{my_app_event}");
}
Use app event parameters to view breakdowns on your insights you are interested in. The parameters are passed via a Bundle
where the key holds the parameter name and the value is either a String
or an int
. The recommended description for these are guidance only; you can use these parameters or provide your own for whatever makes sense for your app. If you provide another type of value that is not compliant such as a boolean
, the SDK logs a warning to LogginBehavior.APP_EVENT
.
You can deactivate app events using the Events Manager.
View the most recent events logged by your app or website using the Facebook Events Manager. Choose your app and go to Test Events. Enter your URL to test your events set up.
The App Ads Helper allows you to test the app events in your app to ensure that your app is sending events to Facebook.
For more information and helpful hints on App Events check out: