效果最大化广告系列所需的组件

如需从头开始生成新的效果最大化广告系列,您必须至少制作以下内容:

广告系列和预算可用于制作各种类型的广告系列,而与素材资源相关的操作则特别适用于制作效果最大化广告系列。

请确保您熟悉 mutate 策略,因为本指南将仅提供要在 mutate 中使用的 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);

广告系列

该广告系列必须引用之前创建的预算,因此,除了使用临时 ID 指定自己的资源名称外,您还需要使用您在上一步中设置的确切资源名称来制作广告系列,这样才能唯一标识之前在此请求中创建的预算。使用 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
      }
    }
  }
}
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"
    }
  }
});