效果最大化广告系列可选组件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
转化目标
当您制作效果最大化广告系列时,系统会自动创建一系列与账号中的 CustomerConversionGoal
相匹配的转化目标。您可以更新这些设置,以便针对每个效果最大化广告系列进行自定义。
为此,您首先需要获取所有客户转化目标的列表。
const searchResults = AdsApp.search(
`SELECT
customer_conversion_goal.category,
customer_conversion_goal.origin
FROM customer_conversion_goal`
);
然后,您可以遍历返回的所有转化目标,并为当前的效果最大化广告系列创建更新操作,以针对每个目标自定义定位条件。以下代码将所有这些效果都设置为可出价,但您需要自定义该部分逻辑,以符合您希望通过广告系列实现的效果。
在运行此代码之前,您需要提取效果最大化广告系列的广告系列 ID。
我们建议您在单独的交易中设置转化目标,而不是在广告系列创建流程的其余部分中设置。
CampaignConversionGoalOperation
要求将请求的 partialFailure
设置为 false
。如果您想在首次创建广告系列时在同一事务中运行此代码,则必须将整个操作集设置为关闭部分失败。此示例代码演示了如何在单独的事务中执行此操作。
operations = [];
while (searchResults.hasNext()) {
const row = searchResults.next();
const conversionGoal = row.customerConversionGoal;
operations.push({
"campaignConversionGoalOperation": {
"update": {
"resourceName": `customers/${customerId}/campaignConversionGoals/${campaignId}~${conversionGoal.category}~${conversionGoal.origin}`,
// Insert your logic here to determine whether you want this particular
// campaign conversion goal to be biddable or not.
// This code will just default everything to being biddable, but that
// is not necessarily best for your use case.
"biddable": true
},
"updateMask": "biddable"
}
});
}
AdsApp.mutateAll(operations, {partialFailure: false});
广告系列定位
对于效果最大化广告系列中的广告系列定位,请务必查看 API 指南,以获取允许的条件类型的完整列表。
制作效果最大化广告系列不需要其他条件,但这些条件有助于根据您的使用情形来限制定位。以下代码示例展示了如何设置地理位置定位。如需了解其他条件类型的格式,您可以参阅 CampaignCriterion
文档。
您可以创建这些条件,并将其与广告系列本身一起作为对 mutateAll
的同一调用的组成部分,此代码示例假设您就是这样构建代码的。
operations.push({
"campaignCriterionOperation": {
"create": {
"campaign": campaignOperation.campaignOperation.create.resourceName,
"negative": false,
"location": {
// 1023191 represents New York City
"geoTargetConstant": "geoTargetConstants/1023191"
}
}
}
});
素材资源组信号
在开始之前,请先阅读 API 文档中有关素材资源组信号的内容。您可以通过将素材资源组与现有 AudienceInfo
或 SearchThemeInfo
条件相关联来设置这些条件。如果您想改用受众群体,请指定 audience
字段,而不是 searchTheme
字段,并使用受众群体的资源名称。
operations.push({
"assetGroupSignalOperation": {
"create": {
"assetGroup": assetGroupOperation.assetGroupOperation.create.resourceName,
"searchTheme": {
"text": "mars cruise"
}
}
}
});
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003ePerformance Max campaigns automatically generate conversion goals based on your existing customer conversion goals, which can be customized for bidding preferences.\u003c/p\u003e\n"],["\u003cp\u003eYou can refine Performance Max campaign targeting by adding criteria like location, though it's not mandatory for campaign creation.\u003c/p\u003e\n"],["\u003cp\u003eAsset group signals can be incorporated into Performance Max campaigns using either audience or search theme information, guiding ad delivery towards relevant user interests.\u003c/p\u003e\n"],["\u003cp\u003eGoogle recommends setting conversion goals in a separate transaction from the rest of the campaign creation process, to ensure smooth execution without partial failures.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the API guide for a complete list of criteria types allowed for campaign targeting and further details on asset group signals and their setup.\u003c/p\u003e\n"]]],[],null,["# Performance Max Optional Components\n\nConversion Goals\n----------------\n\nWhen you create a Performance Max campaign, a series of\n[conversion goals](/google-ads/api/performance-max/conversion-goals)\nare automatically created that match the\n[`CustomerConversionGoal`](/google-ads/api/reference/rpc/CustomerConversionGoal)s in the account. You\ncan customize these specifically for each of your Performance Max campaigns by\nupdating them.\n\nTo do so, first you need to fetch a list of all the customer conversion goals. \n\n const searchResults = AdsApp.search(\n `SELECT\n customer_conversion_goal.category,\n customer_conversion_goal.origin\n FROM customer_conversion_goal`\n );\n\nThen you can iterate through all of the conversion goals you got back and\ncreate an update operation for our current Performance Max campaign to\ncustomize the targeting for each goal. The code below sets all of them to\nbiddable, but you'll want to customize that portion of the logic to match what\nyou want to get out of your campaign.\n\nBefore running this code, you'll need to fetch the campaign ID for your\nPerformance Max campaign.\n\nWe recommend setting up conversion goals in a separate transaction from the\nrest of the campaign creation process.\n[`CampaignConversionGoalOperation`](/google-ads/api/reference/rpc/v21/CampaignConversionGoalOperation)\nrequires that `partialFailure` for the request be set to `false`. If you want\nto run this code in the same transaction where you first make the campaign, you\nmust set the entire set of operations to have partial failure turned off. This\nexample code demonstrates how to perform this operation in a *separate*\ntransaction. \n\n operations = [];\n while (searchResults.hasNext()) {\n const row = searchResults.next();\n const conversionGoal = row.customerConversionGoal;\n\n operations.push({\n \"campaignConversionGoalOperation\": {\n \"update\": {\n \"resourceName\": `customers/${customerId}/campaignConversionGoals/${campaignId}~${conversionGoal.category}~${conversionGoal.origin}`,\n // Insert your logic here to determine whether you want this particular\n // campaign conversion goal to be biddable or not.\n // This code will just default everything to being biddable, but that\n // is not necessarily best for your use case.\n \"biddable\": true\n },\n \"updateMask\": \"biddable\"\n }\n });\n }\n\n AdsApp.mutateAll(operations, {partialFailure: false});\n\nCampaign Targeting\n------------------\n\nFor campaign targeting in Performance Max, make sure to check out the\n[API guide](/google-ads/api/performance-max/create-campaign-criteria) for a\ncomplete list of allowable criteria types.\n\nAdditional criteria are not required to make a Performance Max campaign, but\ncan be useful to help restrict targeting based on your use case. The code\nexample below shows how to set up a geo location target. You can reference the\n[`CampaignCriterion`](/google-ads/api/reference/rpc/v21/CampaignCriterion#criterion) documentation\nfor the format for other criteria types.\n\nYou can create these criteria along with the campaign itself as part of the\nsame call to `mutateAll`, and this code example assumes that that's how you're\nstructuring your code. \n\n operations.push({\n \"campaignCriterionOperation\": {\n \"create\": {\n \"campaign\": campaignOperation.campaignOperation.create.resourceName,\n \"negative\": false,\n \"location\": {\n // 1023191 represents New York City\n \"geoTargetConstant\": \"geoTargetConstants/1023191\"\n }\n }\n }\n });\n\nAsset Group Signals\n-------------------\n\nRead about [asset group signals](/google-ads/api/performance-max/asset-group-signals)\non the API documentation before getting started. These are set up by linking an\nasset group to either an existing [`AudienceInfo`](/google-ads/api/reference/rpc/v21/AudienceInfo)\nor [`SearchThemeInfo`](/google-ads/api/reference/rpc/v21/SearchThemeInfo) criterion. If you want to\nuse an audience instead, specify the `audience` field instead of the\n`searchTheme` field with the audience's resource name. \n\n operations.push({\n \"assetGroupSignalOperation\": {\n \"create\": {\n \"assetGroup\": assetGroupOperation.assetGroupOperation.create.resourceName,\n \"searchTheme\": {\n \"text\": \"mars cruise\"\n }\n }\n }\n });"]]