Back to News for Developers

Facebook and Instagram - making your images work for both

January 27, 2016ByJay Yan

Related Topics

When you run an ad campaign with Facebook, you can choose different placements where your ad gets placed. Your choices of placements are Facebook (Facebook Mobile News Feed, Facebook Desktop News Feed, etc.) or Instagram, or both. We recommend you run ads on both Facebook and Instagram, which is known as "mixed placement", so our system can optimize the spend across platforms based on your ad's goal.

In the past if you had an ad set with both Instagram and Facebook placements selected, you could have problems because same creative would be used for both Instagram and Facebook. Although Facebook and Instagram honor different crop specs, you have to use the same image as the base.

Now, the new "Creative and Platform Flexibility" solves this problem. When you create an ad creative for mixed placement ad sets, you can create it with a new platform_customizations field that overrides the image for Instagram.

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\ObjectStory\LinkData;
use FacebookAds\Object\Fields\ObjectStory\LinkDataFields;
use FacebookAds\Object\ObjectStorySpec;
use FacebookAds\Object\Fields\ObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;

$link_data = new LinkData();
$link_data->setData(array(
LinkDataFields::MESSAGE => 'Fresh produce from your local market. #GoJasper',
LinkDataFields::LINK => 'http://example.com',
LinkDataFields::IMAGE_HASH => '<FB_FRIENDLY_IMAGE>',
LinkDataFields::NAME => 'Remodeled!',
LinkDataFields::DESCRIPTION => 'The store is just remodeled. Come to visit us.',
LinkDataFields::CAPTION => 'www.example.com',
LinkDataFields::CALL_TO_ACTION => array(
'type' => 'LEARN_MORE',
'value' =>array(
'link' => 'http://example.com',
)
),
));

$object_story_spec = new ObjectStorySpec();
$object_story_spec->setData(array(
ObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
ObjectStorySpecFields::INSTAGRAM_ACTOR_ID => <IG_ACCOUNT_FBID>,
ObjectStorySpecFields::LINK_DATA => $link_data,
));

$platform_customizations = array(
'instagram' => array(
'image_url' => '<IG_FRIENDLY_IMAGE>', 
'image_crops' => array(
'100x100'=> array(array(0,0),array(800,800))
),
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');

$creative->setData(array(
AdCreativeFields::NAME => 'A creative with two images',
AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
'platform_customizations' => $platform_customizations,
));

$creative->create();
from facebookads.objects import AdCreative
from facebookads.specs import ObjectStorySpec, LinkData

link_data = LinkData()
link_data[LinkData.Field.message] = 'Fresh produce from your local market. #GoJasper'
link_data[LinkData.Field.link] = 'http://example.com'
link_data[LinkData.Field.image_hash] = '<FB_FRIENDLY_IMAGE>'
link_data[LinkData.Field.name] = 'Remodeled!'
link_data[LinkData.Field.description] = 'The store is just remodeled. Come to visit us.'
link_data[LinkData.Field.caption] = 'www.example.com'

call_to_action = {
'type': 'LEARN_MORE',
}
call_to_action['value'] = {
'link':'http://example.com',
}

link_data[LinkData.Field.call_to_action] = call_to_action

object_story_spec = ObjectStorySpec()
object_story_spec[ObjectStorySpec.Field.page_id] = <PAGE_ID>
object_story_spec[ObjectStorySpec.Field.instagram_actor_id] = <IG_ACCOUNT_FBID>
object_story_spec[ObjectStorySpec.Field.link_data] = link_data

platform_customizations = {
'instagram': {
'image_url': '<IG_FRIENDLY_IMAGE>',
'image_crops': {'100x100':[[0,0],[800,800]],}
}
}

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'A creative with two images'
creative[AdCreative.Field.object_story_spec] = object_story_spec
creative['platform_customizations'] = platform_customizations
creative.remote_create()
curl \
-F 'name=Two image creative' \
-F 'object_story_spec={
"page_id":<PAGE_ID>,
"instagram_actor_id":<IG_ACCOUNT_ID>,
"link_data":{
"call_to_action":{
"type":"LEARN_MORE",
"value":{
"link":"http://example.com",
}},
"image_hash":"<FB_FRIENDLY_IMAGE>",
"link":"http://example.com",
"message":"Fresh produce from your local market. #GoJasper",
"name":"Remodeled!",
"description":"The store is just remodeled. Come to visit us.",
"caption":"www.example.com",
}}' \
-F 'platform_customizations={
"instagram": {
"image_url": "<IG_FRIENDLY_IMAGE>",
"image_crops": {"100x100": [[0, 0],[800, 800]]}
},
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.5/act_<AD_ACCOUNT_ID>/adcreatives

The same creative shows different images on Facebook and Instagram. Also, you may notice that there are a few fields which only show on Facebook, including name, description, and caption.

FAQ:

Q: Can I use the platform_customizations to override the image used by Facebook?

A: No. You can only use platform_customizations to override Instagram currently.

Q: If I specify an image for Instagram in platform_customizations, but no extra image crop spec is given, will the 100x100 image spec of the link_data be used with the image?

A: No. If you do not provide an image crop spec in the customization, the image will be used as it is, and it has be between 1:1 to 1.91:1. The 100x100 image spec outside of platform_customizations would be ignored.

Q: Can I have separate videos on Facebook and Instagram?

A: No. This feature only supports image override on Instagram currently.

Q: Can I have different text messages on Facebook and Instagram?

A: No. This feature only supports image override on Instagram currently.

Q: If I am using a link_data with 100x100 image crop spec and a platform_customizations for Instagram, which one will be used?

A: If the customization for Instagram is specified, it will be used.

Q: Can I use platform_customizations along with a photo_data, instead of link_data?

A: Yes, you can.

Q: Can I use platform_customizations along with an object_story_id pointing to an existing Facebook post?

A: Yes, you can. In this case, the image in the post would be used for Facebook ads, while the customization image will be used for Instagram.

Q: How do I get metrics on different images used?

A: You can use the placement breakdown on Insights which shows Instagram vs. Facebook placements. Since you know it will be one image for Instagram and one for Facebook, you can use that as a proxy for stats on the images.

Q: Which image will be shown with ad preview if platform_customizations for Instagram is given?

A: That will depend on the ad_format. If you specify INSTAGRAM_STANDARD, you will see the image in platform_customizations.


Tags: