App Events API

Overview

Report app installs and in-app conversions through this API and send data back to Facebook Analytics. Use this on mobile devices without Facebook SDK.

The API fetches a Apple's Advertising Identifier (IDFA) or Android's Advertising ID from a mobile device and sends it to the app's server-side component. The server sends this data to Facebook and Facebook logs these app events.

Facebook does not share any app event data sent on your behalf to advertisers or other third parties, unless we have your permission or are required to do so by law.

Android-Fetching Mobile Cookie

We encourage you to associate app events with advertiser_id. However, for Android devices and iOS devices earlier than iOS6, you can also use mobile cookies, see attribution.

Place the Facebook attribution ID in Android in a ContentProvider that can be accessed by other apps on the phone. The code snippet below is an example of how to retrieve this ID.

public static final Uri ATTRIBUTION_ID_CONTENT_URI = Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider");

public static final String ATTRIBUTION_ID_COLUMN_NAME = "aid";

public static String getAttributionId(ContentResolver contentResolver) {
        String [] projection = {ATTRIBUTION_ID_COLUMN_NAME};
        Cursor c = contentResolver.query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null);
        if (c == null || !c.moveToFirst()) {
            return null;
        }
        String attributionId = c.getString(c.getColumnIndex(ATTRIBUTION_ID_COLUMN_NAME));
        c.close();
        return attributionId;
    }

You should also fetch Android’s advertising ID, see instruction Android, Play Service ID.

The cookie is a 22-character random alphanumeric string. It is not derived from any user or device attributes. Also this mobile cookie is not persistent and is designed to be refreshed frequently, so you cannot use this for re-targeting or so.

iOS-Fetching Mobile Cookie

Place the Facebook mobile cookie in a UIPasteboard named fb_app_attribution. Below is a code snippet to fetch this ID from the named UIPasteboard and to fetch Apple's Advertising Identifier (IDFA), both of which can be sent to Facebook as an identifier:

UIPasteboard *pb = [UIPasteboard
     pasteboardWithName:@"fb_app_attribution"
     create:NO];
ASIdentifierManager *manager = [ASIdentifierManager sharedManager];
NSString *advertiserID = [[manager advertisingIdentifier] UUIDString];

if (pb || advertiserID) {
  // do stuff
}

Mobile Cookie Format

The mobile cookie is created by Facebook iOS apps using CFUUIDCreateString and is 128-bit UUID string representation. It is not derived from any user or device attributes. This mobile cookie is not persistent and is designed to be refreshed frequently, so you cannot use this for re-targeting ads.

As of iOS 7, the UIPasteboard value will always be nil, but the IDFA is always available.

Tracking Enabled Flag

Device-Level iOS6+

On iOS6 and later, you can enable ad tracking in device settings. Facebook complies with Apple policies and requires that you report install and conversion events and the tracking-enabled flag. Facebook uses these app events for organic ad analytics and reporting, but restricts its use in ad optimization. See Apple, AdSuppport Reference to get this setting.

See the below code snippet that illustrates how to fetch the value of this flag:

(FBAdvertisingTrackingStatus)advertisingTrackingStatus {
    FBAdvertisingTrackingStatus status = AdvertisingTrackingUnspecified;
    Class ASIdentifierManagerClass = [FBDynamicFrameworkLoader loadClass:@"ASIdentifierManager" withFramework:@"AdSupport"];
    if ([ASIdentifierManagerClass class]) {
        ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
        if (manager) {
            status = [manager isAdvertisingTrackingEnabled] ? AdvertisingTrackingAllowed : AdvertisingTrackingDisallowed;
        }
    }
    return status;
}

Application-Level Opt-out

Any application can choose to include a setting for users to turn off ad tracking within that app. Facebook asks partners to include this option in their SDK and report back the user's choice to Facebook along with the install or conversion event. Facebook uses the install or conversion event for ad reporting but restrict it from being used in ad optimization. The user's setting must persist across app launches.

X-Forwarded-For HTTP Header

Ensuring accurate location and device-level information for our platform is paramount and one of the core signals we use is the device IP.

In most cases, the POST comes from the device, so the header is not always required; only in rare cases is this necessary:

  • If POST requests are done from a mobile device, the X-Forwarded-For HTTP header is not needed.

  • If POST requests are done from a central place (not from a mobile device, but via a server/proxy)—basically, a server-to-server call—then X-Forwarded-For HTTP header is required.

Our solution: Send the device's IP address, IPv4 or IPv6 format, via the X-Forwarded-For HTTP header parameter in each of the app event requests you send. By doing so, it allows us to pair the advertiser_id to the correct IP address, which we can then use in our platform.

IPv6 Example

curl ...
-H "X-Forwarded-For: fd45:f238:3b40:23b1:ffff:ffff:ffff:abcd" \
https://graph.facebook.com/<APP_ID>/activities/

IPv4 Example

curl ...
-H "X-Forwarded-For: 192.168.0.99" \
https://graph.facebook.com/<APP_ID>/activities

Report App Install Event to Facebook

After grabbing the attribution ID, Apple's Advertising Identifier (IDFA), or Android’s advertising ID from the device, you should send the ID to your server and from your server ping back to the endpoint below. You must do this from your server because you need to pass your app access token for Facebook to authenticate. Further, it's unsafe for you to put your app access token on the client. From your server, call the API endpoint with required parameters below.

You should report only one install per user. Deduplicate IDs on the ID and user levels, if you can determine this.

API Schema

POST https://graph.facebook.com/{app_id}/activities

Parameters

name description example

event

Conversion event that occurred

MOBILE_APP_INSTALL

advertiser_id

Apple's Advertising Identifier (IDFA) or Google's Android’s advertising ID. See how Facebook fetches this on iOS or on Android.

1111-1111-1111-1111

attribution

Mobile_cookie from a device. Applies to Android and pre-iOS6 devices. For other devices, we suggest you use advertiser_id. Use attrbution to associate with app event. See how.

DDDECD0A-C076-4050-8CE8-C20EC3FC2BD3

advertiser_tracking_enabled

User can enable or disable ad tracking on iOS 6+, and this is stored in the phone. You should fetch it and send it to Facebook so we do not use the data for optimization. We will use the data to report a conversion. See here to see how Facebook gets this setting. For non-iOS 6+ devices, this query parameter can be defaulted to 1.

0 for disabled or 1 for enabled

application_tracking_enabled

A user can enable or disable ad tracking on an app level. SDKs should enable app developers to add a opt-out setting into an app. Use this field to specify the user's choice.

0 for disabled or 1 for enabled

bundle_id

Optional. A unique string that identifies your application to the system. See FB-iOS-SDK to see how Facebook fetches this.

com.companyDomain.appName

bundle_version

Optional. Bundle version is the internal version number of your app. See FB-iOS-SDK for an example of how Facebook fetches that variable.

2.0.0.123

bundle_short_version

Optional. Bundle Short Version is the publically visible version of your app. See FB-iOS-SDK for an example of how Facebook fetches that variable.

2.0

extinfo

Information about the device. This parameter must be in a specific format.

See Android

See iOS

IPv6 Example from Android Device

The following example demonstrates how to send an install event for Android App with disabled tracking, attribution and advertiser IDs, device IPv6 and extended device information:

  • Extended info format version: "a2"
  • App Package Name: com.some.app
  • PackageInfo version code: 1372
  • PackageInfo version name: 13.72.0
  • Operating system version: 6.0
  • Device Model Name: Google Pixel
  • Device local: it_IT
  • Device timezone abbreviation: CEST
  • Carrier name: vodafone IT
  • Device screen width in pixels: 720
  • Device screen height in pixels: 1208
  • Device screen density: 2.00
  • Number of CPU cores: 8
  • External storage size (GB): 10
  • Available storage size (GB): 3
  • Device timezone: Europe/Rome
curl
-F advertiser_id=1111-1111-1111-1111 \
-F advertiser_tracking_enabled=0 \
-F attribution=DDDECD0A-C076-4050-8CE8-C20EC3FC2BD3 \
-F application_tracking_enabled=0 \
-F event=MOBILE_APP_INSTALL \
-F extinfo="[\"a2\", \
             \"com.some.app\", \
             1372, \
             \"13.72.0\", \
             \"6.0\",\
             \"Google Pixel\", \
             \"it_IT\", \
             \"CEST\", \
             \"vodafone IT\", \
             720, \
             1208, \
             \"2.00\", \
             8, \
             10, \
             3, \
             \"Europe/Rome\"]" \
https://graph.facebook.com/<APP_ID>/activities/

Response

The response is true, where the HTTP status code is 200.

  {
  "success": true
}

If you receive an error, retry the request, or see Handling Errors.

Report Conversion and Custom Events to Facebook

You may also choose to register conversion events with Facebook. Admins and developers of the application can see conversion information for organic and paid conversions in their app dashboard. Facebook also surfaces conversions attributed to ads in the advertiser's ads manager.

If you post to /activities with event parameter set to custom_app_events, you must include either advertiser_id or attribution.

API Schema

POST https://graph.facebook.com/{app_id}/activities

Parameters

name description example

event

Conversion event

custom_app_events

advertiser_id

Apple's Advertising Identifier (IDFA) or Android’s advertising ID. See how Facebook fetches this on iOS or on Android.

1111-1111-1111-1111

attribution

Mobile_cookie from the user's device. This is only applicable for Android and below iOS6 devices. Even though we suggest advertiser_id be used. You may choose to use attrbution to associate with app event. See [how](# )

DDDECD0A-C076-4050-8CE8-C20EC3FC2BD3

advertiser_tracking_enabled

A user can enable ad tracking on iOS 6+, and that choice is stored on the phone. You should fetch that and return it to Facebook so we know not to use the data for optimization. We will, however, use the data to report on a conversion. See here for an example of how Facebook fetches that variable. For non-iOS 6+ devices, this query parameter can be defaulted to 1.

0 for disabled or 1 for enabled

application_tracking_enabled

A user can choose to enable ad tracking on an app level. Your SDK should enable app developers to put an opt-out setting in their app. Use this field to specify the user's choice.

0 for disabled or 1 for enabled

bundle_id

Optional. Unique string that identifies your application to the system. See FB-iOS-SDK for an example of how Facebook fetches that variable.

com.companyDomain.appName

bundle_version

Optional. Bundle version is the internal version number of your app. See FB-iOS-SDK for an example of how Facebook fetches that variable.

2.0.0.123

bundle_short_version

Optional. Bundle Short Version is the publically visible version of your app. See FB-iOS-SDK for an example of how Facebook fetches that variable.

2.0

custom_events

Array of events you want to report to Facebook. Please see the list of pre-defined events and applicable parameters of each of them below. You can use your own app events as well. You can specify multiple events in the array.

'[{'_eventName':'fb_mobile_purchase',

'_valueToSum':55.22, // value of individual event

'_logTime':1367017882, // specified in unixtime

'fb_currency':'GBP', // specified in ISO-4217

}]'

extinfo

Information about the device. This parameter must be in a specific format.

See Android

See iOS

App Event Schema

Each app event is a JSON dictionary that:

  • Must have an _eventName entry,
  • Should have _logTime and _appVersion entries,
  • May have a _valueToSum entry described in the table below, and
  • Can have additional parameters recommended in the third column below.

Here are some pre-defined app events you may use:

"_eventName" to use "_valueToSum" Typical Parameters Notes

fb_mobile_level_achieved

fb_level

fb_mobile_activate_app

Use this event in addition to install reporting to exclude users from seeing ads for this app. Do not use this event if you have automatic event logging enabled.

fb_mobile_add_payment_info

fb_success

fb_mobile_add_to_cart

Price of item added

fb_content_type, fb_content_id, fb_content, and fb_currency

fb_mobile_add_to_wishlist

Price of item added

fb_content_type, fb_content_id, fb_content, and fb_currency

fb_mobile_complete_registration

fb_registration_method

fb_mobile_tutorial_completion

fb_success, fb_content_id, and fb_content

fb_mobile_initiated_checkout

Total price of items in cart

fb_content_type, fb_content_id, fb_content, fb_num_items, fb_payment_info_available and fb_currency

fb_mobile_purchase

purchase price

fb_num_items, fb_content_type, fb_content_id, fb_content, and fb_currency

fb_mobile_rate

Rating given

fb_content_type , fb_content_id, fb_content, and fb_max_rating_value

fb_mobile_search

fb_content_type, fb_search_string and fb_success

fb_mobile_spent_credits

Total value of credits spent

fb_content_type, fb_content_id, and fb_content

fb_mobile_achievement_unlocked

fb_description

fb_mobile_content_view

Price of item viewed (if applicable)

fb_content_type, fb_content_id, fb_content, and fb_currency

The table shows useful parameters to include with the events above, or with your own custom events. You can also use your own parameters.

Event Parameter Names Possible Values Description

_logTime

int

Recommend parameter to specify the time of event, specified in unixtime

_valueToSum

float

Numeric value of individual event to be summed in reporting, see above for recommended events to attach to

fb_content_id

string

International Article Number (EAN) when applicable, or other product or content identifier(s). For multiple product ids: e.g. "[\"1234\",\"5678\"]"

fb_content

string

A list of JSON object that contains the International Article Number (EAN) when applicable, or other product or content identifier(s) as well as additional information about the products. id, quantity, and item_price are the available fields. e.g. "[{\"id\": \"1234\", \"quantity\": 2, \"item_price\": 5.99}, {\"id\": \"5678\", \"quantity\": 1, \"item_price\": 9.99}]"

fb_content_type

string

For example music, video, or product description

fb_currency

string

ISO 4217 code, e.g., "EUR", "USD", "JPY". Required when passing _valueToSum as a price or a purchase amount.

fb_description

string

A string description

fb_level

string

Level of a game

fb_max_rating_value

int

Upper bounds of a rating scale, for example 5 on a 5 star scale

fb_num_items

int

Number of items

fb_payment_info_available

'1' or '0'

1 for yes, 0 for no

fb_registration_method

string

Facebook, Email, Twitter, etc.

fb_search_string

string

The text string that was searched for

fb_success

'1' or '0'

1 for yes, 0 for no

API Call Example

curl \
  -F "event=CUSTOM_APP_EVENTS" \
  -F "advertiser_id=1111-1111-1111-1111" \
  -F "advertiser_tracking_enabled=1" \
  -F "application_tracking_enabled=1" \
  -F "custom_events=[{\"_eventName\":\"fb_mobile_purchase\",
                      \"fb_content\":\"[{\"id\": \"1234\", \"quantity\": 2, \"item_price\": 5.99}, {\"id\": \"5678\", \"quantity\": 1, \"item_price\": 9.99}]\",
                      \"fb_content_type\":\"product\",
                      \"_valueToSum\":21.97,
                      \"fb_currency\":\"GBP\",
                    }]" \
  "https://graph.facebook.com/API_VERSION/APP_ID/activities"

The response is be true. If you receive an error, retry the request.

The maximum number of different event names is 1,000. No new event types will be logged once this cap is hit. If you exceed this limit you may see an 100 Invalid parameter error. However you can deactivate old events. Read about event limits in the FAQ.

Extended Device Info (extinfo) Parameter

Android

Index and Name Type and Description Example Value

0 — ext_info_ver

A string for the extended info format version and source indicator. Must be "a2".

"a2"

Code Snippet Example

"a2"
Index and Name Type and Description Example Value

1 — app_pkg_name

A string for the app package name.

"com.some.app"

Code Snippet Example - See Android Reference

appContext.getPackageName();
Index and Name Type and Description Example Value

2 — pkg_ver_code

An integer for the PackageInfo version code.

1

Code Snippet Example - See Android Reference

PackageInfo pi = appContext.getPackageManager().getPackageInfo(pkgName, 0);
versionCode = pi.versionCode;
versionName = pi.versionName;
Index and Name Type and Description Example Value

3 — pkg_info_ver_name

A string for the PackageInfo version name.

"1.0"

Code Snippet Example - See Android Reference

PackageInfo pi = appContext.getPackageManager().getPackageInfo(pkgName, 0);
versionCode = pi.versionCode;
versionName = pi.versionName;
Index and Name Type and Description Example Value

4 — os_ver

A string for the operating system version.

"4.4.4"

Code Snippet Example

Build.VERSION.RELEASE
Index and Name Type and Description Example Value

5 — dev_model_name

A string for the device model name.

"Google Nexus 4"

Code Snippet Example - See Android Reference

Build.MODEL
Index and Name Type and Description Example Value

6 — locale

A string for two letters for the locale language in lowercase, concatenated with '_' and two letters for locale country in uppercase.

“en_US”

Code Snippet Example - See Android Reference

Locale locale;
try {
    locale = appContext.getResources().getConfiguration().locale;
} catch (Exception e) {
    locale = Locale.getDefault();
}
return locale.getLanguage() + "_" + locale.getCountry();
Index and Name Type and Description Example Value

7 — dev_timezone_abv

A string for the device timezone abbreviation. Use the short format in uppercase.

"EDT"

Code Snippet Example - See Android Reference

TimeZone tz = TimeZone.getDefault();
deviceTimezoneAbbreviation = tz.getDisplayName(tz.inDaylightTime(new Date()), TimeZone.SHORT);
deviceTimeZoneName = tz.getID();
Index and Name Type and Description Example Value

8 — carrier_name

A string for the carrier name. If the carrier name is not available, use “NoCarrier”.

"NoCarrier"

Code Snippet Example - See Android Reference

TelephonyManager telephonyManager = ((TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE));
carrierName = telephonyManager.getNetworkOperatorName();
Index and Name Type and Description Example Value

9 — screen_width

An integer for the screen width in pixels.

768 See code snippet example below and Android Reference

10 — screen_height

An integer for the screen height in pixels.

1184 See code snippet example below and Android Reference

11 — screen_density

A float for the screen density in the following format "%.2f". The decimal separator must be a dot.

"2.00" See code snippet example below and Android Reference

Code Snippet Example for index 9, 10, and 11

int width = 0;
int height = 0;
double density = 0;
try {
    WindowManager wm = (WindowManager) appContext.getSystemService(Context.WINDOW_SERVICE);
    if (wm != null) {
        Display display = wm.getDefaultDisplay();
        DisplayMetrics displayMetrics = new DisplayMetrics();
        display.getMetrics(displayMetrics);
        width = displayMetrics.widthPixels;
        height = displayMetrics.heightPixels;
        density = displayMetrics.density;
    }
} catch (Exception e) {
    // Swallow
}
String densityStr = String.format("%.2f", density);
Index and Name Type and Description Example Value

12 — cpu_cores

An integer for the number of CPU cores.

1

Code Snippet Example - See Android Reference

numCPUCores = Math.max(Runtime.getRuntime().availableProcessors(), 1);
Index and Name Type and Description Example Value

13 — ext_storage_size

An integer for the total external storage size in GB.

32 See code snippet example below and Android Reference

14 — avl_storage_size

An integer for the available external storage space in GB.

6 See code snippet example below and Android Reference

Code Snippet Example for index 13 and 14

/**
 * @return whether there is external storage:
 */
private static boolean externalStorageExists() {
    return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
}

// getAvailableBlocks/getBlockSize deprecated but required pre-API v18
@SuppressWarnings("deprecation")
private static void refreshAvailableExternalStorage() {
    try {
        if (externalStorageExists()) {
            File path = Environment.getExternalStorageDirectory();
            StatFs stat = new StatFs(path.getPath());
            availableExternalStorageGB =
                    (long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
        }
        availableExternalStorageGB =
                Utility.convertBytesToGB(availableExternalStorageGB);
    } catch (Exception e) {
        // Swallow
    }
}

// getAvailableBlocks/getBlockSize deprecated but required pre-API v18
@SuppressWarnings("deprecation")
private static void refreshTotalExternalStorage() {
    try {
        if (externalStorageExists()) {
            File path = Environment.getExternalStorageDirectory();
            StatFs stat = new StatFs(path.getPath());
            totalExternalStorageGB = (long)stat.getBlockCount() * (long)stat.getBlockSize();
        }
        totalExternalStorageGB = Utility.convertBytesToGB(totalExternalStorageGB);
    } catch (Exception e) {
        // Swallow
    }
}

private static long convertBytesToGB(double bytes) {
    return Math.round(bytes / (1024.0 * 1024.0 * 1024.0));
}
Index and Name Type and Description Example Value

15 — dev_timezone

A string for the device timezone.

"America/Los_Angeles"

Code Snippet Example - See Android Reference

TimeZone tz = TimeZone.getDefault();
deviceTimezoneAbbreviation = tz.getDisplayName(tz.inDaylightTime(new Date()), TimeZone.SHORT);
deviceTimeZoneName = tz.getID();

iOS

The following are the values for this parameter. All comma-separated values are required and must be in the order shown.

Index and Name Type and Description Example Value

0 — ext_info_ver

A string for the extended info format version and source indicator. Must be "i2".

"i2"

Code Snippet Example

"i2"
Index and Name Type and Description Example Value

1 — app_pkg_name

A string for the app package name.

"com.some.app"

Code Snippet Example - See iOS Reference

aNSBundle *mainBundle = [NSBundle mainBundle];
return mainBundle.bundleIdentifier;
Index and Name Type and Description Example Value

2 — pkg_ver_code

An string for the Bundle Version.

771

Code Snippet Example - See iOS Reference

[mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
Index and Name Type and Description Example Value

3 — pkg_info_ver_name

A string for the Short App version.

"Version 7.7.1"

Code Snippet Example - See iOS Reference

[mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
Index and Name Type and Description Example Value

4 — os_ver

A string for the operating system version.

"10.1.1"

Code Snippet Example - See iOS Reference

UIDevice *device = [UIDevice currentDevice];
return device.systemVersion;
Index and Name Type and Description Example Value

5 — dev_model_name

A string for the device model name.

"iPhone6,1"

Code Snippet Example - See iOS Reference

struct utsname systemInfo;uname(&systemInfo);
return @(systemInfo.machine);
Index and Name Type and Description Example Value

6 — locale

A string for two letters for the locale language in lowercase, concatenated with '_' and two letters for locale country in uppercase.

“ru_RU”

Code Snippet Example - See iOS Reference

[[NSLocale currentLocale] localeIdentifier];
Index and Name Type and Description Example Value

7 — dev_timezone_abv

A string for the device timezone abbreviation. Use the short format in uppercase.

"GMT+3"

Code Snippet Example - See iOS Reference

NSTimeZone *timeZone = [NSTimeZone systemTimeZone];
return timeZone.abbreviation;
Index and Name Type and Description Example Value

8 — carrier_name

A string for the carrier name. If the carrier name is not available, use “NoCarrier”.

"Beeline"

Code Snippet Example - See iOS Reference

CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfoClass alloc] init];CTCarrier *carrier = [networkInfo subscriberCellularProvider];
return [carrier carrierName] ?: @"NoCarrier";
Index and Name Type and Description Example Value

9 — screen_width

An integer for the screen width in pixels.

320 See code snippet example below and iOS Reference

10 — screen_height

An integer for the screen height in pixels.

568 See code snippet example below and iOS Reference

11 — screen_density

A float for the screen density in the following format "%.2f". The decimal separator must be a dot.

"2.00" See code snippet example below and iOS Reference

Code Snippet Example for index 9, 10, and 11

UIScreen *sc = [UIScreen mainScreen];
CGRect sr = sc.bounds;
_width = (unsigned long)sr.size.width;
_height = (unsigned long)sr.size.height;
NSString *densityString = sc.scale ? [NSString stringWithFormat:@"%.02f", sc.scale] : @"";
Index and Name Type and Description Example Value

12 — cpu_cores

An integer for the number of CPU cores.

2

Code Snippet Example - See iOS Reference

#define FB_ARRAY_COUNT(x) sizeof(x) / sizeof(x[0])

+ (uint)_coreCount
{
  return [DeviceInfoObject _readSysCtlUInt:CTL_HW type:HW_AVAILCPU];
}

+ (uint)_readSysCtlUInt:(int)ctl type:(int)type
{
  int mib[2] = {ctl, type};
  uint value;
  size_t size = sizeof value;
  if (0 != sysctl(mib, FB_ARRAY_COUNT(mib), &value, &size, NULL, 0)) {
    return 0;
  }
  return value;
}
Index and Name Type and Description Example Value

13 — ext_storage_size

An integer for the total external storage size in GB.

13 See code snippet example below and iOS Reference

14 — avl_storage_size

An integer for the available external storage space in GB.

8 See code snippet example below and iOS Reference

Code Snippet Example for index 13 and 14

static const u_int FB_GIGABYTE = 1024 * 1024 * 1024;  // bytes

+ (NSNumber *)_getTotalDiskSpace
{
  NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
                                                                              error:nil];
  return [attrs objectForKey:NSFileSystemSize];
}

+ (NSNumber *)_getRemainingDiskSpace
{
  NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
                                                                              error:nil];
  return [attrs objectForKey:NSFileSystemFreeSize];
}


// Total disk space
float totalDiskSpace = [[DeviceInfoObject _getTotalDiskSpace] floatValue];
_totalDiskSpaceGB = (unsigned long long)round(totalDiskSpace / FB_GIGABYTE);

// Remaining disk space
float remainingDiskSpace = [[FBSDKAppEventsDeviceInfo _getRemainingDiskSpace] floatValue];
_remainingDiskSpaceGB = (unsigned long long)round(remainingDiskSpace / FB_GIGABYTE);
Index and Name Type and Description Example Value

15 — dev_timezone

A string for the device timezone.

"Europe/Moscow"

Code Snippet Example - See iOS Reference

NSTimeZone *timeZone = [NSTimeZone systemTimeZone];
return timeZone.name;

Testing

App Event Testing, App Install

The purpose of this testing is to make sure Facebook servers are receiving your install ping.

To test for this: Step 1: Run the app you want to track in a situation where the pingback code is called. Step 2: Verify that your own servers received the attribution_id from the client. Step 3: Check the app details page to verify that the Facebook servers received the ping.

Step 4: Check the "Last Mobile Install Reported" field. This field doesn't appear if no install ping has ever been received, and there is a ~20-minute delay.

Install End-to-End Testing

The purpose of this test is to check that the entire flow from ad serving to app install is working properly.

Step 1: Set up a test app profile on Facebook. You can choose an arbitrary iTunes App Store ID if you don't have one to use. See tutorial. Step 2: Create an ad for this test app, using custom audiences to limit the targeting. Bid high to increase the chance of the ad being served to you. Step 3: Launch the Facebook app, find this Facebook Install Ad and click it. Note: This is not immediate, as the ad is subject to ad auctions. Step 4: Instead of installing the app, close the store and start your test build. Make sure your simulator or test device has the Facebook app installed and the user is logged in. Step 5: The start of the test build sends the attribution ID to your servers. Step 6: Your server receives the attribution ID and recognizes that it came from FB App ID 12345. This can be done by having the advertiser fill in the FB App ID on a form on your website. Step 7: Your server sends the attribution ID, FB tracked app ID and FB analytics app ID to the FB servers.

POST https://graph.facebook.com/<tracked_app_id>/activities?access_token=<analytics_app_id>|<rest_of_token>&amp;event=MOBILE_APP_INSTALL&amp;attribution={attributionID}

Step 8: Verify the response is is_fb:true and your servers are able to parse the JSON.

Attribution

When using this endpoint, Facebook returns to you installs and conversions based on clicks that happened on an ad within 28 days. This is different than the insights clients see in Ads Manager. Within Ads Manager, Facebook uses a 1-day view through and 28-day click-through attribution model. Additionally, on Ads Manager, insights are surfaced based on impression or click time, not install or conversion time. This is important when comparing your reporting to Facebook Ads Manager reports. In addition to the standard ad click app event claims, you should also keep the following scenarios in mind:

View-Through Attribution Claims

When sending app install requests, you can add a flag to retrieve view-through attribution claims. Setting consider_views=TRUE returns attribution data for installs that occurred within 1 day of an ad impression, provided the person did not click on an ad within 28 days.

In the response from our endpoint, we return is_view_through=TRUE and view_time replaces click_time. All other attributions are the same as with ad click attribution data.

Cross-Campaign Claims

Advertisers are able to track the performance of all ads that have lead to an app event, regardless of the ad objective. We send claims for app events coming from ads where the campaign objective is not set to mobile app install or mobile app engagement, provided the ad set has the app event in the tracking spec. We only surface this data if the advertiser has added the app to “Mobile App Events Tracking” field in their ad.

Use Case

If your client wants to track the installs generated by a page post ad or a website clicks ad that sends users to a mobile site they can do this in ads manager and we will claim the relevant app installs.

Cross-Device Claims

Advertisers with apps that are cross platform can now see data for app installs being driven cross-device through their ads.

Use case

A user clicks an iPhone ad for an app and then installs the same app on their iPad. We can then attribute the iPad app installation to the iPhone ad regardless of the ad targeting.

Discrepancies

In the event a client compares a mobile measurement partner's reports with Facebook reports and sees discrepancies, here are some items to check:

If Facebook is reporting fewer installs than MMP:

  • Is the FB SDK integrated properly?
  • Is the client using the wrong app ID?

If Facebook is reporting more installs than MMP:

  • Are the attribution windows the same? Facebook generally has a larger attribution window than most mobile measurement partners.
  • Is the MMP SDK integrated properly?
  • Is the client using the wrong app ID?
  • Is the discrepancy iOS7 only? Is the MMP receiving Apple's Advertising Identifier (IDFA) from the device and passing it properly to FB?