This Quickstart shows how to integrate Facebook Analytics into a new or existing Swift or Objective-C app.
Please log in to Facebook to create apps or register as a developer.
sudo gem install cocoapods
info.plistand choose Open As Source Code.
Use the App Event Builder to generate the code in your language to implement either a custom or pre-defined app event that you can then add to your app.
After you integrate the Facebook SDK into your app, the following events are automatically logged:
The first time a new user activates an app or the first time an app starts on a particular device.
When the Facebook SDK is initialized in your app for each session.
When a purchase processed by the Apple App Store or Google Play has been completed. If you use other payments platforms, you will need to add purchase event code manually.
The following table contains the pre-defined events. Use the App Event Builder to get the code for these events.
Log this event when a person achieves specific levels you define within your application, business, or organization.
Add Payment Info
Log this event during the addition of customer payment information during a checkout process.
Add to Cart
Log this event during the addition of an item to a shopping cart or basket (example: clicking an Add to Cart button on a website).
*Required parameters for Dynamic Ads.
Add to Wishlist
Log this event during the addition of items to a wishlist (example: clicking an Add to Wishlist button on a website).
Log this event during the submission of information in exchange for a service provided by your business (example: sign up for email subscription).
Log this event during the completion of a tutorial on your app.
Log this event during a telephone/SMS, email, chat, or other type of contact between a customer and your business.
Log this event during the customization of products through a configuration tool or other application your business owns.
Log this event during the donation of funds to your organization.
Log this event when a web or app search for one of your business locations suggest that someone might intend to visit (example: searching for a product and finding it at one of your local stores.
In-App Ad Click
Log this event when an ad from a third-party platform is clicked within your app.
In-App Ad Impression
Log this event when an ad from a third-party platform appears on-screen within your app.
Log this event at the start of a checkout process.
Log this event during the completion of a purchase, usually signified by receiving order/purchase confirmation or a transaction receipt
If you use Facebook to manage your in-app purchases, the purchase events are automatically logged.
*Required for Dynamic Ads
Log this event during a rating of something within your app, business, or organization (example: rates a restaurant within a restaurant review app).
Log this event during the booking of an appointment to visit one of your locations.
Log this event during a search performed on your website, app or other property (example: product searches, travel searches).
Log this event during the completion of a transaction where people spend credits (example: in-app currency) specific to your business or application.
Log this event at the start of a free trial of a product or service you offer (example: trial subscription).
Log this event during the submission of an application for a product, service, program you offer example: credit card, educational program, or job).
Log this event at the start of a paid subscription for a product or service you offer.
Log this event during the completion of specific activities or actions you want to reward within your application, business or organization (refer a friend, complete your profile, etc.).
Log this event during a visit to a content page you care about, such as a product page, landing page or article.
*Required for Dynamic Ads
The App Ads Helper allows you to test your app events to ensure that your app is sending events to Facebook.
a. Open the App Ads Helper.
b. In Select an App, choose your app and choose Submit.
c. Go to the bottom and choose Test App Events.
d. Start your app and send an event. The event appears on the web page.
The demo app does not have an Event Debugging link. This link is only available in apps that you create.