Batch processing for Performance Max

  • Batch processing allows you to dispatch interdependent operations to multiple services without synchronous waiting, which is useful for creating and managing Performance Max campaigns.

  • Creating a Performance Max campaign using batch processing involves creating a batch job, preparing a list of mutate operations, adding the operations to the job, running the job, and retrieving its status and results.

  • Specific requirements exist for the order of CampaignOperation and CampaignAssetOperation when brand guidelines are enabled, and for AssetGroupOperation and AssetGroupAssetOperation due to how they are processed.

  • It is recommended to consecutively add AssetGroupListingGroupFilterOperation operations targeting the same AssetGroup when working with listing group filters in Performance Max campaigns for online sales with a product feed.

Batch processing provides a way to dispatch a set of operations, which can be interdependent, to multiple services without synchronously waiting for the operations to complete. You can use batch processing to create and manage Performance Max campaigns.

This guide provides details specific to Performance Max campaigns when you work with batch processing. The generic batch processing guide provides general information about batch processing, and the Structure requests guide contains detailed information about constructing requests to create or manage Performance Max campaigns.

To create a Performance Max campaign using batch processing, follow these steps:

Create a new batch job

Follow the general batch processing job creation step to create a BatchJob resource.

Prepare a list of mutate operations

Performance Max campaigns require operations to create several related resources, which are detailed in the Structure requests guide. Create a MutateOperation for each resource that should be included in the batch job.

CampaignOperation and CampaignAssetOperation requirements

When brand guidelines are enabled for a Performance Max Campaign (brand_guidelines_enabled defaults to true unless you set it to false or create a travel goals campaign), you must link brand Asset resources to the campaign by using CampaignAsset resources. Local Services Performance Max campaigns don't support brand guidelines and omit brand CampaignAsset resources (set brand_guidelines_enabled to false when creating the campaign). Retail Performance Max campaigns (with a Merchant Center feed) can omit brand CampaignAsset resources in the same atomic sub-batch only when you create an assetless campaign without custom AssetGroupAsset resources (other than HTML5 MEDIA_BUNDLE assets) or when brand_guidelines_enabled is set to false.

In a batch job, create these CampaignAsset resources immediately after you create the Campaign resource itself (up to 1,000 operations total in the atomic sub-batch). The Campaign create operation (resource_name) and its consecutive CampaignAsset create operations (campaign) must specify the same negative temporary ID, and any prerequisite AssetOperation create operations must be placed before the Campaign creation. If the CampaignAsset resources are not created immediately after the Campaign resource (when brand guidelines are enabled; see troubleshooting), the request fails and returns a CampaignError indicating missing assets. Including the CampaignAsset creation operations later in the same list of operations won't prevent this error.

AssetGroupOperation and AssetGroupAssetOperation requirements

When you create AssetGroup resources with associated Asset resources using AssetGroupAsset to meet the minimum asset requirements, the MutateOperation objects that create the AssetGroup and AssetGroupAsset resources in a batch job must be sequential without other operations in between because of how these operations are grouped into atomic sub-batches (up to 1,000 operations total per sub-batch). Specify the same negative temporary ID in the AssetGroup create operation (resource_name) and its consecutive AssetGroupAsset create operations (asset_group), and place any prerequisite AssetOperation create operations before the AssetGroup creation. Otherwise, the request fails with an AssetGroupError indicating some assets are missing, even if the operations required to meet minimum asset requirements are included later in the operations list.

AssetGroupListingGroupFilterOperation best practices

When you create, update, or remove AssetGroupListingGroupFilter resources, add all AssetGroupListingGroupFilterOperation operations targeting the same AssetGroup to the batch job consecutively so that the operations are grouped into an atomic sub-batch during batch splitting. For details on batch splitting and other factors affecting listing groups, see the listing group batch processing guide.

Add the mutate operations to the job

Add the mutate operations from Step 2 to a list and call the AddBatchJobOperations method to add the list of mutations to the batch job created in Step 1. Follow the add operations step in the general batch processing guide to add the list of mutate operations.

Run the batch job

Start running the uploaded operations by calling the RunBatchJob method. See the Run the batch job step in the general batch processing guide for an example.

Poll the job status and retrieve results

Batch jobs run as long-running operations and usually take time to finish. After you start the job, use the Operations.GetOperation method on the google.longrunning.Operations service (or query batch_job.status with GoogleAdsService) to poll the job's status until it's done.

When the batch job finishes, call the ListBatchJobResults method to retrieve the status and response for each operation in the job. For an example, see List all batch job results.