Performance Max Optional Components Stay organized with collections Save and categorize content based on your preferences.
Conversion Goals
When you create a Performance Max campaign, a series ofconversiongoals are automaticallycreated that match theCustomerConversionGoal
s in the account. Youcan customize these specifically for each of your Performance Max campaigns byupdating them.
To do so, first you need to fetch a list of all the customer conversion goals.
constsearchResults=AdsApp.search(`SELECT customer_conversion_goal.category, customer_conversion_goal.origin FROM customer_conversion_goal`);
Then you can iterate through all of the conversion goals you got back andcreate an update operation for our current Performance Max campaign tocustomize the targeting for each goal. The code below sets all of them tobiddable, but you'll want to customize that portion of the logic to match whatyou want to get out of your campaign.
Before running this code, you'll need to fetch the campaign ID for yourPerformance Max campaign.
We recommend setting up conversion goals in a separate transaction from therest of the campaign creation process.CampaignConversionGoalOperation
requires thatpartialFailure
for the request be set tofalse
. If you wantto run this code in the same transaction where you first make the campaign, youmust set the entire set of operations to have partial failure turned off. Thisexample code demonstrates how to perform this operation in aseparatetransaction.
operations=[];while(searchResults.hasNext()){constrow=searchResults.next();constconversionGoal=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});
Campaign Targeting
For campaign targeting in Performance Max, make sure to check out theAPIguide for a completelist of allowable criteria types.
Additional criteria are not required to make a Performance Max campaign, butcan be useful to help restrict targeting based on your use case. The codeexample below shows how to set up a geo location target. You can reference theCampaignCriterion
documentationfor the format for other criteria types.
You can create these criteria along with the campaign itself as part of thesame call tomutateAll
, and this code example assumes that that's how you'restructuring your code.
operations.push({"campaignCriterionOperation":{"create":{"campaign":campaignOperation.campaignOperation.create.resourceName,"negative":false,"location":{// 1023191 represents New York City"geoTargetConstant":"geoTargetConstants/1023191"}}}});
Asset Group Signals
Read aboutasset groupsignals on the APIdocumentation before getting started. These are set up by linking an assetgroup to either an existingAudienceInfo
orSearchThemeInfo
criterion. If you want touse an audience instead, specify theaudience
field instead of thesearchTheme
field with the audience's resource name.
operations.push({"assetGroupSignalOperation":{"create":{"assetGroup":assetGroupOperation.assetGroupOperation.create.resourceName,"searchTheme":{"text":"mars cruise"}}}});
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-11 UTC.