Preview your ad's creative.
We recently announced an initiative to make the Facebook Advertising platform more transparent to Facebook users. Read more about this in the Facebook press release
To support this initiative, we are deprecating deprecating Event Ads and Link Ads that are not connected to a valid page from Marketing API.
This breaking change impacts all supported API versions, including the upcoming Marketing API version v2.11, and v2.10 and v2.9 which are available but will be deprecated. This breaking change will take effect the second week of November 2017.
You will no longer be able to create or edit Event Ads and Link Ads that are not connected to a valid page. Requests will do so return the error:ErrorCode::ADPRO2__AD_MUST_HAVE_PAGE (1885833)
The following ad options used together will fail:
EVENT_RESPONSES
body
, object_id
LINK_CLICKS
title
, body
, object_url
containing image_file
or image_hash
You can still create Event Ads and Link Ads if you provide a valid actor_id
in the ad creative's object_story_id
or object_story_spec
fields
These options used together are valid:
EVENT_RESPONSES
object_story_id
or object_story_spec
LINK_CLICKS
object_story_id
or object_story_spec
The nodes, edges and requests impacted are:
Any pre-existing Event or Link Ads continue to run but you cannnot modify these ad's creatives or create new ads with the invalid options once the change goes in effect.
The HTML Snippets for previewing this creative
When using a Page Post whose link points to an app on the Google Play Store e.g. (https://play.google.com/store/apps/details?id=com.my.app) or an app on the Apple App Store eg (https://itunes.apple.com/en/app/myapp/id1234567890) Facebook will override/import the following fields:
the name
parameter of the Page Post will be overwritten with the name of the app from the Play Store/App Store.
the thumbnail icon of the app associated with the Page Post will be imported from the Play Store/App Store.
Only certain combinations of creatives and ad_format
are supported:
Create an ad preview of an existing ad creative
use FacebookAds\Object\AdCreative;
$creative = new AdCreative(<CREATIVE_ID>);
$creative->getPreviews(array(), array(
AdPreviewFields::AD_FORMAT => AdPreviewAdFormatValues::DESKTOP_FEED_STANDARD,
));
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adpreview import AdPreview
creative = AdCreative(<CREATIVE_ID>)
params = {
'ad_format': AdPreview.AdFormat.desktop_feed_standard,
}
ad_preview = creative.get_previews(params=params)
print(ad_preview)
APINodeList<AdPreview> adPreviews = new AdCreative(<CREATIVE_ID>, context).getPreviews()
.setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD)
.execute();
curl -G \
-d 'ad_format=DESKTOP_FEED_STANDARD' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/<CREATIVE_ID>/previews
GET /v21.0/<CREATIVE_ID>/previews?ad_format=DESKTOP_FEED_STANDARD&product_item_ids=%5B%22%3CPRODUCT_ITEM_ID%3E%22%5D HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/<CREATIVE_ID>/previews?ad_format=DESKTOP_FEED_STANDARD&product_item_ids=%5B%22%3CPRODUCT_ITEM_ID%3E%22%5D',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/<CREATIVE_ID>/previews",
{
"ad_format": "DESKTOP_FEED_STANDARD",
"product_item_ids": "[\"<PRODUCT_ITEM_ID>\"]"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("ad_format", "DESKTOP_FEED_STANDARD");
params.putString("product_item_ids", "[\"<PRODUCT_ITEM_ID>\"]");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/<CREATIVE_ID>/previews",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"ad_format": @"DESKTOP_FEED_STANDARD",
@"product_item_ids": @"[\"<PRODUCT_ITEM_ID>\"]",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/<CREATIVE_ID>/previews"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
curl -X GET -G \
-d 'ad_format="DESKTOP_FEED_STANDARD"' \
-d 'product_item_ids=[
"<PRODUCT_ITEM_ID>"
]' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<CREATIVE_ID>/previews
參數 | 說明 |
---|---|
ad_format enum{AUDIENCE_NETWORK_INSTREAM_VIDEO, AUDIENCE_NETWORK_INSTREAM_VIDEO_MOBILE, AUDIENCE_NETWORK_OUTSTREAM_VIDEO, AUDIENCE_NETWORK_REWARDED_VIDEO, BIZ_DISCO_FEED_MOBILE, DESKTOP_FEED_STANDARD, FACEBOOK_PROFILE_FEED_DESKTOP, FACEBOOK_PROFILE_FEED_MOBILE, FACEBOOK_PROFILE_REELS_MOBILE, FACEBOOK_REELS_BANNER, FACEBOOK_REELS_BANNER_DESKTOP, FACEBOOK_REELS_MOBILE, FACEBOOK_REELS_POSTLOOP, FACEBOOK_REELS_STICKER, FACEBOOK_STORY_MOBILE, FACEBOOK_STORY_STICKER_MOBILE, INSTAGRAM_EXPLORE_CONTEXTUAL, INSTAGRAM_EXPLORE_GRID_HOME, INSTAGRAM_EXPLORE_IMMERSIVE, INSTAGRAM_FEED_WEB, INSTAGRAM_FEED_WEB_M_SITE, INSTAGRAM_LEAD_GEN_MULTI_SUBMIT_ADS, INSTAGRAM_PROFILE_FEED, INSTAGRAM_PROFILE_REELS, INSTAGRAM_REELS, INSTAGRAM_REELS_OVERLAY, INSTAGRAM_SEARCH_CHAIN, INSTAGRAM_SEARCH_GRID, INSTAGRAM_STANDARD, INSTAGRAM_STORY, INSTAGRAM_STORY_EFFECT_TRAY, INSTAGRAM_STORY_WEB, INSTAGRAM_STORY_WEB_M_SITE, INSTANT_ARTICLE_RECIRCULATION_AD, INSTANT_ARTICLE_STANDARD, INSTREAM_BANNER_DESKTOP, INSTREAM_BANNER_FULLSCREEN_MOBILE, INSTREAM_BANNER_IMMERSIVE_MOBILE, INSTREAM_BANNER_MOBILE, INSTREAM_VIDEO_DESKTOP, INSTREAM_VIDEO_FULLSCREEN_IOS, INSTREAM_VIDEO_FULLSCREEN_MOBILE, INSTREAM_VIDEO_IMAGE, INSTREAM_VIDEO_IMMERSIVE_MOBILE, INSTREAM_VIDEO_MOBILE, JOB_BROWSER_DESKTOP, JOB_BROWSER_MOBILE, MARKETPLACE_MOBILE, MESSENGER_MOBILE_INBOX_MEDIA, MESSENGER_MOBILE_STORY_MEDIA, MOBILE_BANNER, MOBILE_FEED_BASIC, MOBILE_FEED_STANDARD, MOBILE_FULLWIDTH, MOBILE_INTERSTITIAL, MOBILE_MEDIUM_RECTANGLE, MOBILE_NATIVE, RIGHT_COLUMN_STANDARD, SUGGESTED_VIDEO_DESKTOP, SUGGESTED_VIDEO_FULLSCREEN_MOBILE, SUGGESTED_VIDEO_IMMERSIVE_MOBILE, SUGGESTED_VIDEO_MOBILE, WATCH_FEED_HOME, WATCH_FEED_MOBILE} | Use this to select what placement on Facebook the ad preview should be for. The API returns an iframe, which is only valid for 24 hours. 必填 |
creative_feature enum{product_metadata_automation, profile_card, standard_enhancements_catalog} | Creative feature to see previews for |
dynamic_asset_label string | Provide a label for rendering specific variation of an asset customization ad |
dynamic_creative_spec Object | Dynamic creative spec for dynamic ads. 支援表情符號 |
dynamic_customization Object | For dynamic ads in multiple languages, specify the customization to be applied to the ad |
end_date datetime | Provide an end date for trip.* parameters in the creative |
height int64 | Custom height of the resulting iframe, recommended at least 280 x 280 for the large right hand size height. |
place_page_id Page ID | Place page ID to use when rendering a dynamic local ad preview |
post Object | Specs for a page post. This field is used when the creative field contains only a Page id as |
product_item_ids list<string> | A list of Product Item IDs to use when rendering a dynamic ad preview. |
start_date datetime | Provide a start date for trip.* parameters in the creative |
width int64 | Custom width of the resulting iframe, recommended at least 280 x 280 for the large right hand size widths. |
由此關係連線進行的閱讀將回傳 JSON 格式結果:
{ "
data
": [], "paging
": {} }
data
paging
錯誤 | 說明 |
---|---|
80004 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management. |
100 | Invalid parameter |
200 | Permissions error |
270 | This Ads API request is not allowed for apps with development access level (Development access is by default for all apps, please request for upgrade). Make sure that the access token belongs to a user that is both admin of the app and admin of the ad account |
190 | Invalid OAuth 2.0 Access Token |