Skip to main content

Set up Facebook as an analytics platform

This article guides you on setting up Facebook as an analytics platform, allowing your game to report telemetry data directly to Facebook.

Prerequisites

1. Set up Facebook as an identity provider

Follow the steps in the articles below to set up Facebook as an identity provider for your game:

2. Request user authorization for user and device tracking

For iOS 14.5 and later versions, the AppTrackingTransparency framework is required for tracking user data and reporting this data to Facebook.

  1. Add the dependency to the AppTrackingTransparency.framework in your app.

  2. In the Info.plist file, add a NSUserTrackingUsageDescription key for a purpose string that will be displayed on the user consent screen.

  3. Call the static void RequestTrackingAuthorization(); method of Unity or UE for requesting tracking authorization.

    note

    This method is compiled on Xcode 12 and later versions and runs on iOS 14.0 and later versions. It sends the request once and the system remembers player's choice. It is no longer prompted unless the player uninstalls and reinstalls the game on the same device.

Step 1: Configure event reporting

Facebook SDK supports reporting automatically logged events and manually logged events. The reported data generally only includes the event name, but additional parameters can be manually added. The time, device operation system, app version, value, and parameter information for reported events could be viewed on the Facebook Events Manager.

Automatically logged events

To enable the reporting of automatically logged events, enable Log in-app events automatically for the platform on which the game is going to be released, in Facebook App Dashboard. Image: Facebook Event Image: Facebook Event2

To disable the reporting of automatically logged events, see Disable Automatically Logged Events (iOS) or Disable Automatically Logged Events (Android).

Manually logged events

Facebook requires 2 to 40 alphanumeric characters for event names and parameters. The length of each parameter cannot exceed 100 characters.

To manually log custom events, see the Manually Log Events (iOS) or Manually Log Events (Android).

For more information on Faceboook events reporting, see Meta App Events FAQ.

Funnel events

note

Supported starting from Player Network SDK V1.20.

To enable Player Network SDK to synchronize the reporting of funnel events to Facebook, add the Facebook channel to the ANALYTICS_REPORT_FUNNEL_CHANNEL configuration in INTLConfig.ini.

[ANALYTICS]
ANALYTICS_REPORT_FUNNEL_CHANNEL = Facebook

See View reported data in the console to view the reported events.

Step 2: Initialize Analytics

Initialize the Analytics module, then call ReportEvent to start Facebook data reporting.

Data reporting acceptance

View reported data in the console

note

There is some latency (influenced by network environment, network fluctuations for Facebook, or other factors) for the reported events when calling the event reporting API. As a result, it is common to see some reported events without any data. It is recommended to view the data 30 minutes after receiving the callback of a successful reporting.

To view the reported data, go to Facebook Events Manager, and click the name of the reported event.

Image:Facebook Event Report

Event details can be seen by clicking View Recent Events under the corresponding event.

Images Images

The Facebook Events Manager categorizes events into standard events and custom events.

  • Standard events: Currently, only app install and app launch are recognized as standard events. After initialization, the total number of reported events for these will be displayed.
  • Custom events: Use the app to configure custom events. Navigate to a custom event to view its name and the total event count.

Acceptance use case 1

  • Sub-function module: Reporting
  • Feature: Event Reporting
  • Test points: Facebook console login, enter a custom event, install the app, launch the app
  • Prerequisites: Initialize Analytics module
  • Procedure/Input
    1. Log in to the Facebook console for the first time
    2. Enter the custom event name and parameters
    3. Install and enter the app for the first time
    4. Launch the app
    5. On the console, export data and view reported events
  • Expected output: Information reported successfully. Check the following on the console:
    1. Enter custom event name and parameters: Reported qty+1
    2. Install and enter the app for the first time: Reported qty+1
    3. Launch app: Reported qty+1

Acceptance use case 2

  • Sub-function module: ReportRevenue
  • Feature: Facebook payment event reporting
  • Test points: Query report after requesting ReportRevenue (Facebook)
  • Prerequisite: Network connection is normal
  • Procedure/Input
    1. Request ReportRevenue
    2. eventName = customizable, spChannels = Facebook, Currency = USD, Revenue = 100
    3. Facebook inquiries to report incidents
    4. DD Platform query AnalyticsReportRevenue event
  • Expected output: Information reported successfully.
    1. Facebook related event statistics +1, click the event details display to display USD100 related values.
    2. DD Platform successfully queries the event reporting with methodName as AnalyticsReportRevenue and method_id=715.

Acceptance use case 3

  • Sub-function module: ReportRevenue
  • Feature: Facebook payment event reporting
  • Test points: Query report after requesting ReportRevenue in disconnected state (Facebook)
  • Prerequisite: Disconnected network status
  • Procedure/Input
    1. Request ReportRevenue
    2. eventName = customizable, spChannels = Facebook, Currency = USD, Revenue = 1000
    3. Reconnect to the network
    4. Facebook inquiries to report incidents
    5. DD Platform query AnalyticsReportRevenue event
  • Expected output: Information reported successfully.
    1. After networking, Facebook related event statistics +1, click the event details display to display USD1000 related values.
    2. The DD Platform successfully queries the event reporting with methodName as AnalyticsReportRevenue and method_id=715.

Error codes

Error CodesError Information
1An unknown error occurred
4Application request limit reached
10Application does not have permission for this action
17User request limit reached
100Invalid parameter
200Permission error

For more information, see Facebook Error Codes.