Use this solution to define which creative assets you want to display in your ads. At the time of ad creation, you can pick the combination of assets you want to display, based on your asset custom rules. Examples of creative assets are images, videos, text and body of an ad.
We offer three APIs that use asset customization rules:
All ads using asset_feed_spec
must contain at least two target customization rules. If your creative uses asset_feed_spec
and includes less than two rules, you will not be able to create that ad.
You can create a standard ad campaign for Asset Custom Rules, but there are limitations:
API | Supported campaign objectives |
---|---|
Segment Asset Customization |
|
Placement Asset Customization |
|
Multi-Language Ads |
|
For the Ad Set, use the standard ad set endpoint and set is_dynamic_creative
to false
.
To create an ad set in a campaign with optimization_goal
set to conversions
:
curl \
-F 'status=PAUSED'
-F 'name=Sample Ad Set'
-F 'campaign_id=<CAMPAIGN_ID>'
-F 'optimization_goal=OFFSITE_CONVERSIONS'
-F 'is_dynamic_creative=false'
-F 'lifetime_budget=1000'
-F 'promoted_object={"pixel_id": "<PIXEL_ID>", "custom_event_type": "PURCHASE"}'
-F 'billing_event=IMPRESSIONS'
-F 'bid_strategy=LOWEST_COST_WITHOUT_CAP'
-F 'targeting={"geo_locations": {"countries": ["US"]}}'
-F 'start_time=2019-04-02'
-F 'end_time=2019-04-09'
-F 'access_token=<ACCESS_TOKEN>'
https://graph.facebook.com/v21.0
/act_<AD_ACCOUNT_ID>/adsets
If you use asset_feed_spec
with an ad set optimized for APP_INSTALLS
, you should specify link_url
, such as http://www.abc.com
. The link_url
should be the same as object_store_url
in promoted_object
. You should provide only one link_url
parameter in asset_feed_spec
.
asset_feed_spec
provides creative for Dynamic Creative, Placement Asset Customization, Multi-Language Ads, and Segment Asset Customization. The spec's format is different for each solution.
Provide your creative through asset_feed_spec
. An asset feed is a collection of different creative elements, such as image, titles, bodies, and so on. You can specify multiple creative assets for each asset type.
Create an asset_feed_spec
at /adcreative
. To apply customization options, set asset_customization_rules
inside your asset_feed_spec
.
After setup, verify your asset_feed_spec
:
curl -G
-d "access_token=<ACCESS_TOKEN>"
-d "fields=asset_feed_spec"
https://graph.facebook.com/v21.0
/<AD_CREATIVE_ID>
When you create your ad, provide a reference to the creative ID. You can create multiple ads per ad set.
curl
-F 'name=Asset Custom Rule Ad'
-F 'adset_id=<ADSET_ID>'
-F 'access_token=<ACCESS_TOKEN>'
-F 'creative={
"creative_id": <CREATIVE_ID>,
}'
https://graph.facebook.com/v21.0
/act_<AD_ACCOUNT_ID>/ads
After creation: