The asset_feed_spec
field allows you to deliver different combinations of an ad's creative to different users. There are two ways to set up your combinations:
The asset feed spec contains a collection of different creative elements, such as images, titles, bodies, and so on. You can specify multiple creative assets for each asset type. The spec's format is different for each use case. See also Reference, Asset Feed Spec.
You can use asset_feed_spec
to provide multiple creative assets, with the following limitations:
asset_feed_spec
. asset_feed_spec
should not have customization rules. In this case, you can mix both images and videos across different placements by specifying [“AUTOMATIC_FORMAT”]
under ad_formats
.For example, to create an asset_feed_spec
for Dynamic Creative:
curl -X POST \
-F 'name="Dynamic Ad Creative with Asset Feed Spec Sample"' \
-F 'object_story_spec={
"page_id": "<PAGE_ID>"
}' \
-F 'asset_feed_spec={
"images": [
{
"hash": "<IMAGE_HASH>"
}
],
"bodies": [
{
"text": "Begin Your Adventure"
},
{
"text": "Once a Trainer, always a Trainer."
}
],
"titles": [
{
"text": "Level Up"
},
{
"text": "Swipe to evolve"
}
],
"descriptions": [
{
"text": "First Dynamic Ad Creative Sample"
}
],
"ad_formats": [
"SINGLE_IMAGE"
],
"call_to_action_types": [
"SHOP_NOW"
],
"link_urls": [
{
"website_url": "https://www.example.com/"
}
],
"videos": []
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0
/act_<AD_ACCOUNT_ID>/adcreatives
You can also create an asset_feed_spec
with two alternate videos, bodies, and titles:
curl \ -F 'object_story_spec={ "page_id": "YOUR_PAGE_ID" "instagram_actor_id" : "INSTAGRAM_ACTOR_ID", }' \ -F "asset_feed_spec={'videos': [{'video_id':'2053108854721025', 'thumbnail_url':'<thumnail_url>', 'url_tags':'video=video1'},{'video_id':'2104406249780616', 'thumbnail_url':'<thumnail_url>','url_tags':'video=video2'}], 'bodies': [{'text':'Begin Your Adventure'}, {'text':'Once a Trainer, always a Trainer.'}], 'titles': [{'text':'Level Up'}, {'text':'Swipe to evolve'}], 'descriptions': [{'text':'Begin Your Adventure'}], 'ad_formats': ['SINGLE_IMAGE'], 'link_urls': [{'website_url':'<WEBSITE_URL>'}]}" \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adcreatives
To check your creative, read asset_feed_spec
:
curl -X GET \
-d 'fields="asset_feed_spec"' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<CREATIVE_ID>/
If you have a Dynamic Creative feed with multiple images and bodies, the response looks like this:
{ "asset_feed_spec":{ "images":[ { "url_tags":"image=image1", "hash":"785095162a2034666e0d0cc4ea1faf89" }, { "url_tags":"image=image2", "hash":"3a24122c13923569599be35567ce4e9e" } ], "bodies":[ { "text":"Begin Your Adventure" }, { "text":"Once a Trainer, always a Trainer." } ], "call_to_action_types":[ "LEARN_MORE" ], "call_to_actions":[ { "type":"LEARN_MORE" } ], "descriptions":[ { "text":"Begin Your Adventure" } ], "link_urls":[ { "website_url":"<WEBSITE_URL>" } ], "titles":[ { "text":"Swipe to evolve" }, { "text":"Level Up" } ], "ad_formats":[ "SINGLE_IMAGE" ], "optimization_type":"REGULAR" }, "id":"<AD_CREATIVE_ID>", }
If you have a Dynamic Creative feed with multiple videos, bodies, and titles, the response looks like this:
{ "asset_feed_spec":{ "videos":[ { "url_tags":"video=video1", "video_id":"2053108854721025", "thumbnail_url":"<thumnail_url>", "thumbnail_hash":"<thumnail_hash>" }, { "url_tags":"video=video2", "video_id":"2104406249780616", "thumbnail_url":"<thumnail_url>", "thumbnail_hash":"<thumnail_hash>" } ], "bodies":[ { "text":"Begin Your Adventure" }, { "text":"Once a Trainer, always a Trainer." } ], "call_to_action_types":[ "LEARN_MORE" ], "call_to_actions":[ { "type":"LEARN_MORE" } ], "descriptions":[ { "text":"Begin Your Adventure" } ], "link_urls":[ { "website_url":"<WEBSITE_URL>" } ], "titles":[ { "text":"Swipe to evolve" }, { "text":"Level Up" } ], "ad_formats":[ "SINGLE_VIDEO" ], "optimization_type":"REGULAR" }, "id":"<AD_CREATIVE_ID>", }
You can add, replace or remove any of the creative's assets. To do so, provide another creative with the new asset_feed_spec
.
You can:
You cannot:
SINGLE IMAGE
to VIDEO
.asset_feed_spec
.
curl \
-F 'access_token=<ACCESS_TOKEN>' \
-F 'creative={
"creative_id": <CREATIVE_ID>,
}' \
https://graph.facebook.com/v21.0
/<AD_ID>
When you create a new ad creative to replace an old one, you must still fulfill all restrictions that apply.