适用于效果最大化广告系列的批处理
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
批量处理提供了一种将一组可能相互依赖的操作分派给多个服务的方法,而无需同步等待操作完成。您可以使用批量处理来创建和管理效果最大化广告系列。
本指南详细介绍了在进行批量处理时,效果最大化广告系列的具体情况。通用批量处理指南提供了有关批量处理的一般信息,而构建请求指南则包含有关如何构建请求以创建或管理效果最大化广告系列的详细信息。
如需使用批量处理功能制作效果最大化广告系列,请按以下步骤操作:
创建新的批处理作业
按照创建 BatchJob
资源的一般批量处理作业创建步骤操作。
准备一系列 mutate 操作
效果最大化广告系列需要执行多项操作才能创建多个相关资源,详情请参阅结构化请求指南。为应包含在批处理作业中的每项资源创建一个 MutateOperation
。
CampaignOperation
和 CampaignAssetOperation
要求
如果为广告系列启用了品牌推广指南(请参阅品牌推广指南),您必须使用 CampaignAsset
资源将品牌推广素材资源与广告系列相关联。此外,在批处理作业中,这些 CampaignAsset
资源的创建必须在 Campaign
资源本身创建后立即进行。如果 Campaign
资源创建后未立即创建 CampaignAsset
资源(启用品牌推广指南时 - 请参阅问题排查),请求将失败并返回 CampaignError
,表明缺少素材资源。即使在同一操作列表中稍后添加 CampaignAsset
创建操作,也不会阻止此错误。
AssetGroupOperation
和 AssetGroupAssetOperation
要求
在批处理作业中创建 AssetGroup
和 AssetGroupAsset
资源的 MutateOperation
类型操作必须是连续的,中间不能有其他操作,因为这些操作在处理时会分组在一起。否则,即使操作列表中稍后包含满足最低素材资源要求所需的操作,请求也会抛出 AssetGroupError
,表明缺少某些素材资源。
AssetGroupListingGroupFilterOperation
最佳实践
在 AssetGroupListingGroupFilter
的上下文中处理商品详情组过滤条件时,建议将针对同一 AssetGroup
的 AssetGroupListingGroupFilterOperation
操作连续添加到批处理作业中,以便在批处理拆分期间将这组操作视为原子操作。如需详细了解批次拆分以及影响商品详情组的其他因素,请参阅商品详情组批处理指南。
将变异操作添加到作业中
将第 2 步中的 mutate 操作添加到一个列表,然后调用 AddBatchJobOperations
,以将突变列表添加到第 1 步中创建的批处理作业。按照常规批量处理指南中的添加操作步骤添加 mutate 操作列表。
运行批处理作业
通过调用 RunBatchJob
允许上传的作业开始运行。如需查看示例,请参阅常规批量处理指南中的运行批处理作业步骤。
检索作业的状态
批量作业会以长时间运行的操作开始,通常需要一段时间才能完成。
开始作业后,使用长时间运行的操作的 GetOperation
方法轮询作业的状态,直到作业完成。
当所有批处理作业完成后,请按照常规批处理指南中的列出所有批处理作业结果步骤,调用 ListBatchJobResults
以打印其状态和响应。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003eBatch processing allows you to execute a series of interdependent operations across Google Ads services, including creating and managing Performance Max campaigns, without waiting for each operation to complete individually.\u003c/p\u003e\n"],["\u003cp\u003eCreating a Performance Max campaign with batch processing involves preparing a list of \u003ccode\u003eMutateOperation\u003c/code\u003e objects, each defining a resource to be created or modified, such as an asset group or listing group filter.\u003c/p\u003e\n"],["\u003cp\u003eOperations involving \u003ccode\u003eAssetGroup\u003c/code\u003e and \u003ccode\u003eAssetGroupAsset\u003c/code\u003e resources should be sequential within the batch job due to their interdependencies and asset requirements.\u003c/p\u003e\n"],["\u003cp\u003eWhen using \u003ccode\u003eAssetGroupListingGroupFilter\u003c/code\u003e for Performance Max campaigns with online sales, it's recommended to add operations targeting the same \u003ccode\u003eAssetGroup\u003c/code\u003e consecutively to ensure atomic processing.\u003c/p\u003e\n"],["\u003cp\u003eThe batch job is executed asynchronously, requiring you to monitor its status using the \u003ccode\u003eGetOperation\u003c/code\u003e method until completion and then retrieve results using \u003ccode\u003eListBatchJobResults\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Batch Processing for Performance Max\n\n[Batch processing](/google-ads/api/docs/batch-processing/overview) provides a way to dispatch\na set of operations, which may be interdependent, to multiple services without\nsynchronously waiting for the operations to complete. You can use batch\nprocessing to create and manage Performance Max campaigns.\n\nThis guide provides details specific to Performance Max campaigns when working\nwith batch processing. The generic\n[batch processing guide](/google-ads/api/docs/batch-processing/overview) provides general\ninformation about batch processing, and the\n[Structure requests guide](/google-ads/api/performance-max/structure-requests) contains detailed\ninformation about constructing requests to create or manage Performance Max\ncampaigns.\n\nTo create a Performance Max campaign using batch processing, follow these steps:\n\nCreate a new batch job\n----------------------\n\nFollow the general batch processing\n[job creation step](/google-ads/api/docs/batch-processing/flow#createjob) for creating a\n[`BatchJob`](/google-ads/api/reference/rpc/v21/BatchJob) resource.\n\nPrepare a list of mutate operations\n-----------------------------------\n\nPerformance Max campaigns require operations to create several related\nresources, which are detailed in the\n[Structure requests guide](/google-ads/api/performance-max/structure-requests). Create a\n[`MutateOperation`](/google-ads/api/reference/rpc/v21/MutateOperation) for each resource that should\nbe included in the batch job.\n\n### `CampaignOperation` and `CampaignAssetOperation` requirements\n\n| **Note:** this requirement only applies to [`Campaign`](/google-ads/api/reference/rpc/v21/Campaign) resources with associated [`Asset`](/google-ads/api/reference/rpc/v21/Asset) resources using [`CampaignAsset`](/google-ads/api/reference/rpc/v21/CampaignAsset) in order to meet the [brand asset requirements](/google-ads/api/performance-max/create-campaign#brand-guidelines).\n\nWhen brand guidelines are enabled for a campaign (see\n[brand guidelines](/google-ads/api/performance-max/create-campaign#brand-guidelines)), you must link\nbrand assets to the campaign using [`CampaignAsset`](/google-ads/api/reference/rpc/v21/CampaignAsset)\nresources. Furthermore, in a batch job the creation of these `CampaignAsset`\nresources must happen immediately after the creation of the [`Campaign`](/google-ads/api/reference/rpc/v21/Campaign)\nresource itself. If the `CampaignAsset` resources are not created immediately\nafter the `Campaign` resource (when brand guidelines are enabled - see\n[troubleshooting](/google-ads/api/performance-max/troubleshooting#campaigns_with_brand_guidelines_enabled)),\nthe request will fail and return a `CampaignError` indicating missing assets.\nIncluding the `CampaignAsset` creation operations later in the same list of\noperations won't prevent this error.\n\n### `AssetGroupOperation` and `AssetGroupAssetOperation` requirements\n\n| **Note:** this requirement only applies to [`AssetGroup`](/google-ads/api/reference/rpc/v21/AssetGroup) resources with associated [`Asset`](/google-ads/api/reference/rpc/v21/Asset) resources using [`AssetGroupAsset`](/google-ads/api/reference/rpc/v21/AssetGroupAsset) in order to adhere to the [minimum asset requirements](/google-ads/api/performance-max/asset-requirements).\n\nThe operations of type [`MutateOperation`](/google-ads/api/reference/rpc/v21/MutateOperation) that\ncreate [`AssetGroup`](/google-ads/api/reference/rpc/v21/AssetGroup) and\n[`AssetGroupAsset`](/google-ads/api/reference/rpc/v21/AssetGroupAsset) resources in a batch job must\nbe sequential without other operations in between because of how these\noperations are grouped together when processed. Otherwise, the request throws an\n[`AssetGroupError` indicating some assets are missing](/google-ads/api/performance-max/troubleshooting#common_asset_group_errors),\neven if the operations required to\n[meet minimum asset requirements](/google-ads/api/performance-max/asset-requirements) are included later\nin the operations list.\n\n### `AssetGroupListingGroupFilterOperation` best practices\n\n| **Note:** [`AssetGroupListingGroupFilter`](/google-ads/api/reference/rpc/v21/AssetGroupListingGroupFilter) resources may only be used with Performance Max campaigns for [online sales with a product feed](/google-ads/api/performance-max/retail). [`AssetGroup`](/google-ads/api/reference/rpc/v21/AssetGroup) resources in such campaigns must have a [valid product group tree](/google-ads/api/performance-max/listing-groups) composed of one or more [`AssetGroupListingGroupFilter`](/google-ads/api/reference/rpc/v21/AssetGroupListingGroupFilter) resources associated with it. To target all products, use a single node tree.\n\nWhen working with listing group filters in the context of an\n[`AssetGroupListingGroupFilter`](/google-ads/api/reference/rpc/v21/AssetGroupListingGroupFilter), we\nrecommend adding\n[`AssetGroupListingGroupFilterOperation`](/google-ads/api/reference/rpc/v21/AssetGroupListingGroupFilterOperation)\noperations targeting the same [`AssetGroup`](/google-ads/api/reference/rpc/v21/AssetGroup) to a\nbatch job consecutively, so that the set of operations are treated atomically\nduring batch splitting. To read more on batch splitting and other factors\naffecting listing groups, see the\n[listing group batch processing guide](/google-ads/api/docs/batch-processing/listing-groups).\n\nAdd the mutate operations to the job\n------------------------------------\n\nAdd the mutate operations from [Step 2](#prepareoperations) to a list and call\n[`AddBatchJobOperations`](/google-ads/api/reference/rpc/v21/BatchJobService#addbatchjoboperations)\nto add the list of mutations to the batch job created in [Step 1](#createjob).\nFollow the [add operations step](/google-ads/api/docs/batch-processing/flow#addoperations)\nin the general batch processing guide to add the list of mutate operations.\n\nRun the batch job\n-----------------\n\nAllow the uploaded jobs to start running by calling\n[`RunBatchJob`](/google-ads/api/reference/rpc/v21/BatchJobService#runbatchjob). See\n[Run the batch job](/google-ads/api/docs/batch-processing/flow#runjob)\nstep in the general batch processing guide for an example.\n\nRetrieve the job's status\n-------------------------\n\nBatch jobs start as long-running operations and usually take time to finish.\nAfter starting the job, use the long-running operation's\n[`GetOperation`](/google-ads/api/reference/rpc/google.longrunning#google.longrunning.Operations.GetOperation)\nmethod to [poll the job's status](/google-ads/api/docs/batch-processing/flow#pollstatus)\nuntil it's done.\n\nWhen all of your batch jobs finish, call\n[`ListBatchJobResults`](/google-ads/api/reference/rpc/v21/BatchJobService#listbatchjobresults) to\nprint their statuses and responses following the\n[list all batch job results](/google-ads/api/docs/batch-processing/flow#listresults) step in\nthe general batch processing guide."]]