Ottieni suggerimenti per il tema delle parole chiave, il budget e gli asset di testo dell'annuncio
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Google Ads espone
SmartCampaignSuggestService
per suggerire i dettagli di configurazione durante la creazione di campagne smart. Utilizza
i dettagli dell'attività pubblicizzata (sotto forma di
istanza SmartCampaignSuggestionInfo) per suggerire temi delle parole chiave, un importo del budget, nonché titoli e
descrizioni per i singoli annunci.
Crea un'istanza SmartCampaignSuggestionInfo
Per generare suggerimenti per le campagne intelligenti, devi utilizzare un'istanza
SmartCampaignSuggestionInfo
che contenga i dettagli dell'attività pubblicizzata. Poiché è
possibile utilizzare la stessa istanza SmartCampaignSuggestionInfo per recuperare tutti
i diversi tipi di suggerimenti per le campagne intelligenti, puoi crearne uno e
riutilizzarlo più volte.
Requisiti principali per SmartCampaignSuggestionInfo:
Una pagina di destinazione. Può trattarsi di un sito web esistente
(final_url) o di una
pagina di destinazione
automatica creata per la tua
campagna utilizzando le informazioni del profilo dell'attività ottenute con l'identificatore
business_profile_location. Se prevedi di utilizzare una pagina di destinazione automatica, assicurati di impostare il
campo business_profile_location durante la generazione dei suggerimenti.
Se final_url è impostato, è possibile impostare business_profile_location o
business_name.
Se final_url non è impostato, è necessario impostare business_profile_location.
Se utilizzato per recuperare suggerimenti sui temi delle parole chiave dal metodo
SuggestKeywordThemes, non è necessario impostare il campo keyword_themes.
Se utilizzato per recuperare i suggerimenti di annunci dal metodo
SuggestSmartCampaignAd, i campi language_code e keyword_themes sono
obbligatori.
Per suggerimenti ottimali, all'oggetto devono essere aggiunti il maggior numero possibile di dettagli.
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;}
Data un'istanza SmartCampaignSuggestionInfo, il
metodo di servizio SuggestKeywordThemes suggerisce temi di parole chiave utilizzando i dettagli della tua attività, la sua
sede e i contenuti del sito web.
Per ottimizzare al meglio il rendimento della tua campagna intelligente, utilizza il metodo
SuggestKeywordThemes quando crei i temi delle parole chiave. Poiché
aggrega dettagli specifici sull'attività e sul suo sito web, genera
temi delle parole chiave significativamente migliori rispetto alle altre due strategie, che sono
da considerare come opzioni di backup.
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};}
Data una parola o una frase, KeywordThemeConstantService suggerisce
KeywordThemeConstants derivate dai dati di completamento automatico per il
testo specificato. Questa strategia è un'alternativa utile se, ad esempio, l'attività pubblicizzata non ha un sito web o informazioni sufficienti per sfruttare il metodo SuggestKeywordThemes. Questo metodo deve essere utilizzato solo
se il metodo SuggestKeywordThemes non può essere utilizzato o restituisce suggerimenti
insufficienti.
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;}
Infine, puoi creare manualmente temi di parole chiave in formato libero impostando il campo
free_form_keyword_theme
in un'istanza KeywordThemeInfo.
L'utilizzo di temi delle parole chiave in formato libero in genere non è consigliato perché sono meno
efficaci rispetto ai temi delle parole chiave suggeriti. Tuttavia, sono utili nelle situazioni
in cui è necessario scegliere come target un termine molto specifico o quando vuoi
escludere
un termine dal targeting.
Il metodo
SuggestKeywordThemes
potrebbe suggerire temi delle parole chiave in formato libero, ma solo se fornisci un
final_url nella richiesta.
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});}
Queste due strategie devono essere applicate in modo che ciascuno dei diversi tipi di
temi delle parole chiave venga associato a un'istanza KeywordThemeInfo:
# 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;
SmartCampaignSuggestService ha un
SuggestSmartCampaignBudgetOptions
metodo che suggerisce tre livelli di opzioni di budget giornaliero quando viene fornito un insieme di
temi delle parole chiave e dettagli dell'attività. I livelli sono low, high e
recommended e ogni opzione include anche un numero minimo e massimo stimato
di clic giornalieri.
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};}
Visualizzare gli asset di testo dell'annuncio suggeriti
SmartCampaignSuggestService ha un metodo
SuggestSmartCampaignAd
che restituisce un'istanza
SmartCampaignAdInfo con
suggerimenti per un massimo di tre titoli e due descrizioni per l'annuncio della tua campagna
intelligente. Ogni titolo e descrizione è contenuto nel campo di un'istanza di AdTextAsset collegata a SmartCampaignAdInfo.
Questo metodo potrebbe non restituire suggerimenti oppure le istanze AdTextAsset restituite potrebbero avere una stringa vuota come valore del campo text. Ti consigliamo di
rivedere questi suggerimenti prima che vengano utilizzati per creare annunci, in modo da
assicurarti che gli annunci vengano sempre creati con un minimo di 3 titoli e 2
descrizioni. Se questo minimo non viene raggiunto o se il testo di uno degli asset è troppo breve,
la richiesta non andrà a buon fine e verrà visualizzato un errore.
I suggerimenti per gli asset dell'annuncio derivano in gran parte dai contenuti del sito web, quindi se un
final_url non è specificato nell'istanza
SmartCampaignSuggestionInfo, i suggerimenti vengono generati esclusivamente dai
temi delle parole chiave
forniti nella richiesta.
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;}
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-12-18 UTC."],[],[]]