Stay organized with collectionsSave and categorize content based on your preferences.
Portfolio bidding strategiesare automated, goal-driven bidding strategies
that can be shared among multiple campaigns, whereasstandard bidding
strategiesare not shared and can only be used by a single campaign. The
API supports creating both types of strategies. Portfolio bidding strategies are
created as standalone objects in an account, whereas standard strategies are
managed by setting appropriate fields on a campaign.
# Create campaign.campaign_operation:CampaignOperation=client.get_type("CampaignOperation")campaign:Campaign=campaign_operation.createcampaign.name=f"Interplanetary Cruise{uuid.uuid4()}"campaign.advertising_channel_type=(client.enums.AdvertisingChannelTypeEnum.SEARCH)# Recommendation: Set the campaign to PAUSED when creating it to prevent the# ads from immediately serving. Set to ENABLED once you've added targeting# and the ads are ready to serve.campaign.status=client.enums.CampaignStatusEnum.PAUSED# Set the bidding strategy and budget.campaign.bidding_strategy=bidding_strategy_idcampaign.manual_cpc.enhanced_cpc_enabled=Truecampaign.campaign_budget=campaign_budget_id# Set the campaign network options.campaign.network_settings.target_google_search=Truecampaign.network_settings.target_search_network=Truecampaign.network_settings.target_content_network=Falsecampaign.network_settings.target_partner_search_network=Falsecampaign.contains_eu_political_advertising=(client.enums.EuPoliticalAdvertisingStatusEnum.DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING)
# Create a search campaign.my$campaign=Google::Ads::GoogleAds::V21::Resources::Campaign->new({name=>"Interplanetary Cruise #".uniqid(),advertisingChannelType=>SEARCH,# Recommendation: Set the campaign to PAUSED when creating it to stop# the ads from immediately serving. Set to ENABLED once you've added# targeting and the ads are ready to serve.status=>PAUSED,# Configures the campaign network options.networkSettings=>Google::Ads::GoogleAds::V21::Resources::NetworkSettings->new({targetGoogleSearch=>"true",targetSearchNetwork=>"true",targetContentNetwork=>"true"}),# Set the bidding strategy and budget.biddingStrategy=>$bidding_strategy_resource_name,campaignBudget=>$campaign_budget_resource_name,# Declare whether or not this campaign serves political ads targeting the EU.# Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and# DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.containsEuPoliticalAdvertising=>DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING});
An existing portfolio bidding strategy can belinkedto a shared budget.
Once the two are associated, the shared budget will always be associated with
the campaigns that are part of the bidding strategy.
You can only link together a portfolio bidding strategy and an existing shared
budget—you cannot create one of the two and immediately associate
it with the other.
To use a standard bidding strategy with your campaign, set the campaign as
follows:
Embed the bidding scheme to be used by setting thecampaign_bidding_strategyunion field. So for aTARGET_CPAbidding strategy, set the fieldtarget_cpawith a new bidding scheme
object of typeTargetCpa).
defcreate_performance_max_campaign_operation(client:GoogleAdsClient,customer_id:str,brand_guidelines_enabled:bool,)->MutateOperation:"""Creates a MutateOperation that creates a new Performance Max campaign.A temporary ID will be assigned to this campaign so that it canbe referenced by other objects being created in the same Mutate request.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.brand_guidelines_enabled: a boolean value indicating if the campaign isenabled for brand guidelines.Returns:a MutateOperation that creates a campaign."""mutate_operation:MutateOperation=client.get_type("MutateOperation")campaign:Campaign=mutate_operation.campaign_operation.createcampaign.name=f"Performance Max campaign #{uuid4()}"# Set the campaign status as PAUSED. The campaign is the only entity in# the mutate request that should have its status set.campaign.status=client.enums.CampaignStatusEnum.PAUSED# All Performance Max campaigns have an advertising_channel_type of# PERFORMANCE_MAX. The advertising_channel_sub_type should not be set.campaign.advertising_channel_type=(client.enums.AdvertisingChannelTypeEnum.PERFORMANCE_MAX)# Bidding strategy must be set directly on the campaign.# Setting a portfolio bidding strategy by resource name is not supported.# Max Conversion and Maximize Conversion Value are the only strategies# supported for Performance Max campaigns.# An optional ROAS (Return on Advertising Spend) can be set for# maximize_conversion_value. The ROAS value must be specified as a ratio in# the API. It is calculated by dividing "total value" by "total spend".# For more information on Maximize Conversion Value, see the support# article: http://support.google.com/google-ads/answer/7684216.# A target_roas of 3.5 corresponds to a 350% return on ad spend.campaign.bidding_strategy_type=(client.enums.BiddingStrategyTypeEnum.MAXIMIZE_CONVERSION_VALUE)campaign.maximize_conversion_value.target_roas=3.5# Set the Final URL expansion opt out. This flag is specific to# Performance Max campaigns. If opted out (True), only the final URLs in# the asset group or URLs specified in the advertiser's Google Merchant# Center or business data feeds are targeted.# If opted in (False), the entire domain will be targeted. For best# results, set this value to false to opt in and allow URL expansions. You# can optionally add exclusions to limit traffic to parts of your website.campaign.url_expansion_opt_out=False# Set if the campaign is enabled for brand guidelines. For more information# on brand guidelines, see https://support.google.com/google-ads/answer/14934472.campaign.brand_guidelines_enabled=brand_guidelines_enabled# Assign the resource name with a temporary ID.campaign_service:CampaignServiceClient=client.get_service("CampaignService")campaign.resource_name=campaign_service.campaign_path(customer_id,_PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)# Set the budget using the given budget resource name.campaign.campaign_budget=campaign_service.campaign_budget_path(customer_id,_BUDGET_TEMPORARY_ID)# Declare whether or not this campaign serves political ads targeting the# EU. Valid values are:# CONTAINS_EU_POLITICAL_ADVERTISING# DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISINGcampaign.contains_eu_political_advertising=(client.enums.EuPoliticalAdvertisingStatusEnum.DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING)# Optional fieldscampaign.start_date=(datetime.now()+timedelta(1)).strftime("%Y%m%d")campaign.end_date=(datetime.now()+timedelta(365)).strftime("%Y%m%d")returnmutate_operation
# Creates a MutateOperation that creates a new Performance Max campaign.## A temporary ID will be assigned to this campaign so that it can# be referenced by other objects being created in the same Mutate request.defcreate_performance_max_campaign_operation(client,customer_id,brand_guidelines_enabled)client.operation.mutatedo|m|m.campaign_operation=client.operation.create_resource.campaigndo|c|c.name="Performance Max campaign#{SecureRandom.uuid}"# Set the campaign status as PAUSED. The campaign is the only entity in# the mutate request that should have its status set.c.status=:PAUSED# All Performance Max campaigns have an advertising_channel_type of# PERFORMANCE_MAX. The advertising_channel_sub_type should not be set.c.advertising_channel_type=:PERFORMANCE_MAX# Bidding strategy must be set directly on the campaign.# Setting a portfolio bidding strategy by resource name is not supported.# Max Conversion and Maximize Conversion Value are the only strategies# supported for Performance Max campaigns.# An optional ROAS (Return on Advertising Spend) can be set for# maximize_conversion_value. The ROAS value must be specified as a ratio in# the API. It is calculated by dividing "total value" by "total spend".# For more information on Maximize Conversion Value, see the support# article: http://support.google.com/google-ads/answer/7684216.# A target_roas of 3.5 corresponds to a 350% return on ad spend.c.bidding_strategy_type=:MAXIMIZE_CONVERSION_VALUEc.maximize_conversion_value=client.resource.maximize_conversion_valuedo|mcv|mcv.target_roas=3.5end# Set the Final URL expansion opt out. This flag is specific to# Performance Max campaigns. If opted out (true), only the final URLs in# the asset group or URLs specified in the advertiser's Google Merchant# Center or business data feeds are targeted.# If opted in (false), the entire domain will be targeted. For best# results, set this value to false to opt in and allow URL expansions. You# can optionally add exclusions to limit traffic to parts of your website.c.url_expansion_opt_out=false# Set if the campaign is enabled for brand guidelines. For more# information on brand guidelines, see# https://support.google.com/google-ads/answer/14934472.c.brand_guidelines_enabled=brand_guidelines_enabled# Assign the resource name with a temporary ID.c.resource_name=client.path.campaign(customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)# Set the budget using the given budget resource name.c.campaign_budget=client.path.campaign_budget(customer_id,BUDGET_TEMPORARY_ID)# Declare whether or not this campaign serves political ads targeting the EU.# Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and# DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.c.contains_eu_political_advertising=:DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING# Optional fieldsc.start_date=DateTime.parse((Date.today+1).to_s).strftime('%Y%m%d')c.end_date=DateTime.parse(Date.today.next_year.to_s).strftime('%Y%m%d')endendend
subcreate_performance_max_campaign_operation{my($customer_id,$brand_guidelines_enabled)=@_;# Create a mutate operation that creates a campaign operation.returnGoogle::Ads::GoogleAds::V21::Services::GoogleAdsService::MutateOperation->new({campaignOperation=>Google::Ads::GoogleAds::V21::Services::CampaignService::CampaignOperation->new({create=>Google::Ads::GoogleAds::V21::Resources::Campaign->new({# Assign the resource name with a temporary ID.resourceName=>Google::Ads::GoogleAds::V21::Utils::ResourceNames::campaign($customer_id,PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID),name=>"Performance Max campaign #".uniqid(),# Set the budget using the given budget resource name.campaignBudget=>Google::Ads::GoogleAds::V21::Utils::ResourceNames::campaign_budget($customer_id,BUDGET_TEMPORARY_ID),# Set the campaign status as PAUSED. The campaign is the only entity in# the mutate request that should have its status set.status=>Google::Ads::GoogleAds::V21::Enums::CampaignStatusEnum::PAUSED,# All Performance Max campaigns have an advertisingChannelType of# PERFORMANCE_MAX. The advertisingChannelSubType should not be set.advertisingChannelType=>PERFORMANCE_MAX,# Bidding strategy must be set directly on the campaign.# Setting a portfolio bidding strategy by resource name is not supported.# Max Conversion and Maximize Conversion Value are the only strategies# supported for Performance Max campaigns.# An optional ROAS (Return on Advertising Spend) can be set for# maximizeConversionValue. The ROAS value must be specified as a ratio in# the API. It is calculated by dividing "total value" by "total spend".# For more information on Maximize Conversion Value, see the support# article: http://support.google.com/google-ads/answer/7684216.# A targetRoas of 3.5 corresponds to a 350% return on ad spend.maximizeConversionValue=>Google::Ads::GoogleAds::V21::Common::MaximizeConversionValue->new({targetRoas=>3.5}),# Set the final URL expansion opt out. This flag is specific to# Performance Max campaigns. If opted out (true), only the final URLs in# the asset group or URLs specified in the advertiser's Google Merchant# Center or business data feeds are targeted.# If opted in (false), the entire domain will be targeted. For best# results, set this value to false to opt in and allow URL expansions. You# can optionally add exclusions to limit traffic to parts of your website.urlExpansionOptOut=>"false",# Set if the campaign is enabled for brand guidelines. For more information# on brand guidelines, see https://support.google.com/google-ads/answer/14934472.brandGuidelinesEnabled=>$brand_guidelines_enabled,# Optional fields.startDate=>strftime("%Y%m%d",localtime(time+60*60*24)),endDate=>strftime("%Y%m%d",localtime(time+60*60*24*365)),# Declare whether or not this campaign serves political ads targeting the EU.# Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and# DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.containsEuPoliticalAdvertising=>DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING})})});}
[[["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\u003eGoogle Ads API facilitates management of two bidding strategy types: portfolio (shared across campaigns) and standard (campaign-specific).\u003c/p\u003e\n"],["\u003cp\u003ePortfolio strategies are created separately and linked to campaigns, while standard strategies are configured directly within the campaign settings.\u003c/p\u003e\n"],["\u003cp\u003ePerformance Max campaigns utilize standard bidding strategies and are optimized for automated performance, requiring specific settings like Maximize Conversion Value.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows for campaign creation, bidding strategy adjustments, and linking to shared budgets for portfolio strategies.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating campaigns, consider initial status (paused/enabled), bidding strategy, and URL expansion options for optimal performance.\u003c/p\u003e\n"]]],[],null,[]]