Facebook App Events

Facebook App Events Integration Guide

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

  1. Add Facebook App Events Plugin

    Ensure the Facebook App Events plugin is added to your cart.

  2. Configure Facebook App Events

    • Navigate to the plugins integration section in your app development environment.
    • Go to the Facebook App Events settings.
  3. Facebook App Events Configuration

    • 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 the configuration settings.
    • Rebuild your app to apply the changes.

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.

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: