最高成效廣告活動的必要元件

如要從頭產生新的最高成效廣告活動,您至少必須建立下列項目:

廣告活動和預算適用於建立各種廣告活動類型,而與素材資源相關的作業則特別適用於建立最高成效廣告活動。請參閱最高成效素材資源指南,瞭解如何使用指令碼建立素材資源。

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

預算

預算不得共用,且在帳戶中不得重複。使用 CampaignBudgetOperation

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

廣告活動

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

const campaignOperation = {
  "campaignOperation": {
    "create": {
      "resourceName": `customers/${customerId}/campaigns/${getNextTempId()}`,
      "name": "Performance Max campaign",
      "status": "PAUSED",
      "advertisingChannelType": "PERFORMANCE_MAX",
      "campaignBudget": budgetOperation.campaignBudgetOperation.create.resourceName,
      "biddingStrategyType": "MAXIMIZE_CONVERSION_VALUE",
      "startDate": "20240314",
      "endDate": "20250313",
      "urlExpansionOptOut": false,
      "maximizeConversionValue": {
        "targetRoas": 3.5
      },
      "containsEuPoliticalAdvertising": "DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING"
    }
  }
}
operations.push(campaignOperation);

素材資源群組

這個廣告活動的素材資源群組需要參照廣告活動,且日後將素材資源連結至該群組時,也需要參照廣告活動。使用 AssetGroupOperation

const assetGroupOperation = {
  "assetGroupOperation": {
    "create": {
      "resourceName": `customers/${customerId}/assetGroups/${getNextTempId()}`,
      "campaign": campaignOperation.campaignOperation.create.resourceName,
      "name": "Performance Max asset group",
      "finalUrls": [
        "http://www.example.com"
      ],
      "finalMobileUrls": [
        "http://www.example.com"
      ],
      "status": "PAUSED"
    }
  }
}
operations.push(assetGroupOperation);

現在您已準備好素材資源群組和素材資源 (上一個步驟),接下來需要將兩者連結,最高成效廣告活動才能知道要使用哪些素材資源。您必須在最初建立資產群組的同一項要求中執行這項操作。如要執行這項操作,請使用 AssetGroupAssetOperation

您需要提供正確的資產資源名稱,並將 fieldType 修改為要連結的資產適當值。請參閱有效欄位類型的完整清單

您需要執行多項這類作業,才能達到最高成效廣告活動的最低規定

operations.push({
  "assetGroupAssetOperation": {
    "create": {
      "assetGroup": assetGroupOperation.assetGroupOperation.create.resourceName,
      // assetResourceName here is a placeholder; you will need to determine
      // the correct resource name to use depending on which asset you want
      // to add to the asset group.
      "asset": assetResourceName,
      "fieldType": "HEADLINE"
    }
  }
});