Stay organized with collectionsSave and categorize content based on your preferences.
In Performance Max,conversion goalshelp guide
Google's algorithms to optimize ad serving and budget allocation that align
with your selectedcampaign bidding strategy. You can
explicitlyapply a subsetof yourcustomer goalsto a Performance Max
campaign. If you don't explicitly set conversion goals for a campaign, it
defaults to using all customer-level conversion goals.
Create a copy of eachCustomerConversionGoalas aCampaignConversionGoalobject. If
you want to apply a goal to your Performance Max campaign, as determined by
the unique combination ofcategoryandorigin, set thebiddablefield toTRUE.
Otherwise, setbiddabletoFALSE. Thebiddablefield specifies whether
theCampaignConversionGoalshould be used.
Issue a mutate request to update allCampaignConversionGoalswith the
updatedbiddablefield values.
defget_customer_conversion_goals(client:GoogleAdsClient,customer_id:str)->List[Dict[str,Union[ConversionActionCategoryEnum.ConversionActionCategory,ConversionOriginEnum.ConversionOrigin,],]]:"""Retrieves the list of customer conversion goals.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.Returns:a list of dicts containing the category and origin of customerconversion goals."""ga_service:GoogleAdsServiceClient=client.get_service("GoogleAdsService")customer_conversion_goals:List[Dict[str,Union[ConversionActionCategoryEnum.ConversionActionCategory,ConversionOriginEnum.ConversionOrigin,],]]=[]query:str="""SELECTcustomer_conversion_goal.category,customer_conversion_goal.originFROM customer_conversion_goal"""# The number of conversion goals is typically less than 50 so we use# GoogleAdsService.search instead of search_stream.search_request:SearchGoogleAdsRequest=client.get_type("SearchGoogleAdsRequest")search_request.customer_id=customer_idsearch_request.query=queryresults:SearchGoogleAdsResponse=ga_service.search(request=search_request)# Iterate over the results and build the list of conversion goals.forrowinresults:customer_conversion_goals.append({"category":row.customer_conversion_goal.category,"origin":row.customer_conversion_goal.origin,})returncustomer_conversion_goalsdefcreate_conversion_goal_operations(client:GoogleAdsClient,customer_id:str,customer_conversion_goals:List[Dict[str,Union[ConversionActionCategoryEnum.ConversionActionCategory,ConversionOriginEnum.ConversionOrigin,],]],)->List[MutateOperation]:"""Creates a list of MutateOperations that override customer conversion goals.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.customer_conversion_goals: the list of customer conversion goals thatwill be overridden.Returns:MutateOperations that update campaign conversion goals."""campaign_conversion_goal_service:CampaignConversionGoalServiceClient=(client.get_service("CampaignConversionGoalService"))operations:List[MutateOperation]=[]# To override the customer conversion goals, we will change the# biddability of each of the customer conversion goals so that only# the desired conversion goal is biddable in this campaign.forcustomer_goal_dictincustomer_conversion_goals:mutate_operation:MutateOperation=client.get_type("MutateOperation")campaign_conversion_goal:CampaignConversionGoal=(mutate_operation.campaign_conversion_goal_operation.update)category_enum_value:(ConversionActionCategoryEnum.ConversionActionCategory)=customer_goal_dict["category"]origin_enum_value:ConversionOriginEnum.ConversionOrigin=(customer_goal_dict["origin"])campaign_conversion_goal.resource_name=(campaign_conversion_goal_service.campaign_conversion_goal_path(customer_id,_PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID,category_enum_value.name,origin_enum_value.name,))# Change the biddability for the campaign conversion goal.# Set biddability to True for the desired (category, origin).# Set biddability to False for all other conversion goals.# Note:# 1- It is assumed that this Conversion Action# (category=PURCHASE, origin=WEBSITE) exists in this account.# 2- More than one goal can be biddable if desired. This example# shows only one.if(category_enum_value==client.enums.ConversionActionCategoryEnum.PURCHASEandorigin_enum_value==client.enums.ConversionOriginEnum.WEBSITE):biddable=Trueelse:biddable=Falsecampaign_conversion_goal.biddable=biddablefield_mask=protobuf_helpers.field_mask(None,campaign_conversion_goal._pb)client.copy_from(mutate_operation.campaign_conversion_goal_operation.update_mask,field_mask,)operations.append(mutate_operation)returnoperations
def_get_customer_conversion_goals(client,customer_id)query=<<~EODSELECTcustomer_conversion_goal.category,customer_conversion_goal.originFROMcustomer_conversion_goalEODcustomer_conversion_goals=[]ga_service=client.service.google_ads# The number of conversion goals is typically less than 50 so we use# GoogleAdsService.search instead of search_stream.response=ga_service.search(customer_id:customer_id,query:query,)# Iterate over the results and build the list of conversion goals.response.eachdo|row|customer_conversion_goals<<{"category"=>row.customer_conversion_goal.category,"origin"=>row.customer_conversion_goal.origin}endcustomer_conversion_goalsenddefcreate_conversion_goal_operations(client,customer_id,customer_conversion_goals)campaign_conversion_goal_service=client.service.campaign_conversion_goaloperations=[]# To override the customer conversion goals, we will change the# biddability of each of the customer conversion goals so that only# the desired conversion goal is biddable in this campaign.customer_conversion_goals.eachdo|customer_conversion_goal|operations<<client.operation.mutatedo|m|m.campaign_conversion_goal_operation=client.operation.campaign_conversion_goaldo|op|op.update=client.resource.campaign_conversion_goaldo|ccg|ccg.resource_name=client.path.campaign_conversion_goal(customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID,customer_conversion_goal["category"].to_s,customer_conversion_goal["origin"].to_s)# Change the biddability for the campaign conversion goal.# Set biddability to True for the desired (category, origin).# Set biddability to False for all other conversion goals.# Note:# 1- It is assumed that this Conversion Action# (category=PURCHASE, origin=WEBSITE) exists in this account.# 2- More than one goal can be biddable if desired. This example# shows only one.ccg.biddable=(customer_conversion_goal["category"]==:PURCHASE&&customer_conversion_goal["origin"]==:WEBSITE)endop.update_mask=Google::Ads::GoogleAds::FieldMaskUtil.all_set_fields_of(op.update)endendendoperationsend
subget_customer_conversion_goals{my($api_client,$customer_id)=@_;my$customer_conversion_goals=[];# Create a query that retrieves all customer conversion goals.my$query="SELECT customer_conversion_goal.category, customer_conversion_goal.origin "."FROM customer_conversion_goal";# The number of conversion goals is typically less than 50 so we use# GoogleAdsService->search() method instead of search_stream().my$search_response=$api_client->GoogleAdsService()->search({customerId=>$customer_id,query=>$query});# Iterate over the results and build the list of conversion goals.foreachmy$google_ads_row(@{$search_response->{results}}){push@$customer_conversion_goals,{category=>$google_ads_row->{customerConversionGoal}{category},origin=>$google_ads_row->{customerConversionGoal}{origin}};}return$customer_conversion_goals;}# Creates a list of MutateOperations that override customer conversion goals.subcreate_conversion_goal_operations{my($customer_id,$customer_conversion_goals)=@_;my$operations=[];# To override the customer conversion goals, we will change the biddability of# each of the customer conversion goals so that only the desired conversion goal# is biddable in this campaign.foreachmy$customer_conversion_goal(@$customer_conversion_goals){my$campaign_conversion_goal=Google::Ads::GoogleAds::V21::Resources::CampaignConversionGoal->new({resourceName=>Google::Ads::GoogleAds::V21::Utils::ResourceNames::campaign_conversion_goal($customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID,$customer_conversion_goal->{category},$customer_conversion_goal->{origin})});# Change the biddability for the campaign conversion goal.# Set biddability to true for the desired (category, origin).# Set biddability to false for all other conversion goals.# Note:# 1- It is assumed that this Conversion Action# (category=PURCHASE, origin=WEBSITE) exists in this account.# 2- More than one goal can be biddable if desired. This example# shows only one.if($customer_conversion_goal->{category}eqPURCHASE&&$customer_conversion_goal->{origin}eqWEBSITE){$campaign_conversion_goal->{biddable}="true";}else{$campaign_conversion_goal->{biddable}="false";}push@$operations,Google::Ads::GoogleAds::V21::Services::GoogleAdsService::MutateOperation->new({campaignConversionGoalOperation=>Google::Ads::GoogleAds::V21::Services::CampaignConversionGoalService::CampaignConversionGoalOperation->new({update=>$campaign_conversion_goal,# Set the update mask on the operation. Here the update mask will be# a list of all the fields that were set on the update object.updateMask=>all_set_fields_of($campaign_conversion_goal)})});}return$operations;}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eIn Performance Max campaigns, conversion goals guide Google's algorithms to optimize ad delivery and budget allocation based on your chosen bidding strategy.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify which of your customer-level conversion goals should be used for a Performance Max campaign, otherwise, it defaults to using all of them.\u003c/p\u003e\n"],["\u003cp\u003eTo set campaign conversion goals, you retrieve your existing customer conversion goals, create copies of them as campaign conversion goals, and then update their "biddable" status to indicate whether they should be used for optimization.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code examples demonstrate how to retrieve customer conversion goals and update their biddable status for a Performance Max campaign using the Google Ads API in various programming languages.\u003c/p\u003e\n"]]],[],null,[]]