您可以使用带有广告或广告创意编号的格式选项来预览现有广告。有关 ad_format
,您可以使用以下选项:
格式 | 描述 |
---|---|
| Instagram 探索页面的动态格式。详细了解 Instagram 探索页面中的广告。 |
| Instagram 探索页面的视频格式。详细了解 Instagram 探索页面中的广告。 |
| Instagram Reels 版位。 |
| Instagram 动态帖子格式。 |
| Instagram 快拍格式。 |
广告预览调用如下所示:
use FacebookAds\Object\Ad;
use FacebookAds\Object\Values\AdPreviewAdFormatValues;
$adgroup = new Ad(<AD_ID>);
$preview = $adgroup->getPreviews(array(), array(
'ad_format' => AdPreviewAdFormatValues::INSTAGRAM_STANDARD,
))->current();
from facebookads.adobjects.ad import Ad
from facebookads.adobjects.adpreview import AdPreview
ad = Ad(<AD_ID>)
ad.get_previews(params={
'ad_format': AdPreview.AdFormat.instagram_standard,
})
curl -G \
-d 'ad_format=INSTAGRAM_STANDARD' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/<AD_ID>/previews
如需在添加广告创意前预览,请在预览的 creative
参数中传递创意的 object_story_spec
。无论是仅 Instagram 版位广告,还是混合版位广告,您必须为其提供 instagram_actor_id
和 page_id
:
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdCreativeLinkData;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Fields\AdCreativeLinkDataFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdPreviewFields;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Values\AdPreviewAdFormatValues;
$creative = new AdCreative();
$creative->setData(array(
AdCreativeFields::OBJECT_STORY_SPEC =>
(new AdCreativeObjectStorySpec())->setData(array(
AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
AdCreativeObjectStorySpecFields::INSTAGRAM_ACTOR_ID =>
<INSTAGRAM_ACTOR_ID>,
AdCreativeObjectStorySpecFields::LINK_DATA =>
(new AdCreativeLinkData())->setData(array(
AdCreativeLinkDataFields::IMAGE_HASH => '<IMAGE_HASH>',
AdCreativeLinkDataFields::MESSAGE => 'Ad Message',
AdCreativeLinkDataFields::CAPTION => 'www.example.com',
AdCreativeLinkDataFields::LINK => '<URL>',
AdCreativeLinkDataFields::CALL_TO_ACTION => array(
'type' => AdCreativeCallToActionTypeValues::LEARN_MORE,
'value' => array(
'link' => '<URL>',
),
),
)),
)),
));
$account = new AdAccount('act_<AD_ACCOUNT_ID>');
$preview = $account->getGeneratePreviews(array(), array(
AdPreviewFields::CREATIVE => $creative,
AdPreviewFields::AD_FORMAT => AdPreviewAdFormatValues::INSTAGRAM_STANDARD,
))->current();
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativelinkdatacalltoaction \
import AdCreativeLinkDataCallToAction
from facebookads.adobjects.adcreativelinkdata import AdCreativeLinkData
from facebookads.adobjects.adcreativeobjectstoryspec \
import AdCreativeObjectStorySpec
from facebookads.adobjects.adpreview import AdPreview
account = AdAccount('act_<AD_ACCOUNT_ID>')
link_data = AdCreativeLinkData()
link_data.set_data({
AdCreativeLinkData.Field.image_hash: '<IMAGE_HASH>',
AdCreativeLinkData.Field.message: 'Ad message',
AdCreativeLinkData.Field.caption: 'www.example.com',
AdCreativeLinkData.Field.link: '<URL>',
AdCreativeLinkData.Field.call_to_action: {
'type': AdCreativeLinkDataCallToAction.Type.learn_more,
'value': {
'link': '<URL>',
},
},
})
story = AdCreativeObjectStorySpec()
story.set_data({
AdCreativeObjectStorySpec.Field.page_id: <PAGE_ID>,
AdCreativeObjectStorySpec.Field.instagram_actor_id: <INSTAGRAM_ACTOR_ID>,
AdCreativeObjectStorySpec.Field.link_data: link_data,
})
creative = AdCreative()
creative.set_data({
AdCreative.Field.object_story_spec: story,
})
preview = account.get_generate_previews(params={
'creative': creative,
'ad_format': AdPreview.AdFormat.instagram_standard,
})
APINodeList<AdPreview> adPreviews = new AdAccount(act_<AD_ACCOUNT_ID>, context).getGeneratePreviews()
.setCreative(
new AdCreative()
.setFieldObjectStorySpec(
new AdCreativeObjectStorySpec()
.setFieldInstagramActorId(<INSTAGRAM_ACTOR_ID>)
.setFieldLinkData(
new AdCreativeLinkData()
.setFieldCallToAction(
new AdCreativeLinkDataCallToAction()
.setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE)
.setFieldValue(
new AdCreativeLinkDataCallToActionValue()
.setFieldLink(<URL>)
)
)
.setFieldCaption("www.example.com")
.setFieldImageHash(<IMAGE_HASH>)
.setFieldLink(<URL>)
.setFieldMessage("Ad Message")
)
.setFieldPageId(<PAGE_ID>)
)
)
.setAdFormat(AdPreview.EnumAdFormat.VALUE_INSTAGRAM_STANDARD)
.execute();
curl -G \
--data-urlencode 'creative={
"object_story_spec": {
"instagram_actor_id": "<INSTAGRAM_ACTOR_ID>",
"link_data": {
"call_to_action": {"type":"LEARN_MORE","value":{"link":"<URL>"}},
"caption": "www.example.com",
"image_hash": "<IMAGE_HASH>",
"link": "<URL>",
"message": "Ad Message"
},
"page_id": "<PAGE_ID>"
}
}' \
-d 'ad_format=INSTAGRAM_STANDARD' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/generatepreviews
在提供广告创意后,您可以得到相应的 Instagram 帖子的网址,并可以查看对该广告帖子的回应。该帖子与您的受众所看到的帖子不尽相同。其上不存在“赞助内容”或行动号召。
此网址尚不支持当您在 object_story_spec
中使用 template_data
时所产生的动态广告创意。此网址也不支持 Instagram 快拍广告中的广告创意。
curl -X GET \
-d 'fields="instagram_permalink_url"' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<CREATIVE_ID>/
响应:
{ "instagram_permalink_url": "<INSTAGRAM_POST_URL>", "id": "<AD_CREATIVE_ID>" }