Get keyword theme, budget, and ad text asset suggestions
Stay organized with collections
Save and categorize content based on your preferences.
Page Summary
The Google Ads API provides the SmartCampaignSuggestService to help configure Smart campaigns by suggesting details based on business information.
A SmartCampaignSuggestionInfo instance containing business details like a landing page is essential for generating these suggestions.
The SuggestKeywordThemes method is recommended for generating keyword themes, but alternatives exist like KeywordThemeConstantService or manually creating free-form keyword themes.
The SuggestSmartCampaignBudgetOptions method offers low, high, and recommended daily budget tiers with estimated clicks.
The SuggestSmartCampaignAd method suggests headlines and descriptions for ads, which should be reviewed before use.
The Google Ads API exposes the
SmartCampaignSuggestService
to suggest configuration details when creating Smart campaigns. It uses
details about the business being advertised (in the form of a
SmartCampaignSuggestionInfo
instance) to suggest keyword themes, a budget amount, as well as headlines and
descriptions for the individual ads.
Create a SmartCampaignSuggestionInfo instance
To generate Smart campaign suggestions, you require the use of a
SmartCampaignSuggestionInfo
instance that contains details about the business being advertised. Because it's
possible to use the same SmartCampaignSuggestionInfo instance to retrieve all
different types of Smart campaign suggestions, you can first create one and
reuse it multiple times.
Key requirements for SmartCampaignSuggestionInfo:
A landing page. This can be either an existing website
(final_url) or an
automatic landing
page created for your
campaign using Business Profile information obtained with the
business_profile_location
identifier. If you plan to use an automatic landing page, be sure to set the
business_profile_location field when generating suggestions.
If final_url is set, then either business_profile_location or
business_name can be set.
If final_url is not set, then business_profile_location must be set.
When used to retrieve keyword theme suggestions from the
SuggestKeywordThemes
method, it's not necessary to set the keyword_themes field.
When used to retrieve ad suggestions from the
SuggestSmartCampaignAd
method, the language_code, and keyword_themes fields are
required.
As many details as possible should be added to the object for optimal
suggestions.
defget_smart_campaign_suggestion_info(client:GoogleAdsClient,business_profile_location:Optional[str],business_name:Optional[str],)-> SmartCampaignSuggestionInfo:"""Builds a SmartCampaignSuggestionInfo object with business details. The details are used by the SmartCampaignSuggestService to suggest a budget amount as well as creatives for the ad. Note that when retrieving ad creative suggestions it's required that the "final_url", "language_code" and "keyword_themes" fields are set on the SmartCampaignSuggestionInfo instance. Args: client: an initialized GoogleAdsClient instance. business_profile_location: the resource name of a Business Profile location. business_name: the name of a Business Profile. Returns: A SmartCampaignSuggestionInfo instance. """suggestion_info:SmartCampaignSuggestionInfo=client.get_type("SmartCampaignSuggestionInfo")# Add the URL of the campaign's landing page.suggestion_info.final_url=_LANDING_PAGE_URL# Add the language code for the campaign.suggestion_info.language_code=_LANGUAGE_CODE# Construct location information using the given geo target constant. It's# also possible to provide a geographic proximity using the "proximity"# field on suggestion_info, for example:## suggestion_info.proximity.address.post_code = INSERT_POSTAL_CODE# suggestion_info.proximity.address.province_code = INSERT_PROVINCE_CODE# suggestion_info.proximity.address.country_code = INSERT_COUNTRY_CODE# suggestion_info.proximity.address.province_name = INSERT_PROVINCE_NAME# suggestion_info.proximity.address.street_address = INSERT_STREET_ADDRESS# suggestion_info.proximity.address.street_address2 = INSERT_STREET_ADDRESS_2# suggestion_info.proximity.address.city_name = INSERT_CITY_NAME# suggestion_info.proximity.radius = INSERT_RADIUS# suggestion_info.proximity.radius_units = RADIUS_UNITS## For more information on proximities see:# https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfolocation:LocationInfo=client.get_type("LocationInfo")# Set the location to the resource name of the given geo target constant.location.geo_target_constant=client.get_service("GeoTargetConstantService").geo_target_constant_path(_GEO_TARGET_CONSTANT)# Add the LocationInfo object to the list of locations on the# suggestion_info object. You have the option of providing multiple# locations when using location-based suggestions.suggestion_info.location_list.locations.append(location)# Set either of the business_profile_location or business_name, depending on# whichever is provided.ifbusiness_profile_location:suggestion_info.business_profile_location=business_profile_locationelse:suggestion_info.business_context.business_name=business_name# Add a schedule detailing which days of the week the business is open.# This schedule describes a schedule in which the business is open on# Mondays from 9am to 5pm.ad_schedule_info:AdScheduleInfo=client.get_type("AdScheduleInfo")# Set the day of this schedule as Monday.ad_schedule_info.day_of_week=client.enums.DayOfWeekEnum.MONDAY# Set the start hour to 9am.ad_schedule_info.start_hour=9# Set the end hour to 5pm.ad_schedule_info.end_hour=17# Set the start and end minute of zero, for example: 9:00 and 5:00.zero_minute_of_hour:MinuteOfHourEnum.MinuteOfHour=(client.enums.MinuteOfHourEnum.ZERO)ad_schedule_info.start_minute=zero_minute_of_hourad_schedule_info.end_minute=zero_minute_of_hoursuggestion_info.ad_schedules.append(ad_schedule_info)returnsuggestion_info
# Builds a SmartCampaignSuggestionInfo object with business details.## The details are used by the SmartCampaignSuggestService to suggest a# budget amount as well as creatives for the ad.## Note that when retrieving ad creative suggestions it's required that the# "final_url", "language_code" and "keyword_themes" fields are set on the# SmartCampaignSuggestionInfo instance.defget_smart_campaign_suggestion_info(client,business_profile_location,business_name)# Since these suggestions are for a new campaign, we're going to# use the suggestion_info field instead.suggestion_info=client.resource.smart_campaign_suggestion_infodo|si|# Adds the URL of the campaign's landing page.si.final_url=LANDING_PAGE_URL# Add the language code for the campaign.si.language_code=LANGUAGE_CODE# Constructs location information using the given geo target constant. It's# also possible to provide a geographic proximity using the "proximity"# field on suggestion_info, for example:# si.proximity = client.resource.proximity_info do |proximity|# proximity.address = client.resource.address_info do |address|# address.post_code = INSERT_POSTAL_CODE# address.province_code = INSERT_PROVINCE_CODE# address.country_code = INSERT_COUNTRY_CODE# address.province_name = INSERT_PROVINCE_NAME# address.street_address = INSERT_STREET_ADDRESS# address.street_address2 = INSERT_STREET_ADDRESS_2# address.city_name = INSERT_CITY_NAME# end# proximity.radius = INSERT_RADIUS# proximity.radius_units = :INSERT_RADIUS_UNIT_ENUM# end## For more information on proximities see:# https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfosi.location_list=client.resource.location_listdo|loc_list|# Adds the location_info object to the list of locations on the# suggestion_info object. You have the option of providing multiple# locations when using location-based suggestions.loc_list.locations << client.resource.location_infodo|li|li.geo_target_constant=client.path.geo_target_constant(GEO_TARGET_CONSTANT)endend# Set either of the business_profile_location or business_name, depending on# whichever is provided.ifbusiness_profile_locationsi.business_profile_location=business_profile_locationelsesi.business_context=client.resource.business_contextdo|bc|bc.business_name=business_nameendend# Adds a schedule detailing which days of the week the business is open.# This schedule describes a schedule in which the business is open on# Mondays from 9am to 5pm.si.ad_schedules+=[client.resource.ad_schedule_infodo|as|# Sets the day of this schedule as Monday.as.day_of_week=:MONDAY# Sets the start hour to 9:00am.as.start_hour=9as.start_minute=:ZERO# Sets the end hour to 5:00pm.as.end_hour=17as.end_minute=:ZEROend]endsuggestion_infoend
# Builds a SmartCampaignSuggestionInfo object with business details.# The details are used by the SmartCampaignSuggestService to suggest a budget# amount as well as creatives for the ad.# Note that when retrieving ad creative suggestions you must set the# "final_url", "language_code" and "keyword_themes" fields on the# SmartCampaignSuggestionInfo instance.sub_get_smart_campaign_suggestion_info{my($business_profile_location,$business_name)=@_;my$suggestion_info=Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::SmartCampaignSuggestionInfo->new({# Add the URL of the campaign's landing page.finalUrl=>LANDING_PAGE_URL,# Add the language code for the campaign.languageCode=>LANGUAGE_CODE,# Construct location information using the given geo target constant.# It's also possible to provide a geographic proximity using the# "proximity" field on suggestion_info, for example:## proximity => Google::Ads::GoogleAds::V22::Common::ProximityInfo->new({# address => Google::Ads::GoogleAds::V22::Common::AddressInfo->new({# postalCode => "INSERT_POSTAL_CODE",# provinceCode => "INSERT_PROVINCE_CODE",# countryCode => "INSERT_COUNTRY_CODE",# provinceName => "INSERT_PROVINCE_NAME",# streetAddress => "INSERT_STREET_ADDRESS",# streetAddress2 => "INSERT_STREET_ADDRESS_2",# cityName => "INSERT_CITY_NAME"# }# ),# radius => "INSERT_RADIUS",# radiusUnits => MILES# }# ),## For more information on proximities see:# https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfolocationList=>
Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::LocationList->new()});# Add the LocationInfo object to the list of locations on the SuggestionInfo# object. You have the option of providing multiple locations when using# location-based suggestions.push@{$suggestion_info->{locationList}{locations}},Google::Ads::GoogleAds::V22::Common::LocationInfo->new({# Set the location to the resource name of the given geo target constant.geoTargetConstant=>
Google::Ads::GoogleAds::V22::Utils::ResourceNames::geo_target_constant(GEO_TARGET_CONSTANT)});# Set one of the business_profile_location or business_name, whichever is provided.if(defined$business_profile_location){$suggestion_info->{businessProfileLocation}=_convert_business_profile_location($business_profile_location);}else{$suggestion_info->{businessContext}=Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::BusinessContext->new({businessName=>$business_name});}# Add a schedule detailing which days of the week the business is open. This# example schedule describes a business that is open on Mondays from 9:00 AM# to 5:00 PM.push@{$suggestion_info->{adSchedules}},Google::Ads::GoogleAds::V22::Common::AdScheduleInfo->new({# Set the day of this schedule as Monday.dayOfWeek=>MONDAY,# Set the start hour to 9 AM.startHour=>9,# Set the end hour to 5 PM.endHour=>17,# Set the start and end minutes to zero.startMinute=>ZERO,endMinute=>ZERO});return$suggestion_info;}
A keyword theme is a
single word or phrase that represents a group of related search terms. For
example "bakery" is related to "bakery near me" and "local bakery." They are
represented in the Google Ads API by the
KeywordTheme
resource, which is usually attached to a KeywordThemeInfo
instance, and can either be a
KeywordThemeConstant
or a
free-form keyword theme.
Suggested keyword themes
Given a SmartCampaignSuggestionInfo instance, the
SuggestKeywordThemes
service method suggests keyword themes using the details of your business, its
location, and website content.
To fully optimize the performance of your Smart campaign, use the
SuggestKeywordThemes method when creating keyword themes. Because it
aggregates specific details about the business and its website, it generates
significantly better keyword themes than the other two strategies, which are
best considered as back-up options.
defget_keyword_theme_suggestions(client:GoogleAdsClient,customer_id:str,suggestion_info:SmartCampaignSuggestionInfo,)-> List[SuggestKeywordThemesResponse.KeywordTheme]:"""Retrieves KeywordThemes using the given suggestion info. Here we use the SuggestKeywordThemes method, which uses all of the business details included in the given SmartCampaignSuggestionInfo instance to generate keyword theme suggestions. This is the recommended way to generate keyword themes because it uses detailed information about your business, its location, and website content to generate keyword themes. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. suggestion_info: a SmartCampaignSuggestionInfo instance with details about the business being advertised. Returns: a list of KeywordThemes. """smart_campaign_suggest_service:SmartCampaignSuggestServiceClient=(client.get_service("SmartCampaignSuggestService"))request:SuggestKeywordThemesRequest=client.get_type("SuggestKeywordThemesRequest")request.customer_id=customer_idrequest.suggestion_info=suggestion_inforesponse:SuggestKeywordThemesResponse=(smart_campaign_suggest_service.suggest_keyword_themes(request=request))print(f"Retrieved {len(response.keyword_themes)} keyword theme suggestions ""from the SuggestKeywordThemes method.")returnresponse.keyword_themes
# Retrieves KeywordThemes using the given suggestion info.# Here we use the SuggestKeywordThemes method, which uses all of the business# details included in the given SmartCampaignSuggestionInfo instance to generate# keyword theme suggestions. This is the recommended way to generate keyword themes# because it uses detailed information about your business, its location, and# website content to generate keyword themes.sub_get_keyword_theme_suggestions{my($api_client,$customer_id,$suggestion_info)=@_;my$response=$api_client->SmartCampaignSuggestService()->suggest_keyword_themes(Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::SuggestKeywordThemesRequest->new({customerId=>$customer_id,suggestionInfo=>$suggestion_info}));printf"Retrieved %d keyword theme suggestions from the SuggestKeywordThemes"."method.\n",scalar@{$response->{keywordThemes}};return$response->{keywordThemes};}
Given a word or phrase, the KeywordThemeConstantService suggests
KeywordThemeConstants which are derived from auto-complete data for the
given text. This strategy is a useful alternative if, for example, the
business being advertised doesn't have a website or enough information to take
advantage of the SuggestKeywordThemes method. This method should only be used
if the SuggestKeywordThemes method can't be used or returns insufficient
suggestions.
defget_keyword_text_auto_completions(client:GoogleAdsClient,keyword_text:str)-> List[SuggestKeywordThemesResponse.KeywordTheme]:"""Retrieves KeywordThemeConstants for the given keyword text. These KeywordThemeConstants are derived from autocomplete data for the given keyword text. They are mapped to KeywordThemes before being returned. Args: client: an initialized GoogleAdsClient instance. keyword_text: a keyword used for generating keyword themes. Returns: a list of KeywordThemes. """keyword_theme_constant_service:KeywordThemeConstantServiceClient=(client.get_service("KeywordThemeConstantService"))request:SuggestKeywordThemeConstantsRequest=client.get_type("SuggestKeywordThemeConstantsRequest")request.query_text=keyword_textrequest.country_code=_COUNTRY_CODErequest.language_code=_LANGUAGE_CODEresponse:SuggestKeywordThemeConstantsResponse=(keyword_theme_constant_service.suggest_keyword_theme_constants(request=request))print(f"Retrieved {len(response.keyword_theme_constants)} keyword theme "f"constants using the keyword: '{keyword_text}'")# Map the keyword theme constants to KeywordTheme instances for consistency# with the response from SmartCampaignSuggestService.SuggestKeywordThemes.keyword_themes:List[SuggestKeywordThemesResponse.KeywordTheme]=[]keyword_theme_constant:KeywordThemeConstantforkeyword_theme_constantinresponse.keyword_theme_constants:# Note that the SuggestKeywordThemesResponse.KeywordTheme is a nested# type and not the same as the top-level KeywordTheme message.keyword_theme:SuggestKeywordThemesResponse.KeywordTheme=(client.get_type("SuggestKeywordThemesResponse").KeywordTheme())keyword_theme.keyword_theme_constant=keyword_theme_constantkeyword_themes.append(keyword_theme)returnkeyword_themes
# Retrieves keyword_theme_constants for the given criteria.# These KeywordThemeConstants are derived from autocomplete data for the given# keyword text. They are mapped to KeywordThemes before being returned.defget_keyword_text_auto_completions(client,keyword_text)response=client.service.keyword_theme_constant.suggest_keyword_theme_constants(query_text:keyword_text,country_code:COUNTRY_CODE,language_code:LANGUAGE_CODE,)puts"Retrieved #{response.keyword_theme_constants.size} keyword theme"\"constants using the keyword: '#{keyword_text}'"response.keyword_theme_constants.mapdo|ktc|client.resource.keyword_themedo|kt|kt.keyword_theme_constant=ktcendendend
# Retrieves KeywordThemeConstants for the given keyword text.# These KeywordThemeConstants are derived from autocomplete data for the given# keyword text. They are mapped to KeywordThemes before being returned.sub_get_keyword_text_auto_completions{my($api_client,$keyword_text)=@_;my$response=$api_client->KeywordThemeConstantService()->suggest(Google::Ads::GoogleAds::V22::Services::KeywordThemeConstantService::SuggestKeywordThemeConstantsRequest->new({queryText=>$keyword_text,countryCode=>COUNTRY_CODE,languageCode=>LANGUAGE_CODE}));printf"Retrieved %d keyword theme constants using the keyword '%s'.\n",scalar@{$response->{keywordThemeConstants}},$keyword_text;# Map the keyword theme constants to KeywordTheme instances for consistency# with the response from SmartCampaignSuggestService.SuggestKeywordThemes.my$keyword_themes=[];foreachmy$keyword_theme_constant(@{$response->{keywordThemeConstants}}){push@$keyword_themes,Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::KeywordTheme->new({keywordThemeConstant=>$keyword_theme_constant});}return$keyword_themes;}
Lastly, you can manually create free-form keyword themes by setting the
free_form_keyword_theme
field on a KeywordThemeInfo instance.
Using free-form keyword themes is typically not recommended because they're less
effective than suggested keyword themes. However, they are useful in situations
where a very specific term needs to be targeted, or when you want to
negatively
target
a term.
The
SuggestKeywordThemes
method might suggest free-form keyword themes, but only if you provide a
final_url in the request.
defget_free_form_keyword_theme_info(client:GoogleAdsClient,free_form_keyword_text:str)-> KeywordThemeInfo:"""Creates a KeywordThemeInfo using the given free-form keyword text. Args: client: an initialized GoogleAdsClient instance. free_form_keyword_text: a keyword used to create a free-form keyword theme. Returns: a KeywordThemeInfo instance. """info:KeywordThemeInfo=client.get_type("KeywordThemeInfo")info.free_form_keyword_theme=free_form_keyword_textreturninfo
# Creates a KeywordInfo instance using the given free-form keyword text.sub_get_free_form_keyword_theme_info{my($free_form_keyword_text)=@_;returnGoogle::Ads::GoogleAds::V22::Common::KeywordThemeInfo->new({freeFormKeywordTheme=>$free_form_keyword_text});}
# The SmartCampaignSuggestionInfo object acts as the basis for many of the# entities necessary to create a Smart campaign. It will be reused a number# of times to retrieve suggestions for keyword themes, budget amount,# ad creatives, and campaign criteria.suggestion_info:SmartCampaignSuggestionInfo=(get_smart_campaign_suggestion_info(client,business_profile_location,business_name))# After creating a SmartCampaignSuggestionInfo object we first use it to# generate a list of keyword themes using the SuggestKeywordThemes method# on the SmartCampaignSuggestService. It is strongly recommended that you# use this strategy for generating keyword themes.keyword_themes:List[SuggestKeywordThemesResponse.KeywordTheme]=(get_keyword_theme_suggestions(client,customer_id,suggestion_info))# If a keyword text is given, retrieve keyword theme constant suggestions# from the KeywordThemeConstantService, map them to KeywordThemes, and# append them to the existing list. This logic should ideally only be used# if the suggestions from the get_keyword_theme_suggestions function are# insufficient.ifkeyword_text:keyword_themes.extend(get_keyword_text_auto_completions(client,keyword_text))# Map the KeywordThemes retrieved by the previous two steps to# KeywordThemeInfo instances.keyword_theme_infos:List[KeywordThemeInfo]=(map_keyword_themes_to_keyword_infos(client,keyword_themes))# If a free-form keyword text is given we create a KeywordThemeInfo instance# from it and add it to the existing list.iffree_form_keyword_text:keyword_theme_infos.append(get_free_form_keyword_theme_info(client,free_form_keyword_text))# Now add the generated keyword themes to the suggestion info instance.suggestion_info.keyword_themes.extend(keyword_theme_infos)
# The SmartCampaignSuggestionInfo object acts as the basis for many of the# entities necessary to create a Smart campaign. It will be reused a number# of times to retrieve suggestions for keyword themes, budget amount,# ad creatives, and campaign criteria.suggestion_info=get_smart_campaign_suggestion_info(client,business_profile_location,business_name,)# After creating a SmartCampaignSuggestionInfo object we first use it to# generate a list of keyword themes using the SuggestKeywordThemes method# on the SmartCampaignSuggestService. It is strongly recommended that you# use this strategy for generating keyword themes.keyword_themes=get_keyword_theme_suggestions(client,customer_id,suggestion_info,)# If a keyword text is given, retrieve keyword theme constant suggestions# from the KeywordThemeConstantService, map them to KeywordThemes, and append# them to the existing list. This logic should ideally only be used if the# suggestions from the get_keyword_theme_suggestions function are# insufficient.ifkeyword_textkeyword_themes+=get_keyword_text_auto_completions(client,keyword_text,)end# Map the KeywordThemeConstants retrieved by the previous two steps to# KeywordThemeInfo instances.keyword_theme_infos=map_keyword_themes_to_keyword_infos(client,keyword_themes,)# If a free-form keyword text is given we create a KeywordThemeInfo instance# from it and add it to the existing list.iffree_form_keyword_textkeyword_theme_infos << get_freeform_keyword_theme_info(client,free_form_keyword_text,)end# Now add the generated keyword themes to the suggestion info instance.suggestion_info.keyword_themes+=keyword_theme_infos
# The SmartCampaignSuggestionInfo object acts as the basis for many of the# entities necessary to create a Smart campaign. It will be reused a number# of times to retrieve suggestions for keyword themes, budget amount,# ad creatives, and campaign criteria.my$suggestion_info=_get_smart_campaign_suggestion_info($business_profile_location,$business_name);# After creating a SmartCampaignSuggestionInfo object we first use it to# generate a list of keyword themes using the SuggestKeywordThemes method# on the SmartCampaignSuggestService. It is strongly recommended that you# use this strategy for generating keyword themes.my$keyword_themes=_get_keyword_theme_suggestions($api_client,$customer_id,$suggestion_info);# If a keyword text is given, retrieve keyword theme constant suggestions# from the KeywordThemeConstantService, map them to KeywordThemes, and# append them to the existing list. This logic should ideally only be used# if the suggestions from the get_keyword_theme_suggestions funtion are# insufficient.if(defined$keyword_text){push@$keyword_themes,@{_get_keyword_text_auto_completions($api_client,$keyword_text)};}# Map the KeywordThemeConstants retrieved by the previous two steps to# KeywordThemeInfo instances.my$keyword_theme_infos=_map_keyword_themes_to_keyword_infos($keyword_themes);# If a free-form keyword text is given we create a KeywordThemeInfo instance# from it and add it to the existing list.if(defined$free_form_keyword_text){push@$keyword_theme_infos,_get_free_form_keyword_theme_info($free_form_keyword_text);}# Now add the generated keyword themes to the suggestion info instance.$suggestion_info->{keywordThemes}=$keyword_theme_infos;
The SmartCampaignSuggestService has a
SuggestSmartCampaignBudgetOptions
method that suggests three tiers of daily budget options when given a set of
keyword themes and business details. The tiers are low, high, and
recommended, and each option also includes an estimated minimum and maximum
number of daily clicks.
defget_budget_suggestion(client:GoogleAdsClient,customer_id:str,suggestion_info:SmartCampaignSuggestionInfo,)-> int:"""Retrieves a suggested budget amount for a new budget. Using the SmartCampaignSuggestService to determine a daily budget for new and existing Smart campaigns is highly recommended because it helps the campaigns achieve optimal performance. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. suggestion_info: a SmartCampaignSuggestionInfo instance with details about the business being advertised. Returns: a daily budget amount in micros. """sc_suggest_service:SmartCampaignSuggestServiceClient=client.get_service("SmartCampaignSuggestService")request:SuggestSmartCampaignBudgetOptionsRequest=client.get_type("SuggestSmartCampaignBudgetOptionsRequest")request.customer_id=customer_id# You can retrieve suggestions for an existing campaign by setting the# "campaign" field of the request equal to the resource name of a campaign# and leaving the rest of the request fields below unset:# request.campaign = INSERT_CAMPAIGN_RESOURCE_NAME_HERE# Since these suggestions are for a new campaign, we're going to# use the suggestion_info field instead.request.suggestion_info=suggestion_info# Issue a request to retrieve a budget suggestion.response:SuggestSmartCampaignBudgetOptionsResponse=(sc_suggest_service.suggest_smart_campaign_budget_options(request=request))# Three tiers of options will be returned, a "low", "high" and# "recommended". Here we will use the "recommended" option. The amount is# specified in micros, where one million is equivalent to one currency unit.recommendation:SuggestSmartCampaignBudgetOptionsResponse.BudgetOption=(response.recommended)print(f"A daily budget amount of {recommendation.daily_amount_micros} micros ""was suggested, garnering an estimated minimum of "f"{recommendation.metrics.min_daily_clicks} clicks and an estimated "f"maximum of {recommendation.metrics.max_daily_clicks} per day.")returnrecommendation.daily_amount_micros
# Retrieves a suggested budget amount for a new budget.## Using the SmartCampaignSuggestService to determine a daily budget for new# and existing Smart campaigns is highly recommended because it helps the# campaigns achieve optimal performance.defget_budget_suggestion(client,customer_id,suggestion_info)# Issues a request to retrieve a budget suggestion.response=client.service.smart_campaign_suggest.suggest_smart_campaign_budget_options(customer_id:customer_id,# You can retrieve suggestions for an existing campaign by setting the# "campaign" field of the request equal to the resource name of a campaign# and leaving the rest of the request fields below unset:# campaign: INSERT_CAMPAIGN_RESOURCE_NAME_HERE,# Since these suggestions are for a new campaign, we're going to# use the suggestion_info field instead.suggestion_info:suggestion_info,)# Three tiers of options will be returned, a "low", "high" and# "recommended". Here we will use the "recommended" option. The amount is# specified in micros, where one million is equivalent to one currency unit.recommendation=response.recommendedputs"A daily budget amount of #{recommendation.daily_amount_micros} micros"\" was suggested, garnering an estimated minimum of"\" #{recommendation.metrics.min_daily_clicks} clicks and an estimated"\" maximum of #{recommendation.metrics.max_daily_clicks} per day."recommendation.daily_amount_microsend
# Retrieves a suggested budget amount for a new budget.# Using the SmartCampaignSuggestService to determine a daily budget for new and# existing Smart campaigns is highly recommended because it helps the campaigns# achieve optimal performance.sub_get_budget_suggestion{my($api_client,$customer_id,$suggestion_info)=@_;my$request=Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::SuggestSmartCampaignBudgetOptionsRequest->new({customerId=>$customer_id,# You can retrieve suggestions for an existing campaign by setting the# "campaign" field of the request to the resource name of a campaign and# leaving the rest of the request fields below unset:# campaign => "INSERT_CAMPAIGN_RESOURCE_NAME_HERE",## Since these suggestions are for a new campaign, we're going to use the# "suggestion_info" field instead.suggestionInfo=>$suggestion_info});# Issue a request to retrieve a budget suggestion.my$response=$api_client->SmartCampaignSuggestService()->suggest_smart_campaign_budget_options($request);# Three tiers of options will be returned: "low", "high", and "recommended".# Here we will use the "recommended" option. The amount is specified in micros,# where one million is equivalent to one currency unit.printf"A daily budget amount of %d was suggested, garnering an estimated "."minimum of %d clicks and an estimated maximum of %d clicks per day.\n",$response->{recommended}{dailyAmountMicros},$response->{recommended}{metrics}{minDailyClicks},$response->{recommended}{metrics}{maxDailyClicks};return$response->{recommended}{dailyAmountMicros};}
The SmartCampaignSuggestService has a
SuggestSmartCampaignAd
method that returns a
SmartCampaignAdInfo instance with
suggestions for up to three headlines and two descriptions for your Smart
campaign ad. Each headline and description is contained in the field of an
AdTextAsset instance attached to the
SmartCampaignAdInfo.
This method might return no suggestions, or the AdTextAsset instances that
are returned might have an empty string as their
text field value. We recommend that you
review these suggestions before they're used to create ads, in order to
ensure that ads are always created with the minimum of 3 headlines and 2
descriptions. If this minimum is not met, or if either asset text is too short,
the request will fail with an error.
Suggestions for ad assets are largely derived from website content, so if a
final_url is not specified on the
SmartCampaignSuggestionInfo
instance, suggestions are generated solely from the
keyword themes
provided in the request.
defget_ad_suggestions(client:GoogleAdsClient,customer_id:str,suggestion_info:SmartCampaignSuggestionInfo,)-> SmartCampaignAdInfo:"""Retrieves creative suggestions for a Smart campaign ad. Using the SmartCampaignSuggestService to suggest creatives for new and existing Smart campaigns is highly recommended because it helps the campaigns achieve optimal performance. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. suggestion_info: a SmartCampaignSuggestionInfo instance with details about the business being advertised. Returns: a SmartCampaignAdInfo instance with suggested headlines and descriptions. """sc_suggest_service:SmartCampaignSuggestServiceClient=client.get_service("SmartCampaignSuggestService")request:SuggestSmartCampaignAdRequest=client.get_type("SuggestSmartCampaignAdRequest")request.customer_id=customer_id# Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible# to use suggestion_info to retrieve ad creative suggestions.request.suggestion_info=suggestion_info# Issue a request to retrieve ad creative suggestions.response:SuggestSmartCampaignAdResponse=(sc_suggest_service.suggest_smart_campaign_ad(request=request))# The SmartCampaignAdInfo object in the response contains a list of up to# three headlines and two descriptions. Note that some of the suggestions# may have empty strings as text. Before setting these on the ad you should# review them and filter out any empty values.ad_suggestions:SmartCampaignAdInfo=response.ad_infoprint("The following headlines were suggested:")headline:AdTextAssetforheadlineinad_suggestions.headlines:print(f"\t{headline.textor'<None>'}")print("And the following descriptions were suggested:")description:AdTextAssetfordescriptioninad_suggestions.descriptions:print(f"\t{description.textor'<None>'}")returnad_suggestions
# Retrieves creative suggestions for a Smart campaign ad.## Using the SmartCampaignSuggestService to suggest creatives for new and# existing Smart campaigns is highly recommended because it helps the# campaigns achieve optimal performance.defget_ad_suggestions(client,customer_id,suggestion_info)# Issue a request to retrieve ad creative suggestions.response=client.service.smart_campaign_suggest.suggest_smart_campaign_ad(customer_id:customer_id,# Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible# to use suggestion_info to retrieve ad creative suggestions.suggestion_info:suggestion_info,)# The SmartCampaignAdInfo object in the response contains a list of up to# three headlines and two descriptions. Note that some of the suggestions# may have empty strings as text. Before setting these on the ad you should# review them and filter out any empty values.ad_suggestions=response.ad_info# If there are no suggestions, the response will be blank.returnnilifad_suggestions.nil?puts'The following headlines were suggested:'ad_suggestions.headlines.eachdo|headline|puts"\t#{headline.text||'<None>'}"endputs'And the following descriptions were suggested:'ad_suggestions.descriptions.eachdo|description|puts"\t#{description.text||'<None>'}"endad_suggestionsend
# Retrieves creative suggestions for a Smart campaign ad.# Using the SmartCampaignSuggestService to suggest creatives for new and# existing Smart campaigns is highly recommended because it helps the campaigns# achieve optimal performance.sub_get_ad_suggestions{my($api_client,$customer_id,$suggestion_info)=@_;# Issue a request to retrieve ad creative suggestions.my$response=$api_client->SmartCampaignSuggestService()->suggest_smart_campaign_ad(Google::Ads::GoogleAds::V22::Services::SmartCampaignSuggestService::SuggestSmartCampaignAdRequest->new({customerId=>$customer_id,# Unlike the SuggestSmartCampaignBudgetOptions method, it's only# possible to use suggestion_info to retrieve ad creative suggestions.suggestionInfo=>$suggestion_info}));# The SmartCampaignAdInfo object in the response contains a list of up to# three headlines and two descriptions. Note that some of the suggestions# may have empty strings as text. Before setting these on the ad you should# review them and filter out any empty values.my$ad_suggestions=$response->{adInfo};printf"The following headlines were suggested:\n";foreachmy$headline(@{$ad_suggestions->{headlines}}){printf"\t%s\n",defined$headline->{text}?$headline->{text}:"<None>";}printf"And the following descriptions were suggested:\n";foreachmy$description(@{$ad_suggestions->{descriptions}}){printf"\t%s\n",defined$description->{text}?$description->{text}:"<None>";}return$ad_suggestions;}
[[["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-12-03 UTC."],[],[]]