需求開發廣告活動的必要元件

如要從頭產生新的需求開發廣告活動,至少必須建立下列項目:

廣告活動和預算適用於建立各種廣告活動類型,而廣告群組廣告中的部分設定則特別適合用於建立需求開發廣告活動。請參閱需求開發廣告素材資源指南,瞭解如何使用指令碼建立素材資源。

請務必熟悉變動策略,因為本指南只會提供變動中使用的 JavaScript 物件。

預算

預算不得共用,且在帳戶中不得重複。如果採用以轉換為準出價,建議將每日預算設為預估單次轉換出價的 15 倍以上。如果是以價值為準出價,請將每日預算設為預估平均轉換價值/目標廣告投資報酬率的 20 倍以上。使用 CampaignBudgetOperation 建立預算。

const budgetOperation = {
  "campaignBudgetOperation": {
    "create": {
      "resourceName": `customers/${customerId}/campaignBudgets/${getNextTempId()}`,
      "name": "Demand Gen campaign budget",
      "amountMicros": "50000000",
      "deliveryMethod": "STANDARD",
      "explicitlyShared": false
    }
  }
}
operations.push(budgetOperation);

廣告活動

廣告活動必須參照預算,因此您需要上一步建立的確切預算資源名稱,才能找出並使用該特定預算物件。使用 CampaignOperation

const campaignOperation = {
  "campaignOperation": {
    "create": {
      "resourceName": `customers/${customerId}/campaigns/${getNextTempId()}`,
      "name": "Demand Gen campaign",
      "status": "PAUSED",
      "advertisingChannelType": "DEMAND_GEN",
      "campaignBudget": budgetOperation.campaignBudgetOperation.create.resourceName,
      "biddingStrategyType": "TARGET_CPA",
      "startDate": "20240314",
      "endDate": "20250313",
      "urlExpansionOptOut": false,
      "targetCpa": {
        "targetCpaMicros": 1000000
      },
      "containsEuPoliticalAdvertising": "DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING"
    }
  }
}
operations.push(campaignOperation);

廣告群組

廣告群組必須參照廣告活動,因此您需要上一步建立的確切廣告活動資源名稱,才能識別及使用該廣告活動物件。您也需要廣告群組本身的暫時 ID,最好將其儲存為新變數,以便在建立廣告群組廣告時使用。

為需求開發廣告活動建立廣告群組時,您也可以設定管道控制選項,決定廣告的顯示位置。與其他廣告活動類型不同,需求開發廣告活動建議每個廣告活動有多個廣告群組,因為系統會根據廣告群組成效分配預算。目前您只能使用 AdGroupOperation 建立一個廣告群組。

const adGroupId = getNextTempId();
const adGroupOperation = {
  "adGroupOperation": {
    "create": {
      "resourceName": `customers/${customerId}/adGroups/${adGroupId}`,
      "name": "Demand Gen ad group",
      "status": "PAUSED",
      "campaign": campaignOperation.campaignOperation.create.resourceName,
      "demand_gen_ad_group_settings": {
        "channel_controls": {
          "selected_channels": {
            "gmail": false,
            "discover": false,
            "display": false,
            "youtube_in_feed": true,
            "youtube_in_stream": true,
            "youtube_shorts": true
          }
        }
      }
    }
  }
}
operations.push(adGroupOperation);

含有巢狀廣告的廣告群組廣告

這個步驟會建立廣告群組廣告,將廣告群組與廣告連結。廣告群組廣告必須參照廣告群組,因此您需要上一個步驟中設定的確切資源名稱。您可以在同一個作業中建立廣告。 這裡顯示的範例會使用 DemandGenVideoResponsiveAdInfo 建立需求開發影片回應式廣告,您也可以調整範例,使用 DemandGenMultiAssetAdInfo 建立多素材資源廣告、使用 DemandGenCarouselAdInfo 建立輪轉廣告,或使用 DemandGenProductAdInfo 建立產品廣告。

如要建立廣告群組廣告,請使用與上一步建立的廣告群組 ID 變數相同的 AdGroupAdOperation

const adGroupAdOperation = {
  "adGroupAdOperation": {
    "create": {
      "resourceName": `customers/${customerId}/adGroupAds/${adGroupId}~${getNextTempId()}`,
      "adGroup": adGroupOperation.adGroupOperation.create.resourceName,
      "status": "PAUSED",
      "ad": {
        "name": "Demand Gen video responsive ad",
        "finalUrls": [
          "http://www.example.com"
        ],
        "demandGenVideoResponsiveAd": {
          "businessName": {
            "text": "Demand Gen business"
          },
          "videos": [
            { "asset": videoAsset.assetOperation.create.resourceName }
          ],
          "logoImages": [
            { "asset": imageAsset.assetOperation.create.resourceName }
          ],
          "headlines": [
            { "text": "Demand Gen responsive video" }
          ],
          "longHeadlines": [
            { "text": "Make a Demand Gen video responsive ad today" }
          ],
          "description": [
            { "text": "This is an example of a Demand Gen video responsive ad"}
          ]
        }
      }
    }
  }
}
operations.push(adGroupAdOperation);