您可以使用帶有廣告或廣告創意編號的格式選項來預覽現有廣告。有關 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>" }