视频广告和轮播广告

您可以通过此 API 在 Facebook 上轻松创建、衡量和优化视频及轮播广告。请参阅 Facebook for Business 下的“轮播广告”部分。如需获取广告支持的视频格式,请参阅广告主帮助中心下的“视频”部分

视频广告

参考文档

如需在 VIDEO_VIEWS 目标中创建视频广告并优化竞价以覆盖更多受众,请按以下步骤操作:

第 1 步:提供广告创意

使用现有视频编号以及上传到 Facebook 的视频创建视频广告。

您将需要:

  • pages_read_engagementads_management 权限
  • 上传至任一 act_{ad-account-id}/advideos 端点的视频
use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdCreativeVideoData;
use FacebookAds\Object\Fields\AdCreativeVideoDataFields;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;


$video_data = new AdCreativeVideoData();
$video_data->setData(array(
  AdCreativeVideoDataFields::IMAGE_URL => '<THUMBNAIL_URL>',
  AdCreativeVideoDataFields::VIDEO_ID => <VIDEO_ID>,
));

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');

$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec
from facebookads.adobjects.adcreativevideodata \
    import AdCreativeVideoData

video_data = AdCreativeVideoData()
video_data[AdCreativeVideoData.Field.description] = 'My Description'
video_data[AdCreativeVideoData.Field.video_id] = <VIDEO_ID>
video_data[AdCreativeVideoData.Field.image_url] = '<IMAGE_URL>'

object_story_spec = AdCreativeObjectStorySpec()
object_story_spec[AdCreativeObjectStorySpec.Field.page_id] = <PAGE_ID>
object_story_spec[AdCreativeObjectStorySpec.Field.video_data] = video_data

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'Video Ad Creative'
creative[AdCreative.Field.object_story_spec] = object_story_spec
creative.remote_create()
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setName("Sample Creative")
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldPageId(<PAGE_ID>)
      .setFieldVideoData(
        new AdCreativeVideoData()
          .setFieldImageUrl(<THUMBNAIL_URL>)
          .setFieldVideoId(<VIDEO_ID>)
      )
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": {"image_url":"<THUMBNAIL_URL>","video_id":"<VIDEO_ID>"} 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

幻灯片

如需面向新兴市场中的非智能手机扩大或推出品牌营销活动,或要创建简单的视频,请尝试使用图像幻灯片。将图像上传到视频素材中。例如:

use FacebookAds\Object\AdVideo;
use FacebookAds\Object\Fields\AdVideoFields;

$video = new AdVideo(null, 'act_<AD_ACCOUNT_ID>');
$video->{AdVideoFields::SLIDESHOW_SPEC} = array (
  'images_urls' => array(
    '<IMAGE_URL_1>',
    '<IMAGE_URL_2>',
    '<IMAGE_URL_3>',
  ),
  'duration_ms' => 2000,
  'transition_ms' => 200,
);

$video->create();
from facebookads.adobjects.advideo import AdVideo
from facebookads.specs import SlideshowSpec

video = AdVideo(parent_id='act_<AD_ACCOUNT_ID>')
slideshow = SlideshowSpec()
slideshow.update({
    SlideshowSpec.Field.images_urls: <IMAGE_URLS>,
    SlideshowSpec.Field.duration_ms: 2000,
    SlideshowSpec.Field.transition_ms: 200,
})

video[AdVideo.Field.slideshow_spec] = slideshow
video.remote_create()
new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdVideo()
  .setSlideshowSpec("{\"images_urls\":[\"" + <IMAGE_URL_1> + "\",\"" + <IMAGE_URL_2> + "\",\"" + <IMAGE_URL_3> + "\"],\"duration_ms\":\"2000\",\"transition_ms\":\"200\"}")
  .execute();
curl \
  -F 'slideshow_spec={ 
    "images_urls": [ 
      "<IMAGE_URL_1>", 
      "<IMAGE_URL_2>", 
      "<IMAGE_URL_3>" 
    ], 
    "duration_ms": 2000, 
    "transition_ms": 200 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph-video.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/advideos

请参阅视频创意最佳实践参考文档:广告视频

第 2 步:创建广告系列

将 objective 设为 VIDEO_VIEWS

curl -X POST \ -F 'name="Video Views campaign"' \ -F 'objective="OUTCOME_ENGAGEMENT"' \ -F 'status="PAUSED"' \ -F 'special_ad_categories=[]' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/campaigns
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const Campaign = bizSdk.Campaign; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'Video Views campaign', 'objective' : 'OUTCOME_ENGAGEMENT', 'status' : 'PAUSED', 'special_ad_categories' : [], }; const campaigns = (new AdAccount(id)).createCampaign( fields, params ); logApiCallResult('campaigns api call complete.', campaigns);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\Campaign; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'Video Views campaign', 'objective' => 'OUTCOME_ENGAGEMENT', 'status' => 'PAUSED', 'special_ad_categories' => array(), ); echo json_encode((new AdAccount($id))->createCampaign( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.campaign import Campaign from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'Video Views campaign', 'objective': 'OUTCOME_ENGAGEMENT', 'status': 'PAUSED', 'special_ad_categories': [], } print AdAccount(id).create_campaign( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createCampaign() .setName(\"Video Views campaign\") .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_ENGAGEMENT) .setStatus(Campaign.EnumStatus.VALUE_PAUSED) .setParam(\"special_ad_categories\", \"[]\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) campaigns = ad_account.campaigns.create({ name: 'Video Views campaign', objective: 'OUTCOME_ENGAGEMENT', status: 'PAUSED', special_ad_categories: [], })

请参阅参考文档 > 广告系列以 PHP 编写的广告目标以 Python 编写的广告目标

第 3 步:创建广告组

如果您的目标是得到最低的单次观看费用,则应将广告系列的视频播放量目标与广告组的 optimization_goal=THRUPLAY 配对。您可以将 bidding_event 设为 IMPRESSIONSTHRUPLAY,按展示次数或视频观看量支付费用。请参阅 CPV 竞价

curl \
  -F 'name=A CPV Ad Set' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'daily_budget=500' \
  -F 'start_time=2018-02-06T04:45:29+0000' \
  -F 'end_time=2018-02-13T04:45:29+0000' \
  -F 'billing_event=THRUPLAY' \
  -F 'optimization_goal=THRUPLAY' \
  -F 'bid_amount=100' \
  -F 'targeting={ 
    "device_platforms": ["mobile"], 
    "geo_locations": {"countries":["US"]}, 
    "publisher_platforms": ["facebook"] 
  }' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adsets

相较针对视频观看量优化的覆盖和频次购买的 CPV 而言,具有 optimization_goal=THRUPLAY 的广告组的单次观看费用较低。请参阅参考资料:广告组

第 4 步:创建广告

使用现有广告组和广告创意:

curl -X POST \ -F 'name="My Ad"' \ -F 'adset_id="<AD_SET_ID>"' \ -F 'creative={ "creative_id": "<CREATIVE_ID>" }' \ -F 'status="PAUSED"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/ads
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const Ad = bizSdk.Ad; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My Ad', 'adset_id' : '<adSetID>', 'creative' : {'creative_id':'<adCreativeID>'}, 'status' : 'PAUSED', }; const ads = (new AdAccount(id)).createAd( fields, params ); logApiCallResult('ads api call complete.', ads);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\Ad; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'My Ad', 'adset_id' => '<adSetID>', 'creative' => array('creative_id' => '<adCreativeID>'), 'status' => 'PAUSED', ); echo json_encode((new AdAccount($id))->createAd( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.ad import Ad from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My Ad', 'adset_id': '<adSetID>', 'creative': {'creative_id':'<adCreativeID>'}, 'status': 'PAUSED', } print AdAccount(id).create_ad( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAd() .setName(\"My Ad\") .setAdsetId(<adSetID>L) .setCreative( new AdCreative() .setFieldId(\"<adCreativeID>\") ) .setStatus(Ad.EnumStatus.VALUE_PAUSED) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) ads = ad_account.ads.create({ name: 'My Ad', adset_id: '<adSetID>', creative: {'creative_id':'<adCreativeID>'}, status: 'PAUSED', })

如果广告系列目标为 VIDEO_VIEWS,则广告会默认获取合适的追踪参数,这些参数定义了针对广告追踪的操作。例如,视频观看量:

{'action.type':'video_view','post':'POST_ID','post.wall':'PAGE_ID'}
    

请参阅广告管理工具:我的广告系列参考资料:广告

品牌知名度示例

如需创建视频广告,以便提升品牌知名度,请参阅品牌知名度博客

覆盖和频次示例

参考文档

要让视频覆盖更多人,请将广告系列的视频观看量目标设为覆盖和频次。您需要创建预估并加以保存,然后将其分配到广告组。

遵循视频观看量创建中的步骤操作,但将覆盖和频次应用于广告组。额外指定以下参数:

$adset->{AdSetFields::RF_PREDICTION_ID} = <RESERVATION_ID>;
adset[AdSet.Field.prediction_id] = <RESERVATION_ID>
-F "rf_prediction_id=<RESERVATION_ID>" \

效果类广告视频

为鼓励用户从了解某个品牌转变为使用某个品牌,请参阅轮播广告格式的视频创意

  • 覆盖观看视频的用户。从了解某个品牌到喜爱并考虑使用某个品牌。请参阅再营销
  • 与品牌和商品互动。添加用于访问网站特定页面的行动号召。请参阅行动号召

再营销

视频广告再营销能为广告主提供支持,帮助其使用 Facebook 和 Instagram 上的原生视频或付费视频定位特定自定义受众。使用此功能将用户从了解某个品牌推向更深的营销漏斗目标,例如喜爱并考虑加以使用。请参阅研究:有效创意组合

您需要在包含视频的公共主页上拥有广告主权限才能针对该视频创建受众。

对于受众,请设置 subtype=ENGAGEMENT。然后编写适用于要创建的受众的规则。每条规则都有一个 object_id(例如,视频编号)和 event_nameevent_name 可以是以下其中一项:

  • video_watched:用户观看视频总计至少 3 秒或几乎看完的次数,以先发生的情况为准。
  • video_completed:视频观看进度达 95% 的次数,包括跳跃播放到这一进度的次数。
  • video_view_10s:用户观看视频总计至少 10 秒或几乎看完的次数,以先发生的情况为准。
  • video_view_15s:用户观看视频总计至少 15 秒或几乎看完的次数,以先发生的情况为准。
  • video_view_25_percent:视频观看进度达 25% 的次数,包括跳跃播放到这一进度的次数。
  • video_view_50_percent:视频观看进度达 50% 的次数,包括跳跃播放到这一进度的次数。
  • video_view_75_percent:视频观看进度达 75% 的次数,包括跳跃播放到这一进度的次数。

您可以组合使用视频,根据各种视频和操作创建受众。例如,受众可以包含观看视频 A 达 3 秒的用户,以及看完视频 B 和 C 的用户。

以下代码将创建由过去 14 天观看视频 1 达 3 秒以上的用户,以及看完视频 2 的用户组成的受众。由于设置了 prefill=true,所以系统会在创建受众前,自动将其填充为观看者。

use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;


$audience = new CustomAudience(null, $ad_account_id);
$audience->setData(array(
  CustomAudienceFields::NAME => 'Video Ads Engagement Audience',
  CustomAudienceFields::SUBTYPE => 'ENGAGEMENT',
  CustomAudienceFields::DESCRIPTION => 'Users who watched my video',
  CustomAudienceFields::PREFILL => true,
  CustomAudienceFields::RULE => array(
    array(
      'object_id' => $video_id_1,
      'event_name' => 'video_watched',
    ),
    array(
      'object_id' => $video_id_2,
      'event_name' => 'video_completed',
    ),
  ),
));

$audience->create();
from facebookads.adobjects.customaudience import CustomAudience

audience = CustomAudience(parent_id=ad_account_id)
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.engagement
audience[CustomAudience.Field.name] = 'Video Ads Engagement Audience'
audience[CustomAudience.Field.description] = 'Users who watched my video'
audience[CustomAudience.Field.prefill] = True
audience[CustomAudience.Field.rule] = [
    {
        "object_id": video_id_1,
        "event_name": "video_watched",
    },
    {
        "object_id": video_id_2,
        "event_name": "video_completed",
    },
]
audience.remote_create()
curl \
  -F 'name=Video Ads Engagement Audience' \
  -F 'subtype=ENGAGEMENT' \
  -F 'description=Users who watched my video' \
  -F 'prefill=1' \
  -F 'rule=[ 
    {"object_id":"%video_id_1","event_name":"video_watched"}, 
    {"object_id":"%video_id_2","event_name":"video_completed"} 
  ]' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/%ad_account_id/customaudiences

2015 年 10 月 16 日以后的视频观看量支持回填。

行动号召

具有行动号召 (CTA) 的视频可提示用户了解详情并访问网站上的特定页面。如果主要目标是提升视频观看量或品牌知名度,且次要目标是提升站外点击量,此功能可改善广告效果。您应为后者应用视频链接式广告。行动号召 (CTA) 的呈现方式:

  • 对于移动平台和桌面平台,显示为帖子的一部分。视频暂停后,在“恢复”选项旁边显示。
  • 对于移动平台,如果有人点击视频以全屏模式观看,则会以视频叠加的形式显示为浮动的行动号召。
  • 外部视频链接式广告帖子不会显示行动号召 (CTA)。

您仅可将具有行动号召 (CTA) 的视频用于以下广告目标:

请参阅将视频扩展用于其他目标。以下代码将创建具有 GET_DIRECTIONS 行动召唤的视频广告:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeVideoDataFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\AdCreativeVideoData;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$video_data = new AdCreativeVideoData();
$video_data->setData(array(
  AdCreativeVideoDataFields::IMAGE_URL => '<THUMBNAIL_URL>',
  AdCreativeVideoDataFields::VIDEO_ID => <VIDEO_ID>,
  AdCreativeVideoDataFields::LINK_DESCRIPTION =>
    "Come check out our new store in Menlo Park!",
  AdCreativeVideoDataFields::CALL_TO_ACTION => array(
    'type' => AdCreativeCallToActionTypeValues::GET_DIRECTIONS,
    'value' => array(
      'link' => 'fbgeo://37.48327, -122.15033, "1601 Willow Rd Menlo Park CA"',
    ),
  ),
));

$story = new AdCreativeObjectStorySpec();
$story->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');
$creative->{AdCreativeFields::OBJECT_STORY_SPEC} = $story;
$creative->create();
from facebookads.adobjects.adcreativevideodata import AdCreativeVideoData
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec

video_data = AdCreativeVideoData()
video_data[AdCreativeVideoData.Field.image_url] = image_url
video_data[AdCreativeVideoData.Field.video_id] = <VIDEO_ID>
video_data[AdCreativeVideoData.Field.description]\
    = 'Come check out our new store in Menlo Park!'
video_data[AdCreativeVideoData.Field.call_to_action] = {
    'type': 'GET_DIRECTIONS',
    'value': {
        'link': 'fbgeo://37.48327, -122.15033, "1601 Willow Rd Menlo Park CA"',
    },
}

story = AdCreativeObjectStorySpec()
story[AdCreativeObjectStorySpec.Field.page_id] = <PAGE_ID>
story[AdCreativeObjectStorySpec.Field.video_data] = video_data

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.object_story_spec] = story
creative.remote_create()
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldPageId(<PAGE_ID>)
      .setFieldVideoData(
        new AdCreativeVideoData()
          .setFieldCallToAction(
            new AdCreativeLinkDataCallToAction()
              .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_GET_DIRECTIONS)
              .setFieldValue(
                new AdCreativeLinkDataCallToActionValue()
                  .setFieldLink("fbgeo://37.48327, -122.15033, \"1601 Willow Rd Menlo Park CA\"")
              )
          )
          .setFieldLinkDescription("Come check out our new store in Menlo Park!")
          .setFieldImageUrl(<THUMBNAIL_URL>)
          .setFieldVideoId(<VIDEO_ID>)
      )
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": { 
      "call_to_action": { 
        "type": "GET_DIRECTIONS", 
        "value": { 
          "link": "fbgeo:\/\/37.48327, -122.15033, \"1601 Willow Rd Menlo Park CA\"" 
        } 
      }, 
      "image_url": "<THUMBNAIL_URL>", 
      "link_description": "Come check out our new store in Menlo Park!", 
      "video_id": "<VIDEO_ID>" 
    } 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

视频指标

视频帖子成效分析(自然)

详细了解视频在 Facebook 上的表现,并更明智地做出关于视频内容的决策。我们目前仅在用户开始观看视频时提供指标。其中包括视频观看量、独立视频观看量、平均视频观看时长以及受众留存率。了解用户在视频的哪个部分停止观看,以及用户可能认为哪些部分最有意思。

视频广告成效分析(付费)

使用广告成效分析 API响应包含各种视频指标。

视频类型

检索按视频类型分组的视频广告统计数据,例如自动播放量、点击播放量。在 action_breakdowns 中加入 action_video_typeaction_video_type 的预期值为 totalclick_to_playauto_play

我们目前正在对 action_video_type 选项进行小范围测试。如要通过细分数据确定客户,请查看广告帐户CAN_USE_VIDEO_METRICS_BREAKDOWN

use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Fields\AdsInsightsFields;
use FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues;
use FacebookAds\Object\Values\AdsInsightsDatePresetValues;

$account = new AdAccount('act_<AD_ACCOUNT_ID>');

$params = array(
  'action_breakdowns' => AdsInsightsActionBreakdownsValues::ACTION_VIDEO_TYPE,
  'date_preset' => AdsInsightsDatePresetValues::LAST_30D,
);

$fields = array(
  AdsInsightsFields::ACTIONS,
  AdsInsightsFields::VIDEO_AVG_PCT_WATCHED_ACTIONS,
  AdsInsightsFields::VIDEO_COMPLETE_WATCHED_ACTIONS,
);

$stats = $account->getInsights($fields, $params);
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adsinsights import AdsInsights

account = AdAccount('act_<AD_ACCOUNT_ID>')

params = {
    'action_breakdowns': AdsInsights.ActionBreakdowns.action_video_type,
    'date_preset': AdsInsights.DatePreset.last_30_days,
    'fields': [
        AdsInsights.Field.actions,
        AdsInsights.Field.video_avg_pct_watched_actions,
        AdsInsights.Field.video_complete_watched_actions,
    ],
}

stats = account.get_insights(params=params)
print(stats)
APINodeList<AdsInsights> adsInsightss = new AdAccount(act_<AD_ACCOUNT_ID>, context).getInsights()
  .setActionBreakdowns("action_video_type")
  .setDatePreset(AdsInsights.EnumDatePreset.VALUE_LAST_30_DAYS)
  .requestField("actions")
  .requestField("video_avg_pct_watched_actions")
  .requestField("video_complete_watched_actions")
  .execute();
curl -G \
  -d 'action_breakdowns=action_video_type' \
  -d 'date_preset=last_30_days' \
  -d 'fields=actions,video_avg_pct_watched_actions,video_complete_watched_actions' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/insights

响应包含 action_type 设置为 video_view 并包含 action_video_type 键的对象:

{
  "data": [
    {
      "actions": [
        ...
        {
          "action_type": "video_play", 
          "value": 9898
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "total", 
          "value": 921129
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "auto_play", 
          "value": 915971
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "click_to_play", 
          "value": 5158
        }
      ], 
      "video_avg_pct_watched_actions": [
        {
          "action_type": "video_view", 
          "action_video_type": "total", 
          "value": 60.59
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "auto_play", 
          "value": 60.47
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "click_to_play", 
          "value": 80.63
        }
      ], 
      "video_complete_watched_actions": [
        {
          "action_type": "video_view", 
          "action_video_type": "total", 
          "value": 156372
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "auto_play", 
          "value": 154015
        }, 
        {
          "action_type": "video_view", 
          "action_video_type": "click_to_play", 
          "value": 2357
        }
      ], 
      "date_start": "2014-12-26", 
      "date_stop": "2015-03-25"
    }
  ], 
  "paging": {
    "cursors": {
      "before": "MA==", 
      "after": "MA=="
    }
  }
}

请参阅广告成效分析 API

在动态中提供更多创意空间,引导用户前往网站或移动应用,实现转换。您可通过两种方式创建轮播广告:

Facebook 快拍不支持轮播广告。

创建内联

在创建广告创意的同时创建轮播广告公共主页帖子。在 object_story_spec 中指定公共主页帖子内容,该参数根据 adcreatives 创建公共主页隐藏帖。请参阅广告创意。例如:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Fields\AdCreativeLinkDataFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeLinkDataChildAttachmentFields;
use FacebookAds\Object\AdCreativeLinkDataChildAttachment;
use FacebookAds\Object\AdCreativeLinkData;
use FacebookAds\Object\AdCreativeObjectStorySpec;

$product1 = (new AdCreativeLinkDataChildAttachment())->setData(array(
  AdCreativeLinkDataChildAttachmentFields::LINK =>
    'https://www.link.com/product1',
  AdCreativeLinkDataChildAttachmentFields::NAME => 'Product 1',
  AdCreativeLinkDataChildAttachmentFields::DESCRIPTION => '$8.99',
  AdCreativeLinkDataChildAttachmentFields::IMAGE_HASH => '<IMAGE_HASH>',
  AdCreativeLinkDataChildAttachmentFields::VIDEO_ID => '<VIDEO_ID>',
));

$product2 = (new AdCreativeLinkDataChildAttachment())->setData(array(
  AdCreativeLinkDataChildAttachmentFields::LINK =>
    'https://www.link.com/product2',
  AdCreativeLinkDataChildAttachmentFields::NAME => 'Product 2',
  AdCreativeLinkDataChildAttachmentFields::DESCRIPTION => '$9.99',
  AdCreativeLinkDataChildAttachmentFields::IMAGE_HASH => '<IMAGE_HASH>',
  AdCreativeLinkDataChildAttachmentFields::VIDEO_ID => '<VIDEO_ID>',
));

$product3 = (new AdCreativeLinkDataChildAttachment())->setData(array(
  AdCreativeLinkDataChildAttachmentFields::LINK =>
    'https://www.link.com/product3',
  AdCreativeLinkDataChildAttachmentFields::NAME => 'Product 3',
  AdCreativeLinkDataChildAttachmentFields::DESCRIPTION => '$10.99',
  AdCreativeLinkDataChildAttachmentFields::IMAGE_HASH => '<IMAGE_HASH>',
));

$link_data = new AdCreativeLinkData();
$link_data->setData(array(
  AdCreativeLinkDataFields::LINK => '<URL>',
  AdCreativeLinkDataFields::CHILD_ATTACHMENTS => array(
    $product1, $product2, $product3,
  ),
));

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::LINK_DATA => $link_data,
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');
$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativelinkdata import AdCreativeLinkData
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec
from facebookads.adobjects.adcreativelinkdatachildattachment \
    import AdCreativeLinkDataChildAttachment

product1 = AdCreativeLinkDataChildAttachment()
product1[AdCreativeLinkDataChildAttachment.Field.link] = '<URL>' + '/product1'
product1[AdCreativeLinkDataChildAttachment.Field.name] = 'Product 1'
product1[AdCreativeLinkDataChildAttachment.Field.description] = '$8.99'
product1[AdCreativeLinkDataChildAttachment.Field.image_hash] = '<IMAGE_HASH>'
product1[AdCreativeLinkDataChildAttachment.Field.video_id] = '<VIDEO_ID>'

product2 = AdCreativeLinkDataChildAttachment()
product2[AdCreativeLinkDataChildAttachment.Field.link] = '<URL>' + '/product2'
product2[AdCreativeLinkDataChildAttachment.Field.name] = 'Product 2'
product2[AdCreativeLinkDataChildAttachment.Field.description] = '$9.99'
product2[AdCreativeLinkDataChildAttachment.Field.image_hash] = '<IMAGE_HASH>'

product3 = AdCreativeLinkDataChildAttachment()
product3[AdCreativeLinkDataChildAttachment.Field.link] = '<URL>' + '/product3'
product3[AdCreativeLinkDataChildAttachment.Field.name] = 'Product 3'
product3[AdCreativeLinkDataChildAttachment.Field.description] = '$10.99'
product3[AdCreativeLinkDataChildAttachment.Field.image_hash] = '<IMAGE_HASH>'

link = AdCreativeLinkData()
link[link.Field.link] = '<URL>'
link[link.Field.child_attachments] = [product1, product2, product3]

story = AdCreativeObjectStorySpec()
story[story.Field.page_id] = <PAGE_ID>
story[story.Field.link_data] = link

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'MPA Creative'
creative[AdCreative.Field.object_story_spec] = story
creative.remote_create()
print(creative)
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setName("Sample Creative")
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldLinkData(
        new AdCreativeLinkData()
          .setFieldCaption("My caption")
          .setFieldChildAttachments(Arrays.asList(
            new AdCreativeLinkDataChildAttachment()
              .setFieldDescription("$8.99")
              .setFieldImageHash(<IMAGE_HASH>)
              .setFieldLink("https://www.link.com/product1")
              .setFieldName("Product 1")
              .setFieldVideoId(<VIDEO_ID>)
          , 
            new AdCreativeLinkDataChildAttachment()
              .setFieldDescription("$9.99")
              .setFieldImageHash(<IMAGE_HASH>)
              .setFieldLink("https://www.link.com/product2")
              .setFieldName("Product 2")
              .setFieldVideoId(<VIDEO_ID>)
          , 
            new AdCreativeLinkDataChildAttachment()
              .setFieldDescription("$10.99")
              .setFieldImageHash(<IMAGE_HASH>)
              .setFieldLink("https://www.link.com/product3")
              .setFieldName("Product 3")
          ))
          .setFieldLink(<URL>)
      )
      .setFieldPageId(<PAGE_ID>)
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "link_data": { 
      "child_attachments": [ 
        { 
          "description": "$8.99", 
          "image_hash": "<IMAGE_HASH>", 
          "link": "https:\/\/www.link.com\/product1", 
          "name": "Product 1", 
          "video_id": "<VIDEO_ID>" 
        }, 
        { 
          "description": "$9.99", 
          "image_hash": "<IMAGE_HASH>", 
          "link": "https:\/\/www.link.com\/product2", 
          "name": "Product 2", 
          "video_id": "<VIDEO_ID>" 
        }, 
        { 
          "description": "$10.99", 
          "image_hash": "<IMAGE_HASH>", 
          "link": "https:\/\/www.link.com\/product3", 
          "name": "Product 3" 
        } 
      ], 
      "link": "<URL>" 
    }, 
    "page_id": "<PAGE_ID>" 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

响应为创意编号:

{"id":"<CREATIVE_ID>"}

先创建帖子,然后创建广告

创建公共主页隐藏帖。child_attachments链接对象数组。在每个链接对象中,picturenamedescription 是可选项。只需拥有公共主页访问口令就能在公共主页上发布这些内容。

curl -X GET \ -d 'message="Browse our latest products"' \ -d 'published=0' \ -d 'child_attachments=[ { "link": "{app-store-url}", "name": "Product 1", "description": "$4.99", "image_hash": "{image-hash}" }, { "link": "{app-store-url}", "name": "Product 2", "description": "$4.99", "image_hash": "{image-hash}" }, { "link": "{app-store-url}", "name": "Product 3", "description": "$4.99", "image_hash": "{image-hash}" }, { "link": "{app-store-url}", "name": "Product 4", "description": "$4.99", "image_hash": "{image-hash}" } ]' \ -d 'caption="WWW.EXAMPLE.COM"' \ -d 'link="http://www.example.com/products"' \ -d 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/{page-id}/posts
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const Page = bizSdk.Page; const PagePost = bizSdk.PagePost; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<PAGE_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'message' : 'Browse our latest products', 'published' : '0', 'child_attachments' : [{'link':'<link>','name':'Product 1','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 2','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 3','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 4','description':'$4.99','image_hash':'<imageHash>'}], 'caption' : 'WWW.EXAMPLE.COM', 'link' : 'http://www.example.com/products', }; const postss = (new Page(id)).getPosts( fields, params ); logApiCallResult('postss api call complete.', postss);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\Page; use FacebookAds\Object\PagePost; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<PAGE_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'message' => 'Browse our latest products', 'published' => '0', 'child_attachments' => array(array('link' => '<link>','name' => 'Product 1','description' => '$4.99','image_hash' => '<imageHash>'),array('link' => '<link>','name' => 'Product 2','description' => '$4.99','image_hash' => '<imageHash>'),array('link' => '<link>','name' => 'Product 3','description' => '$4.99','image_hash' => '<imageHash>'),array('link' => '<link>','name' => 'Product 4','description' => '$4.99','image_hash' => '<imageHash>')), 'caption' => 'WWW.EXAMPLE.COM', 'link' => 'http://www.example.com/products', ); echo json_encode((new Page($id))->getPosts( $fields, $params )->getResponse()->getContent(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.page import Page from facebook_business.adobjects.pagepost import PagePost from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PAGE_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'message': 'Browse our latest products', 'published': '0', 'child_attachments': [{'link':'<link>','name':'Product 1','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 2','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 3','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 4','description':'$4.99','image_hash':'<imageHash>'}], 'caption': 'WWW.EXAMPLE.COM', 'link': 'http://www.example.com/products', } print Page(id).get_posts( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<PAGE_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new Page(id, context).getPosts() .setParam(\"message\", \"Browse our latest products\") .setParam(\"published\", \"0\") .setParam(\"child_attachments\", \"[{\\"link\\":\\"<link>\\",\\"name\\":\\"Product 1\\",\\"description\\":\\"$4.99\\",\\"image_hash\\":\\"<imageHash>\\"},{\\"link\\":\\"<link>\\",\\"name\\":\\"Product 2\\",\\"description\\":\\"$4.99\\",\\"image_hash\\":\\"<imageHash>\\"},{\\"link\\":\\"<link>\\",\\"name\\":\\"Product 3\\",\\"description\\":\\"$4.99\\",\\"image_hash\\":\\"<imageHash>\\"},{\\"link\\":\\"<link>\\",\\"name\\":\\"Product 4\\",\\"description\\":\\"$4.99\\",\\"image_hash\\":\\"<imageHash>\\"}]\") .setParam(\"caption\", \"WWW.EXAMPLE.COM\") .setParam(\"link\", \"http://www.example.com/products\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PAGE_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end page = FacebookAds::Page.get(id) postss = page.posts({ fields: { }, message: 'Browse our latest products', published: '0', child_attachments: [{'link':'<link>','name':'Product 1','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 2','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 3','description':'$4.99','image_hash':'<imageHash>'},{'link':'<link>','name':'Product 4','description':'$4.99','image_hash':'<imageHash>'}], caption: 'WWW.EXAMPLE.COM', link: 'http://www.example.com/products', })

然后,借助公共主页隐藏帖提供广告创意。将 id 用作广告创意中的 object_story_id

curl -X POST \ -F 'object_story_id="<PAGE_ID>_<POST_ID>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'object_story_id' : '<pageID>_<postID>', }; const adcreatives = (new AdAccount(id)).createAdCreative( fields, params ); logApiCallResult('adcreatives api call complete.', adcreatives);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdCreative; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'object_story_id' => '<pageID>_<postID>', ); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adcreative import AdCreative from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'object_story_id': '<pageID>_<postID>', } print AdAccount(id).create_ad_creative( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdCreative() .setObjectStoryId(\"<pageID>_<postID>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adcreatives = ad_account.adcreatives.create({ object_story_id: '<pageID>_<postID>', })

创建视频轮播广告

视频轮播广告可在子附件中加入“说明”,用于自定义结束画面中的显示网址:

"child_attachments": [
 {
   "link": "https://www.facebookmarketingdevelopers.com/",
   "name": "Facebook Marketing Developers",
   "description": "Facebook Marketing Developers",
   "call_to_action": {
     "type": "APPLY_NOW",
     "value": {
      "link_title": "Facebook Marketing Developers"
     }
   },
   "video_id": "123",
   "caption": "mycustomlinkcaption.com"
  },
]

如需获取子附件的详细信息,请使用编号并调用图谱 API,视频,参考资料

创建移动应用广告

限制:

  • 移动应用轮播广告仅支持一个应用
  • 最少需要 3 张图片,非应用轮播广告最少仅需 2 张图片
  • 必须为移动应用轮播广告设置行动号召
  • 移动应用轮播广告不会显示通常显示公共主页个人头像的尾卡。请注意,您应在每个 child_attachment 中指定相同的应用商店链接。您不必在 call_to_action:{'value':{'link':... }}} 中再次指定该链接

例如,如需创建轮播广告以提升移动应用安装量:

curl -X POST \
  -F 'name="Carousel app ad"' \
  -F 'object_story_spec={
       "page_id": "<PAGE_ID>",
       "link_data": {
         "message": "My message",
         "link": "http://www.example.com/appstoreurl",
         "caption": "WWW.ITUNES.COM",
         "name": "The link name",
         "description": "The link description",
         "child_attachments": [
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           }
         ],
         "multi_share_optimized": true
       }
     }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives

您只能以与相关移动应用关联的 Facebook 公共主页的身份发布帖子。而且,您必须使用公共主页访问口令。

$child_attachments = array();

for ($i = 0; $i <= 3; $i++) {
  $child_attachments[] = array(
    'link' => '<APP_STORE_URL>',
    'image_hash' => '<IMAGE_HASH_I>',
    'call_to_action' => array(
      'type' => 'USE_MOBILE_APP',
      'value' => array(
        'app_link' => '<DEEP_LINK_I>',
        'link_title' => '<LINK_TITLE_I>',
      ),
    ),
  );
}

$params = array(
  'message' => 'My description',
  'link' => '<APP_STORE_URL>',
  'caption' => 'WWW.ITUNES.COM',
  'child_attachments' => $child_attachments,
  'multi_share_optimized' => true,
);

$data = Api::instance()->call(
  '/'.'<PAGE_ID>'.'/feed',
  RequestInterface::METHOD_POST,
  $params)->getContent();
from facebookads import FacebookAdsApi
from facebookads.adobjects.adcreativelinkdatachildattachment \
    import AdCreativeLinkDataChildAttachment

child_attachments = list()

for i in range(3):
    child_attachments.append({
        AdCreativeLinkDataChildAttachment.Field.link: '<APP_STORE_URL>',
        AdCreativeLinkDataChildAttachment.Field.image_hash: '<IMAGE_HASH>',
        AdCreativeLinkDataChildAttachment.Field.call_to_action: {
            'type': 'USE_MOBILE_APP',
            'value': {
                'app_link': '<DEEP_LINK_I>',
                'link_title': '<LINK_TITLE_I>',
            },
        },
    })

params = {
    'message': 'My description',
    'link': '<APP_STORE_URL>',
    'caption': 'WWW.ITUNES.COM',
    'child_attachments': child_attachments,
    'multi_share_optimized': True,
}

data = FacebookAdsApi.get_default_api().\
    call('POST', (<PAGE_ID>, 'feed'), params)
curl \
  -F 'message=My description' \
  -F 'link=<APP_STORE_URL>' \
  -F 'caption=WWW.ITUNES.COM' \
  -F 'child_attachments=[ 
    { 
      "link": "<APP_STORE_URL>", 
      "image_hash": "<IMAGE_HASH_I>", 
      "call_to_action": { 
        "type": "USE_MOBILE_APP", 
        "value": {"app_link":"<DEEP_LINK_I>","link_title":"<LINK_TITLE_I>"} 
      } 
    }, 
    { 
      "link": "<APP_STORE_URL>", 
      "image_hash": "<IMAGE_HASH_I>", 
      "call_to_action": { 
        "type": "USE_MOBILE_APP", 
        "value": {"app_link":"<DEEP_LINK_I>","link_title":"<LINK_TITLE_I>"} 
      } 
    }, 
    { 
      "link": "<APP_STORE_URL>", 
      "image_hash": "<IMAGE_HASH_I>", 
      "call_to_action": { 
        "type": "USE_MOBILE_APP", 
        "value": {"app_link":"<DEEP_LINK_I>","link_title":"<LINK_TITLE_I>"} 
      } 
    }, 
    { 
      "link": "<APP_STORE_URL>", 
      "image_hash": "<IMAGE_HASH_I>", 
      "call_to_action": { 
        "type": "USE_MOBILE_APP", 
        "value": {"app_link":"<DEEP_LINK_I>","link_title":"<LINK_TITLE_I>"} 
      } 
    } 
  ]' \
  -F 'multi_share_optimized=1' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PAGE_ID>/feed

使用响应中的 id 创建广告创意:

curl -X POST \ -F 'object_story_id="<PAGE_ID>_<POST_ID>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'object_story_id' : '<pageID>_<postID>', }; const adcreatives = (new AdAccount(id)).createAdCreative( fields, params ); logApiCallResult('adcreatives api call complete.', adcreatives);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdCreative; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'object_story_id' => '<pageID>_<postID>', ); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adcreative import AdCreative from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'object_story_id': '<pageID>_<postID>', } print AdAccount(id).create_ad_creative( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdCreative() .setObjectStoryId(\"<pageID>_<postID>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adcreatives = ad_account.adcreatives.create({ object_story_id: '<pageID>_<postID>', })

字段规范

下方是 iOS 上的轮播广告,显示了所述字段的显示效果。

名称 描述

child_attachments

类型:对象

轮播广告所需的链接对象数组,包含 2-10 个元素。您至少应使用 3 个对象才能获得最佳表现;2 个对象可实现轻量级集成,且使用 2 个对象可获得次优广告成效。

child_attachments.link

类型:字符串

帖子随附的链接网址或应用商店网址。必要。

child_attachments.picture

类型:网址

与链接关联的预览图像。宽高比为 1:1 并达到 458x458 像素的最低要求即可获得最佳显示效果。必须指定 pictureimage_hash

child_attachments.image_hash

类型:字符串

图库中链接关联的预览图像的哈希值;使用 1:1 宽高比且达到 458x458 像素的最低要求时可获得最佳显示效果。必须指定 pictureimage_hash

child_attachments.name

类型:字符串

链接预览的标题。如果未指定,则会使用关联公共主页的标题。通常只截取前面 35 个字符。您应设置唯一的 name,因为 Facebook 界面会显示按 name 报告的操作。

child_attachments.description

类型:字符串

价格、折扣或网站网域。如果未指定,则会提取并使用来自关联公共主页的内容。通常只截取前面 30 个字符。

child_attachments.call_to_action

类型:对象

可选的行动号召。请参阅行动号召。您无需在 call_to_action:{'value':{'link':... }}} 中再次指定该链接

child_attachments.video_id

类型:字符串

广告视频的编号。可用于任何子元素中。如果已指定,则必须同时设置 image_hashpicture

message

类型:字符串

帖子的正文,也称为状态消息。

link

类型:字符串

“查看更多”链接的网址。必要。

caption

类型:字符串

在“查看更多”链接中显示的网址。不适用于移动应用轮播广告

multi_share_optimized

类型:布尔值

如果设置为 true,则系统会自动选择并对图片和链接进行排序。否则,系统会使用子元素的原始排序。默认值为 false

multi_share_end_card

类型:布尔值

如果设置为 false,系统会删除显示公共主页图标的尾卡。默认值为 true

按商品列出的广告统计数据

使用 actions_breakdown=['action_carousel_card_id', 'action_carousel_card_name'] 按每个商品分组轮播广告操作。每个 child_attachment 都有不同的卡编号。action_carousel_card_idaction_carousel_card_name 仅可用于轮播广告。

按卡获取以下统计数据:

  • website_ctr:指定 fields=['website_ctr'] 时可用
  • app_installapp_useapps.usescredit_spentmobile_app_installtab_viewlink_clickmobile_app_installapp_custom_event.*offsite_conversion.*:指定 fields=['actions'] 时可用。不可对卡细分数据执行其他操作。
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Fields\AdsInsightsFields;
use FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues;
use FacebookAds\Object\Values\AdsInsightsBreakdownsValues;
use FacebookAds\Object\Values\AdsInsightsLevelValues;
use FacebookAds\Object\Values\AdsInsightsDatePresetValues;
use FacebookAds\Object\Values\InsightsIncrements;
use FacebookAds\Object\Values\InsightsOperators;

$account = new AdAccount('act_<AD_ACCOUNT_ID>');

$params = array(
  'action_breakdowns' => array(
    AdsInsightsActionBreakdownsValues::ACTION_TYPE,
    AdsInsightsActionBreakdownsValues::ACTION_CAROUSEL_CARD_ID,
  ),
  'level' => AdsInsightsLevelValues::AD,
  'date_preset' => AdsInsightsDatePresetValues::LAST_30D,
  'time_increment' => InsightsIncrements::ALL_DAYS,
  'breakdowns' => AdsInsightsBreakdownsValues::PLACEMENT,
  'filtering' => array(
    array(
      'field' => 'action_type',
      'operator' => InsightsOperators::IN,
      'value' => array('link_click'),
    ),
  ),
);

$fields = array(
  AdsInsightsFields::IMPRESSIONS,
  AdsInsightsFields::INLINE_LINK_CLICKS,
  AdsInsightsFields::ACTIONS,
  AdsInsightsFields::WEBSITE_CTR,
);

$stats = $account->getInsights($fields, $params);
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adsinsights import AdsInsights


account = AdAccount('act_<AD_ACCOUNT_ID>')

params = {
    'action_breakdowns': [
        AdsInsights.ActionBreakdowns.action_type,
        AdsInsights.ActionBreakdowns.action_carousel_card_id,
    ],
    'fields': [
        AdsInsights.Field.impressions,
        AdsInsights.Field.unique_clicks,
        AdsInsights.Field.actions,
        AdsInsights.Field.website_ctr,
    ],
    'level': AdsInsights.Level.ad,
    'date_preset': AdsInsights.DatePreset.last_30_days,
    'time_increment': 'all_days',
    'breakdowns': AdsInsights.Breakdowns.placement,
    'filtering': [
        {
            'field': 'action_type',
            'operator': 'IN',
            'value': ['link_click'],
        },
    ],
}

stats = account.get_insights(params=params)
print(stats)
APINodeList<AdsInsights> adsInsightss = new AdAccount(act_<AD_ACCOUNT_ID>, context).getInsights()
  .setActionBreakdowns("[\"action_type\",\"action_carousel_card_id\"]")
  .setLevel(AdsInsights.EnumLevel.VALUE_AD)
  .setDatePreset(AdsInsights.EnumDatePreset.VALUE_LAST_30_DAYS)
  .setTimeIncrement("all_days")
  .setBreakdowns("placement")
  .setFiltering("[{\"field\":\"action_type\",\"operator\":\"IN\",\"value\":[\"link_click\"]}]")
  .requestField("impressions")
  .requestField("inline_link_clicks")
  .requestField("actions")
  .requestField("website_ctr")
  .execute();
curl -G \
  -d 'action_breakdowns=["action_type","action_carousel_card_id"]' \
  -d 'level=ad' \
  -d 'date_preset=last_30_days' \
  -d 'time_increment=all_days' \
  -d 'breakdowns=placement' \
  --data-urlencode 'filtering=[ 
    { 
      "field": "action_type", 
      "operator": "IN", 
      "value": ["link_click"] 
    } 
  ]' \
  -d 'fields=impressions,inline_link_clicks,actions,website_ctr' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/insights

响应:

{
...
   "website_ctr": [
      {
         "action_carousel_card_id": "1",
         "action_type": "link_click",
         "value": 51.401869158878
      },
      {
         "action_carousel_card_id": "2",
         "action_type": "link_click",
         "value": 50.980392156863
      }
   ],
   "placement": "mobile_feed",
   "date_start": "2015-05-25",
   "date_stop": "2015-05-28"
}

您还可请求 cost_per_action_type,按操作类型获取成本细分数据:

use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Fields\AdsInsightsFields;
use FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues;
use FacebookAds\Object\Values\AdsInsightsBreakdownsValues;
use FacebookAds\Object\Values\AdsInsightsLevelValues;

$account = new AdAccount('act_<AD_ACCOUNT_ID>');

$params = array(
  'action_breakdowns' => array(
    AdsInsightsActionBreakdownsValues::ACTION_TYPE,
    AdsInsightsActionBreakdownsValues::ACTION_CAROUSEL_CARD_NAME,
  ),
  'level' => AdsInsightsLevelValues::AD,
  'breakdowns' => AdsInsightsBreakdownsValues::PLACEMENT,
);

$fields = array(
  AdsInsightsFields::IMPRESSIONS,
  AdsInsightsFields::CAMPAIGN_NAME,
  AdsInsightsFields::COST_PER_ACTION_TYPE,
);

$stats = $account->getInsights($fields, $params);
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adsinsights import AdsInsights

account = AdAccount('act_<AD_ACCOUNT_ID>')

params = {
    'action_breakdowns': [
        AdsInsights.ActionBreakdowns.action_type,
        AdsInsights.ActionBreakdowns.action_carousel_card_name,
    ],
    'fields': [
        AdsInsights.Field.impressions,
        AdsInsights.Field.campaign_name,
        AdsInsights.Field.cost_per_action_type,
    ],
    'level': AdsInsights.Level.ad,
}

stats = account.get_insights(params=params)
print(stats)
APINodeList<AdsInsights> adsInsightss = new AdAccount(act_<AD_ACCOUNT_ID>, context).getInsights()
  .setActionBreakdowns("[\"action_type\",\"action_carousel_card_name\"]")
  .setLevel(AdsInsights.EnumLevel.VALUE_AD)
  .setBreakdowns("placement")
  .requestField("impressions")
  .requestField("campaign_name")
  .requestField("cost_per_action_type")
  .execute();
curl -G \
  -d 'action_breakdowns=["action_type","action_carousel_card_name"]' \
  -d 'level=ad' \
  -d 'breakdowns=placement' \
  -d 'fields=impressions,campaign_name,cost_per_action_type' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/insights

响应示例:

{
   "data": [
      {
         "impressions": "1862555",
         "campaign_name": "My Campaign",
         "cost_per_action_type": [
            {
               "action_carousel_card_name": "My Carousel Card 1",
               "action_type": "app_custom_event.fb_mobile_activate_app",
               "value": 0.093347346315861
            },
            {
               "action_carousel_card_name": "My Carousel Card 2",
               "action_type": "app_custom_event.fb_mobile_activate_app",
               "value": 0.38324089579301
            },
            ...
         ],
      }
   ]
}
  • 2015 年 6 月 20 日之前的 action_report_time=impression 轮播广告细分数据指标有误。
  • 2015 年 7 月 20 日之前的 action_report_time=conversion 轮播广告细分数据指标有误。

版位

如果您仅选择 right_hand_column 作为版位,则只能在广告组中使用单个视频或轮播广告格式。我们不支持仅选择了一个 right_hand_column 版位的视频格式。请参阅高级定位和版位

例如,创建一个广告组并使用 right_hand_column 作为唯一版位:

curl \
  -F 'name=RHS only Ad Set' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'daily_budget=500' \
  -F 'start_time=2017-11-21T15:41:36+0000' \
  -F 'end_time=2017-11-28T15:41:36+0000' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=LINK_CLICKS' \
  -F 'bid_amount=100' \
  -F 'targeting={ 
    "device_platforms": ["mobile"], 
    "geo_locations": {"countries":["US"]}, 
    "publisher_platforms": ["facebook"] ,
    "facebook_positions": ["right_hand_column"] ,  
  }' \
  -F 'status=PAUSED' \
  -F 'access_token=ACCESS_TOKEN' \
  https://graph.facebook.com/VERSION/act_AD_ACCOUNT_ID/adsets
}

提供包含视频的广告创意:

curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": {"image_url":"THUMBNAIL_URL","video_id":"VIDEO_ID"} 
  }' \
  -F 'access_token=ACCESS_TOKEN' \
  https://graph.facebook.com/VERSION/act_AD_ACCOUNT_ID/adcreatives
}

或为广告创意提供全屏广告格式:

curl \
  -F 'image_hash=IMAGE_HASH' \
  -F 'object_story_spec={ 
    "link_data": { 
      "call_to_action": {"type":"LEARN_MORE"}, 
      "image_hash": "IMAGE_HASH", 
      "link": "CANVAS_LINK", 
      "name": "Creative message" 
    }, 
    "page_id": "PAGE_ID" 
  }' \
  -F 'access_token=ACCESS_TOKEN' \
  https://graph.facebook.com/VERSION/act_AD_ACCOUNT_ID/adcreatives
}

如果您尝试借助广告组和广告创意创建广告,请使用以下代码:

curl \
  -F 'name=My Ad' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"CREATIVE_ID"}' \
  -F 'status=ACTIVE' \
  -F 'access_token=ACCESS_TOKEN' \
  https://graph.facebook.com/VERSION/act_AD_ACCOUNT_ID/ads
    </c:code>
    
    }

如果收到错误代码,则应提供支持的创意或更改目标受众。