Create the campaign criteriaStay organized with collectionsSave and categorize content based on your preferences.
AI-generated Key Takeaways
Performance Max campaigns support various criteria types for targeting, including ad schedule, age range, brand, device, keyword, language, location, location group, and webpage.
Both positive and negative criteria can be applied, with the exception of brand and keyword criteria which can only be used negatively.
For location targeting, if no specific locations or location groups are set, the campaign will default to including all regions.
Performance Max campaigns allow for the inclusion of up to 10,000 negative keywords.
Negative webpage criteria can be utilized to exclude specific URLs from final URL expansion.
Performance Max campaigns support the following types of criteria:
Both positive and negative criteria can be used, except for theBRANDandKEYWORDcriterion type, which can only be used as negative to exclude brands
and keywords from targeting.
Forlocation targeting, a campaign with
no specified location or location groups defaults to including all regions.
Performance Max campaigns can have up to 10,000 negative keywords.
defcreate_campaign_criterion_operations(client:GoogleAdsClient,customer_id:str,)->List[MutateOperation]:"""Creates a list of MutateOperations that create new campaign criteria.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.Returns:a list of MutateOperations that create new campaign criteria."""campaign_service:CampaignServiceClient=client.get_service("CampaignService")geo_target_constant_service:GeoTargetConstantServiceClient=(client.get_service("GeoTargetConstantService"))googleads_service:GoogleAdsServiceClient=client.get_service("GoogleAdsService")operations:List[MutateOperation]=[]# Set the LOCATION campaign criteria.# Target all of New York City except Brooklyn.# Location IDs are listed here:# https://developers.google.com/google-ads/api/reference/data/geotargets# and they can also be retrieved using the GeoTargetConstantService as shown# here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting## We will add one positive location target for New York City (ID=1023191)# and one negative location target for Brooklyn (ID=1022762).# First, add the positive (negative = False) for New York City.mutate_operation:MutateOperation=client.get_type("MutateOperation")campaign_criterion:CampaignCriterion=(mutate_operation.campaign_criterion_operation.create)campaign_criterion.campaign=campaign_service.campaign_path(customer_id,_PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)campaign_criterion.location.geo_target_constant=(geo_target_constant_service.geo_target_constant_path("1023191"))campaign_criterion.negative=Falseoperations.append(mutate_operation)# Next add the negative target for Brooklyn.mutate_operation:MutateOperation=client.get_type("MutateOperation")campaign_criterion:CampaignCriterion=(mutate_operation.campaign_criterion_operation.create)campaign_criterion.campaign=campaign_service.campaign_path(customer_id,_PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)campaign_criterion.location.geo_target_constant=(geo_target_constant_service.geo_target_constant_path("1022762"))campaign_criterion.negative=Trueoperations.append(mutate_operation)# Set the LANGUAGE campaign criterion.mutate_operation:MutateOperation=client.get_type("MutateOperation")campaign_criterion:CampaignCriterion=(mutate_operation.campaign_criterion_operation.create)campaign_criterion.campaign=campaign_service.campaign_path(customer_id,_PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)# Set the language.# For a list of all language codes, see:# https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7campaign_criterion.language.language_constant=(googleads_service.language_constant_path("1000"))# Englishoperations.append(mutate_operation)returnoperations
# Creates a list of MutateOperations that create new campaign criteria.defcreate_campaign_criterion_operations(client,customer_id)operations=[]# Set the LOCATION campaign criteria.# Target all of New York City except Brooklyn.# Location IDs are listed here:# https://developers.google.com/google-ads/api/reference/data/geotargets# and they can also be retrieved using the GeoTargetConstantService as shown# here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting## We will add one positive location target for New York City (ID=1023191)# and one negative location target for Brooklyn (ID=1022762).# First, add the positive (negative = false) for New York City.operations<<client.operation.mutatedo|m|m.campaign_criterion_operation=client.operation.create_resource.campaign_criteriondo|cc|cc.campaign=client.path.campaign(customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)cc.location=client.resource.location_infodo|li|li.geo_target_constant=client.path.geo_target_constant("1023191")endcc.negative=falseendend# Next add the negative target for Brooklyn.operations<<client.operation.mutatedo|m|m.campaign_criterion_operation=client.operation.create_resource.campaign_criteriondo|cc|cc.campaign=client.path.campaign(customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)cc.location=client.resource.location_infodo|li|li.geo_target_constant=client.path.geo_target_constant("1022762")endcc.negative=trueendend# Set the LANGUAGE campaign criterion.operations<<client.operation.mutatedo|m|m.campaign_criterion_operation=client.operation.create_resource.campaign_criteriondo|cc|cc.campaign=client.path.campaign(customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)# Set the language.# For a list of all language codes, see:# https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7cc.language=client.resource.language_infodo|li|li.language_constant=client.path.language_constant("1000")# Englishendendendoperationsend
subcreate_campaign_criterion_operations{my($customer_id)=@_;my$operations=[];# Set the LOCATION campaign criteria.# Target all of New York City except Brooklyn.# Location IDs are listed here:# https://developers.google.com/google-ads/api/reference/data/geotargets# and they can also be retrieved using the GeoTargetConstantService as shown# here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting.## We will add one positive location target for New York City (ID=1023191)# and one negative location target for Brooklyn (ID=1022762).# First, add the positive (negative = false) for New York City.push@$operations,Google::Ads::GoogleAds::V22::Services::GoogleAdsService::MutateOperation->new({campaignCriterionOperation=>Google::Ads::GoogleAds::V22::Services::CampaignCriterionService::CampaignCriterionOperation->new({create=>Google::Ads::GoogleAds::V22::Resources::CampaignCriterion->new({campaign=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::campaign($customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID),location=>Google::Ads::GoogleAds::V22::Common::LocationInfo->new({geoTargetConstant=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::geo_target_constant(1023191)}),negative=>"false"})})});# Next add the negative target for Brooklyn.push@$operations,Google::Ads::GoogleAds::V22::Services::GoogleAdsService::MutateOperation->new({campaignCriterionOperation=>Google::Ads::GoogleAds::V22::Services::CampaignCriterionService::CampaignCriterionOperation->new({create=>Google::Ads::GoogleAds::V22::Resources::CampaignCriterion->new({campaign=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::campaign($customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID),location=>Google::Ads::GoogleAds::V22::Common::LocationInfo->new({geoTargetConstant=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::geo_target_constant(1022762)}),negative=>"true"})})});# Set the LANGUAGE campaign criterion.push@$operations,Google::Ads::GoogleAds::V22::Services::GoogleAdsService::MutateOperation->new({campaignCriterionOperation=>Google::Ads::GoogleAds::V22::Services::CampaignCriterionService::CampaignCriterionOperation->new({create=>Google::Ads::GoogleAds::V22::Resources::CampaignCriterion->new({campaign=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::campaign($customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID),# Set the language.# For a list of all language codes, see:# https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7.language=>Google::Ads::GoogleAds::V22::Common::LanguageInfo->new({languageConstant=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::language_constant(1000)# English})})})});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-11-05 UTC."],[],[]]