素材摘要規格

asset_feed_spec 欄位可讓您向不同的用戶投放不同的廣告創意組合。設定組合的方式有兩種:

  • 自動:您提供廣告創意素材,而我們自動將不同的組合投放給不同的用戶。若要使用此選項,請參閱<活用型廣告創意 API
  • 手動:您提供廣告創意素材,並建立如何顯示這些素材的規則。若要使用此選項,請參閱素材客製化規則

素材摘要規格包含各種不同的廣告創意素材,例如圖像、標題、正文等等。您可以為每種素材類型指定多項廣告創意素材。規格的格式依各個使用案例而不同。另請參閱參考資料:素材摘要規格

建立素材摘要

您可以使用 asset_feed_spec 來提供多項廣告創意素材,但有以下限制:

  • 針對所有素材客製化規則asset_feed_spec 中應包含至少兩個目標客製化規則。
  • 針對活用型廣告創意asset_feed_spec不應包含客製化規則。若是這種情況,您可以在 ad_formats 下指定 [“AUTOMATIC_FORMAT”],以在不同廣告版位之間混合使用圖像和影片。

例如,若要建立活用型廣告創意的 asset_feed_spec

curl -X POST \
  -F 'name="Dynamic Ad Creative with Asset Feed Spec Sample"' \
  -F 'object_story_spec={
       "page_id": "<PAGE_ID>"
     }' \
  -F 'asset_feed_spec={
       "images": [
         {
           "hash": "<IMAGE_HASH>"
         }
       ],
       "bodies": [
         {
           "text": "Begin Your Adventure"
         },
         {
           "text": "Once a Trainer, always a Trainer."
         }
       ],
       "titles": [
         {
           "text": "Level Up"
         },
         {
           "text": "Swipe to evolve"
         }
       ],
       "descriptions": [
         {
           "text": "First Dynamic Ad Creative Sample"
         }
       ],
       "ad_formats": [
         "SINGLE_IMAGE"
       ],
       "call_to_action_types": [
         "SHOP_NOW"
       ],
       "link_urls": [
         {
           "website_url": "https://www.example.com/"
         }
       ],
       "videos": []
     }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v21.0/act_<AD_ACCOUNT_ID>/adcreatives

您也可以建立包含兩個替換影片、正文和標題的 asset_feed_spec

curl \
-F 'object_story_spec={
       "page_id": "YOUR_PAGE_ID"
       "instagram_actor_id" : "INSTAGRAM_ACTOR_ID",
    }' \
-F "asset_feed_spec={'videos': [{'video_id':'2053108854721025', 'thumbnail_url':'<thumnail_url>', 'url_tags':'video=video1'},{'video_id':'2104406249780616', 'thumbnail_url':'<thumnail_url>','url_tags':'video=video2'}], 'bodies': [{'text':'Begin Your Adventure'}, {'text':'Once a Trainer, always a Trainer.'}], 'titles': [{'text':'Level Up'}, {'text':'Swipe to evolve'}], 'descriptions': [{'text':'Begin Your Adventure'}], 'ad_formats': ['SINGLE_IMAGE'], 'link_urls': [{'website_url':'<WEBSITE_URL>'}]}" \
-F 'access_token=<ACCESS_TOKEN>'  \
https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adcreatives

查看素材摘要規格的所有可用選項

讀取素材摘要

若要查看您的廣告創意,請讀取 asset_feed_spec

curl -X GET \ -d 'fields="asset_feed_spec"' \ -d 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v21.0/<CREATIVE_ID>/
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_CREATIVE_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 = [ 'asset_feed_spec', ]; params = { }; const sample_code = (new AdCreative(id)).get( fields, params ); logApiCallResult('sample_code api call complete.', sample_code);
require __DIR__ . '/vendor/autoload.php'; 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_CREATIVE_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( 'asset_feed_spec', ); $params = array( ); echo json_encode((new AdCreative($id))->getSelf( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
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_CREATIVE_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ 'asset_feed_spec', ] params = { } print AdCreative(id).get( 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_CREATIVE_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdCreative(id, context).get() .requestAssetFeedSpecField() .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_CREATIVE_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_creative = FacebookAds::AdCreative.get(id ,'asset_feed_spec')

如果您的活用型廣告創意摘要包含多個圖像和正文,則回應如下所示:

{  
   "asset_feed_spec":{  
      "images":[  
         {  
            "url_tags":"image=image1",
            "hash":"785095162a2034666e0d0cc4ea1faf89"
         },
         {  
            "url_tags":"image=image2",
            "hash":"3a24122c13923569599be35567ce4e9e"
         }
      ],
      "bodies":[  
         {  
            "text":"Begin Your Adventure"
         },
         {  
            "text":"Once a Trainer, always a Trainer."
         }
      ],
      "call_to_action_types":[  
         "LEARN_MORE"
      ],
      "call_to_actions":[  
         {  
            "type":"LEARN_MORE"
         }
      ],
      "descriptions":[  
         {  
            "text":"Begin Your Adventure"
         }
      ],
      "link_urls":[  
         {  
            "website_url":"<WEBSITE_URL>"
         }
      ],
      "titles":[  
         {  
            "text":"Swipe to evolve"
         },
         {  
            "text":"Level Up"
         }
      ],
      "ad_formats":[  
         "SINGLE_IMAGE"
      ],
      "optimization_type":"REGULAR"
   },
   "id":"<AD_CREATIVE_ID>",
}

如果您的活用型廣告創意摘要包含多個影片、正文和標題,則回應如下所示:

{  
   "asset_feed_spec":{  
      "videos":[  
         {  
            "url_tags":"video=video1",
            "video_id":"2053108854721025",
            "thumbnail_url":"<thumnail_url>",
            "thumbnail_hash":"<thumnail_hash>"
         },
         {  
            "url_tags":"video=video2",
            "video_id":"2104406249780616",
            "thumbnail_url":"<thumnail_url>",
            "thumbnail_hash":"<thumnail_hash>"
         }
      ],
      "bodies":[  
         {  
            "text":"Begin Your Adventure"
         },
         {  
            "text":"Once a Trainer, always a Trainer."
         }
      ],
      "call_to_action_types":[  
         "LEARN_MORE"
      ],
      "call_to_actions":[  
         {  
            "type":"LEARN_MORE"
         }
      ],
      "descriptions":[  
         {  
            "text":"Begin Your Adventure"
         }
      ],
      "link_urls":[  
         {  
            "website_url":"<WEBSITE_URL>"
         }
      ],
      "titles":[  
         {  
            "text":"Swipe to evolve"
         },
         {  
            "text":"Level Up"
         }
      ],
      "ad_formats":[  
         "SINGLE_VIDEO"
      ],
      "optimization_type":"REGULAR"
   },
   "id":"<AD_CREATIVE_ID>",
}

編輯素材摘要

您可以新增、替換或移除任何廣告創意素材。若要執行此作業,請提供另一個包含新 asset_feed_spec 的廣告創意。

您可以:

  • 新增素材。
  • 移除現有素材。
  • 以全新的素材來替換素材。

不能

  • 變更廣告格式,例如從 SINGLE IMAGE 變更為 VIDEO
  • 將素材摘要型廣告創意廣告更新為非活用型廣告創意廣告,後者沒有 asset_feed_spec
    curl \
      -F 'access_token=<ACCESS_TOKEN>' \
      -F 'creative={
          "creative_id": <CREATIVE_ID>,
       }' \
    https://graph.facebook.com/v21.0/<AD_ID>

當您建立新的廣告創意來替換舊的廣告創意時,仍必須符合所有適用的限制