Back to News for Developers

Cross Device

August 21, 2014ByElad Kolet

Last week we launched cross-device reporting for Facebook ads. See the full announcement blog post here.

In this blog post we will discuss the required steps to measure actions across devices and to generate a full cross device report.

The following steps are required to measure actions off-Facebook and across devices, measure those actions in adgroups and generate a full cross device report.

1. Measure actions off-Facebook

In order to measure and understand the impact of your Facebook ads on conversions and Off-Facebook actions, across devices, you should integrate the Facebook conversion pixel in your desktop and mobile websites and the Facebook SDK in your native iOS and Android apps.

Facebook Conversion pixel should be placed on significant pages on your mobile and desktop web pages. You should also integrate the Facebook mobile SDK in your iOS and Android native apps, to measure mobile app installs and in-app actions (app events).

2. Verify that off-Facebook actions are reported to Facebook

Once you have placed the conversion pixel(s) on your mobile and desktop websites and integrated the Facebook SDK in your native mobile apps, make sure that Facebook gets the data correctly.

Use the Facebook Tag Helper to verify that the conversion pixels fire properly. Use the App insights to verify that mobile app installs and mobile app events are reported to Facebook correctly.

3. Measure off-Facebook actions in your adgroups

Once the Facebook conversion pixel(s) and the Facebook SDK are implemented and verified, you should make sure that you measure those actions in your adgroups.

Every adgroup has two fields that determine the actions that are being measured: conversion_spec and tracking_spec. conversion_spec is used for specifying the conversion event for oCPM and CPA bidding while tracking_spec is used to specify actions to measure for any type of ad.

Make sure to measure all of your conversion pixels, mobile app install and mobile app events by updating the tracking_spec for every adgroup, regardless of the ad's objective.

For example - make the following request to update the tracking_spec of adgroup 4444. In this example the tracking_spec measures two conversion pixels (with IDs 1111 and 2222), mobile app installs (for app ID 1234) and mobile app events (for app ID 1234):

curl \
-F "tracking_spec=[{'action.type':['mobile_app_install'],'application':[1234]} ,{'action.type':['app_custom_event'],'application':[1234]},{'action.type': 'offsite_conversion', 'offsite_pixel': '2222'},{'action.type': 'offsite_conversion', 'offsite_pixel': '1111'}]" \ 
-F "access_token=_____" \
"https://graph.facebook.com/4444"

You can also use the Facebook Ads API SDK for PHP to update the tracking_spec:

use FacebookAds\Object\AdGroup;
use FacebookAds\Object\Fields\AdGroupFields;

$group = new AdGroup(4444);
$group->{AdGroupFields::TRACKING_SPECS} = array(
array(
'action.type' => array('mobile_app_install'),
'application' => array(1234),
),
array(
'action.type' => array('app_custom_event'),
'application' => array(1234),
),
array(
'action.type' => 'offsite_conversion',
'offsite_pixel' => '2222',
),
array(
'action.type' => 'offsite_conversion',
'offsite_pixel' => '1111',
),
);

$group->update();

4. Generate cross device reports using ad report stats API

The Ad Report stats API now supports in retrieving the ads placement - placement data field, the impression/click device type - impression_device data field and the device type on which the off-Facebook actions happened - action_device data breakdown column.

The impression_device and action_device fields will be one of the following device types: desktop, iPhone, iPad, iPod, Android_tablet, Android_smartphone and Unknown.

Make the following call to generate a report that contains the fields that are mentioned above:

curl -G \
-d "date_preset=last_7_days" \
-d "data_columns=['account_id','actions','impressions','placement','impression_device']" \
-d "actions_group_by=['action_type','action_device']" \
-d "access_token=___" \
https://graph.facebook.com/act_5555/reportstats

The response will be in the following format:

{
"data": [
{
"account_id": "1234",
"placement": "desktop_feed",
"impression_device": "desktop",
"date_start": "2014-06-29",
"date_stop": "2014-06-29",
"actions": [
{
"action_type": "offsite_conversion.registration",
"action_device": "desktop",
"value": 24424
},
{
"action_type": "offsite_conversion.registration",
"action_device": "android_phone",
"value": 1
},
{
"action_type": "offsite_conversion.registration",
"action_device": "android_tablet",
"value": 3
},
{
"action_type": "offsite_conversion",
"action_device": "desktop",
"value": 24424
},
. . .
]}
. . .
]}

You can also use the Facebook Ads API SDK for PHP to generate the cross device reports:

use FacebookAds\Object\AdAccount;

$account = new AdAccount('act_5555');

$stats = $account->getReportsStats(array(), array(
'date_preset' => 'last_7_days',
'data_columns' => array(
'account_id',
'actions',
'impressions',
'placement',
'impression_device',
),
'actions_group_by' => array(
'action_type',
'action_device',
),
));


Tags: