建議可透過下列幾種方式改善您的廣告活動:
- 推出新的相關功能
- 調整出價、關鍵字和廣告,善用每一分預算
- 提升廣告活動的整體成效和效率
如要提高最佳化分數,您可以使用 RecommendationService
擷取最佳化建議,然後視情況套用或關閉這些建議。您也可以使用 RecommendationSubscriptionService
訂閱自動套用最佳化建議。
最佳化分數
最佳化分數可用來預估 Google Ads 帳戶效益,可在 Customer
和 Campaign
等級查看。
Customer.optimization_score_weight
僅適用於非管理員帳戶,且可用來計算多個帳戶的總最佳化分數。擷取帳戶的最佳化分數和最佳化分數權重,並相乘 (Customer.optimization_score * Customer.optimization_score_weight
),計算出整體最佳化分數。
customer
和 campaign
報表提供下列最佳化相關指標:
metrics.optimization_score_url
提供帳戶的深層連結,方便您在 Google Ads 使用者介面中查看相關建議的相關資訊。metrics.optimization_score_uplift
會顯示套用所有相關最佳化建議後,最佳化分數的預期升幅。這項預估值是根據整體所有可用建議得出的預估值,而不只是每個建議的升幅分數總和。
如要對傳回的推薦內容分組及排序,您可以在查詢中使用 segments.recommendation_type
,按照建議類型區隔這兩個指標。
推薦類型
完整支援的建議類型
RecommendationType | 說明 |
---|---|
CAMPAIGN_BUDGET |
修正受到預算限制的廣告活動 |
KEYWORD |
新增關鍵字 |
TEXT_AD |
新增廣告建議 |
TARGET_CPA_OPT_IN |
採用目標單次轉換出價 |
MAXIMIZE_CONVERSIONS_OPT_IN |
使用「盡量爭取轉換」出價 |
MAXIMIZE_CONVERSION_VALUE_OPT_IN |
使用盡量提高轉換價值出價 |
ENHANCED_CPC_OPT_IN |
使用「成本效益管理系統」出價 |
MAXIMIZE_CLICKS_OPT_IN |
採用「盡量爭取點擊」出價 |
OPTIMIZE_AD_ROTATION |
使用最佳化廣告輪播 |
MOVE_UNUSED_BUDGET |
挪用未用到的預算 |
TARGET_ROAS_OPT_IN |
使用目標廣告投資報酬率出價 |
FORECASTING_CAMPAIGN_BUDGET |
修正日後會受到預算限制的廣告活動 |
RESPONSIVE_SEARCH_AD |
新增回應式搜尋廣告 |
MARGINAL_ROI_CAMPAIGN_BUDGET |
調整廣告活動預算以提高投資報酬率 |
USE_BROAD_MATCH_KEYWORD |
針對採用自動出價的轉換型廣告活動使用廣泛比對 |
RESPONSIVE_SEARCH_AD_ASSET |
在廣告中新增回應式搜尋廣告素材資源 |
RESPONSIVE_SEARCH_AD_IMPROVE_AD_STRENGTH |
提高回應式搜尋廣告的廣告優異度 |
DISPLAY_EXPANSION_OPT_IN |
更新廣告活動以使用多媒體擴充功能 |
SEARCH_PARTNERS_OPT_IN |
透過 Google 搜尋聯播網夥伴擴大觸及範圍 |
CUSTOM_AUDIENCE_OPT_IN |
建立自訂目標對象 |
IMPROVE_DISCOVERY_AD_STRENGTH |
改善需求開發廣告活動中的廣告優異度 |
UPGRADE_SMART_SHOPPING_CAMPAIGN_TO_PERFORMANCE_MAX |
將智慧購物廣告活動升級為最高成效廣告活動 |
UPGRADE_LOCAL_CAMPAIGN_TO_PERFORMANCE_MAX |
將舊版地區廣告活動升級為最高成效廣告活動 |
SHOPPING_MIGRATE_REGULAR_SHOPPING_CAMPAIGN_OFFERS_TO_PERFORMANCE_MAX |
將標準購物廣告活動指定的產品,遷移至現有的最高成效廣告活動 |
MIGRATE_DYNAMIC_SEARCH_ADS_CAMPAIGN_TO_PERFORMANCE_MAX |
將動態搜尋廣告遷移至最高成效廣告活動 |
PERFORMANCE_MAX_OPT_IN |
在帳戶中建立最高成效廣告活動 |
IMPROVE_PERFORMANCE_MAX_AD_STRENGTH |
將最高成效廣告活動的素材資源群組優異度提升至「極佳」評分 |
PERFORMANCE_MAX_FINAL_URL_OPT_IN |
啟用最高成效廣告活動的最終到達網址擴展功能 |
RAISE_TARGET_CPA_BID_TOO_LOW |
將目標單次轉換出價過低,而且轉換次數很少或完全沒有時,提高目標單次轉換出價 |
FORECASTING_SET_TARGET_ROAS |
在預測流量會增加的季節性活動前提高預算,並將出價策略從「盡量提高轉換價值」改為「目標廣告投資報酬率」 |
LEAD_FORM |
在廣告活動中加入待開發客戶表單素材資源 |
CALLOUT_ASSET |
在廣告活動或客戶層級新增摘要素材資源 |
SITELINK_ASSET |
在廣告活動或客戶層級新增網站連結素材資源 |
CALL_ASSET |
在廣告活動或客戶層級新增電話素材資源 |
SHOPPING_ADD_AGE_GROUP |
將年齡層屬性新增至因缺少年齡層而降低的產品排名 |
SHOPPING_ADD_COLOR |
為因缺少顏色而降級的商品新增顏色 |
SHOPPING_ADD_GENDER |
為因缺少性別而降級的產品新增性別 |
SHOPPING_ADD_GTIN |
為產品新增全球交易品項識別碼 (GTIN),因缺少全球交易品項識別碼而降低排名 |
SHOPPING_ADD_MORE_IDENTIFIERS |
為缺少 ID 而降級的商品新增更多 ID |
SHOPPING_ADD_SIZE |
為因缺少尺寸而降級的商品新增尺寸 |
SHOPPING_ADD_PRODUCTS_TO_CAMPAIGN |
為廣告活動新增產品 |
SHOPPING_FIX_DISAPPROVED_PRODUCTS |
修正遭拒登的產品 |
SHOPPING_TARGET_ALL_OFFERS |
建立指定所有優惠的通用產品廣告活動 |
SHOPPING_FIX_SUSPENDED_MERCHANT_CENTER_ACCOUNT |
修正 Merchant Center 帳戶停權問題 |
SHOPPING_FIX_MERCHANT_CENTER_ACCOUNT_SUSPENSION_WARNING |
修正 Merchant Center 帳戶停權警示問題 |
DYNAMIC_IMAGE_EXTENSION_OPT_IN |
在帳戶中啟用動態圖片額外資訊 |
RAISE_TARGET_CPA |
提高目標單次轉換出價 |
LOWER_TARGET_ROAS |
較低的目標廣告投資報酬率 |
FORECASTING_SET_TARGET_CPA |
在預計可增加流量的季節性事件之前,為未指定目標單次操作出價的廣告活動設定目標單次轉換出價 |
SET_TARGET_CPA |
為未指定目標單次轉換出價的廣告活動設定目標單次轉換出價 |
SET_TARGET_ROAS |
為未指定目標廣告投資報酬率的廣告活動設定目標廣告投資報酬率 |
REFRESH_CUSTOMER_MATCH_LIST |
更新過去 90 天內未更新的客戶名單 |
IMPROVE_GOOGLE_TAG_COVERAGE |
在更多網頁上部署 Google 代碼 |
CALLOUT_EXTENSION (已淘汰) |
已淘汰,請改用 CALLOUT_ASSET |
SITELINK_EXTENSION (已淘汰) |
已淘汰,請改用 SITELINK_ASSET |
CALL_EXTENSION (已淘汰) |
已淘汰,請改用 CALL_ASSET |
KEYWORD_MATCH_TYPE (已淘汰) |
已淘汰,請改用 USE_BROAD_MATCH_KEYWORD |
觀看這部影片瞭解詳情
處理不支援的類型
擷取推薦內容
與 Google Ads API 中的大多數其他實體一樣,您可以使用 Google Ads 查詢語言查詢搭配 GoogleAdsService.SearchStream
,擷取 Recommendation
物件。
系統會在建議專屬欄位提供每種建議類型的詳細資料。舉例來說,CAMPAIGN_BUDGET
建議詳細資料位於 campaign_budget_recommendation
欄位中,會納入 CampaignBudgetRecommendation
物件中。
在 recommendation
聯集欄位中找出所有推薦專屬欄位。
建議影響
部分最佳化建議類型會填入最佳化建議的 impact
欄位。RecommendationImpact
包含套用建議對帳戶成效的預估影響。impact.base_metrics
和 impact.potential_metrics
欄位中提供下列推薦指標:
impressions
clicks
cost_micros
conversions
all_conversions
video_views
程式碼範例
以下程式碼範例會從帳戶中擷取所有可用且已略過的 KEYWORD
類型推薦內容,並列印部分詳細資料:
Java
try (GoogleAdsServiceClient googleAdsServiceClient = googleAdsClient.getLatestVersion().createGoogleAdsServiceClient(); RecommendationServiceClient recommendationServiceClient = googleAdsClient.getLatestVersion().createRecommendationServiceClient()) { // Creates a query that retrieves keyword recommendations. String query = "SELECT recommendation.resource_name, " + " recommendation.campaign, " + " recommendation.keyword_recommendation " + "FROM recommendation " + "WHERE recommendation.type = KEYWORD"; // Constructs the SearchGoogleAdsStreamRequest. SearchGoogleAdsStreamRequest request = SearchGoogleAdsStreamRequest.newBuilder() .setCustomerId(Long.toString(customerId)) .setQuery(query) .build(); // Issues the search stream request to detect keyword recommendations that exist for the // customer account. ServerStream<SearchGoogleAdsStreamResponse> stream = googleAdsServiceClient.searchStreamCallable().call(request); // Creates apply operations for all the recommendations found. List<ApplyRecommendationOperation> applyRecommendationOperations = new ArrayList<>(); for (SearchGoogleAdsStreamResponse response : stream) { for (GoogleAdsRow googleAdsRow : response.getResultsList()) { Recommendation recommendation = googleAdsRow.getRecommendation(); System.out.printf( "Keyword recommendation '%s' was found for campaign '%s'%n", recommendation.getResourceName(), recommendation.getCampaign()); KeywordInfo keyword = recommendation.getKeywordRecommendation().getKeyword(); System.out.printf("\tKeyword = '%s'%n", keyword.getText()); System.out.printf("\tMatch type = '%s'%n", keyword.getMatchType()); // Creates an ApplyRecommendationOperation that will apply this recommendation, and adds // it to the list of operations. applyRecommendationOperations.add(buildRecommendationOperation(recommendation)); } }
C#
// Get the GoogleAdsServiceClient. GoogleAdsServiceClient googleAdsService = client.GetService( Services.V18.GoogleAdsService); // Creates a query that retrieves keyword recommendations. string query = "SELECT recommendation.resource_name, " + "recommendation.campaign, recommendation.keyword_recommendation " + "FROM recommendation WHERE " + $"recommendation.type = KEYWORD"; List<ApplyRecommendationOperation> operations = new List<ApplyRecommendationOperation>(); try { // Issue a search request. googleAdsService.SearchStream(customerId.ToString(), query, delegate (SearchGoogleAdsStreamResponse resp) { Console.WriteLine($"Found {resp.Results.Count} recommendations."); foreach (GoogleAdsRow googleAdsRow in resp.Results) { Recommendation recommendation = googleAdsRow.Recommendation; Console.WriteLine("Keyword recommendation " + $"{recommendation.ResourceName} was found for campaign " + $"{recommendation.Campaign}."); if (recommendation.KeywordRecommendation != null) { KeywordInfo keyword = recommendation.KeywordRecommendation.Keyword; Console.WriteLine($"Keyword = {keyword.Text}, type = " + "{keyword.MatchType}"); } operations.Add( BuildApplyRecommendationOperation(recommendation.ResourceName) ); } } ); } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; }
PHP
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient(); // Creates a query that retrieves keyword recommendations. $query = 'SELECT recommendation.resource_name, recommendation.campaign, ' . 'recommendation.keyword_recommendation ' . 'FROM recommendation ' . 'WHERE recommendation.type = KEYWORD '; // Issues a search request to detect keyword recommendations that exist for the // customer account. $response = $googleAdsServiceClient->search(SearchGoogleAdsRequest::build($customerId, $query)); $operations = []; // Iterates over all rows in all pages and prints the requested field values for // the recommendation in each row. foreach ($response->iterateAllElements() as $googleAdsRow) { /** @var GoogleAdsRow $googleAdsRow */ $recommendation = $googleAdsRow->getRecommendation(); printf( "Keyword recommendation with resource name '%s' was found for campaign " . "with resource name '%s':%s", $recommendation->getResourceName(), $recommendation->getCampaign(), PHP_EOL ); if (!is_null($recommendation->getKeywordRecommendation())) { $keyword = $recommendation->getKeywordRecommendation()->getKeyword(); printf( "\tKeyword = '%s'%s\ttype = '%s'%s", $keyword->getText(), PHP_EOL, KeywordMatchType::name($keyword->getMatchType()), PHP_EOL ); } // Creates an ApplyRecommendationOperation that will be used to apply this // recommendation, and adds it to the list of operations. $operations[] = self::buildRecommendationOperation($recommendation->getResourceName()); }
Python
googleads_service = client.get_service("GoogleAdsService") query = f""" SELECT recommendation.campaign, recommendation.keyword_recommendation FROM recommendation WHERE recommendation.type = KEYWORD""" # Detects keyword recommendations that exist for the customer account. response = googleads_service.search(customer_id=customer_id, query=query) operations = [] for row in response.results: recommendation = row.recommendation print( f"Keyword recommendation ('{recommendation.resource_name}') " f"was found for campaign '{recommendation.campaign}." ) keyword = recommendation.keyword_recommendation.keyword print( f"\tKeyword = '{keyword.text}'\n" f"\tType = '{keyword.match_type}'" ) # Create an ApplyRecommendationOperation that will be used to apply # this recommendation, and add it to the list of operations. operations.append( build_recommendation_operation(client, recommendation.resource_name) )
小茹
query = <<~QUERY SELECT recommendation.resource_name, recommendation.campaign, recommendation.keyword_recommendation FROM recommendation WHERE recommendation.type = KEYWORD QUERY google_ads_service = client.service.google_ads response = google_ads_service.search( customer_id: customer_id, query: query, ) operations = response.each do |row| recommendation = row.recommendation puts "Keyword recommendation ('#{recommendation.resource_name}') was found for "\ "campaign '#{recommendation.campaign}'." if recommendation.keyword_recommendation keyword = recommendation.keyword_recommendation.keyword puts "\tKeyword = '#{keyword.text}'" puts "\ttype = '#{keyword.match_type}'" end build_recommendation_operation(client, recommendation.resource_name) end
Perl
# Create the search query. my $search_query = "SELECT recommendation.resource_name, " . "recommendation.campaign, recommendation.keyword_recommendation " . "FROM recommendation " . "WHERE recommendation.type = KEYWORD"; # Get the GoogleAdsService. my $google_ads_service = $api_client->GoogleAdsService(); my $search_stream_handler = Google::Ads::GoogleAds::Utils::SearchStreamHandler->new({ service => $google_ads_service, request => { customerId => $customer_id, query => $search_query }}); # Create apply operations for all the recommendations found. my $apply_recommendation_operations = (); $search_stream_handler->process_contents( sub { my $google_ads_row = shift; my $recommendation = $google_ads_row->{recommendation}; printf "Keyword recommendation '%s' was found for campaign '%s'.\n", $recommendation->{resourceName}, $recommendation->{campaign}; my $keyword = $recommendation->{keywordRecommendation}{keyword}; printf "\tKeyword = '%s'\n", $keyword->{text}; printf "\tMatch type = '%s'\n", $keyword->{matchType}; # Creates an ApplyRecommendationOperation that will apply this recommendation, and adds # it to the list of operations. push @$apply_recommendation_operations, build_recommendation_operation($recommendation); });
採取行動
您可以套用或關閉任何擷取的最佳化建議。
視推薦類型而定,推薦內容可能會每天變更,甚至一天變更多次。發生這種情況時,建議物件的 resource_name
在擷取建議後可能會過時。
建議您在擷取後立即採取行動。
套用最佳化建議
您可以使用 RecommendationService
的 ApplyRecommendation
方法,套用有效或已略過的最佳化建議。
推薦類型可以包含必要或選用參數。大部分建議都會有預設採用的建議值。
所有建議類型都不支援為自動套用最佳化建議設定帳戶。不過,您可以針對 Google Ads API 完全支援的最佳化建議類型,實作類似的行為。詳情請參閱 DetectAndApplyRecommendations
程式碼範例。
使用 ApplyRecommendationOperation
的 apply_parameters
聯集欄位,套用含有特定參數值的最佳化建議。每種適合推薦類型都有專屬欄位,apply_parameters
欄位中未列出的推薦類型不會使用這些參數值。
程式碼範例
以下程式碼示範如何建構 ApplyRecommendationOperation
,以及如何覆寫建議的值 (如果想要將其取代)。
Java
/** Creates and returns an ApplyRecommendationOperation to apply the given recommendation. */ private ApplyRecommendationOperation buildRecommendationOperation(Recommendation recommendation) { // If you have a recommendation ID instead of a resource name, you can create a resource name // like this: // String resourceName = ResourceNames.recommendation(customerId, recommendationId); // Creates a builder to construct the operation. Builder operationBuilder = ApplyRecommendationOperation.newBuilder(); // Each recommendation type has optional parameters to override the recommended values. Below is // an example showing how to override a recommended ad when a TextAdRecommendation is applied. // operationBuilder.getTextAdBuilder().getAdBuilder().setResourceName("INSERT_AD_RESOURCE_NAME"); // Sets the operation's resource name to the resource name of the recommendation to apply. operationBuilder.setResourceName(recommendation.getResourceName()); return operationBuilder.build(); }
C#
private ApplyRecommendationOperation BuildApplyRecommendationOperation( string recommendationResourceName ) { // If you have a recommendation_id instead of the resource_name you can create a // resource name from it like this: // string recommendationResourceName = // ResourceNames.Recommendation(customerId, recommendationId) // Each recommendation type has optional parameters to override the recommended values. // This is an example to override a recommended ad when a TextAdRecommendation is // applied. // For details, please read // https://developers.google.com/google-ads/api/reference/rpc/latest/ApplyRecommendationOperation. /* Ad overridingAd = new Ad() { Id = "INSERT_AD_ID_AS_LONG_HERE" }; applyRecommendationOperation.TextAd = new TextAdParameters() { Ad = overridingAd }; */ ApplyRecommendationOperation applyRecommendationOperation = new ApplyRecommendationOperation() { ResourceName = recommendationResourceName }; return applyRecommendationOperation; }
PHP
private static function buildRecommendationOperation( string $recommendationResourceName ): ApplyRecommendationOperation { // If you have a recommendation_id instead of the resource name, you can create a resource // name from it like this: /* $recommendationResourceName = ResourceNames::forRecommendation($customerId, $recommendationId); */ // Each recommendation type has optional parameters to override the recommended values. // This is an example to override a recommended ad when a TextAdRecommendation is applied. // For details, please read // https://developers.google.com/google-ads/api/reference/rpc/latest/ApplyRecommendationOperation. /* $overridingAd = new Ad([ 'id' => 'INSERT_AD_ID_AS_INTEGER_HERE' ]); $applyRecommendationOperation->setTextAd(new TextAdParameters(['ad' => $overridingAd])); */ // Issues a mutate request to apply the recommendation. $applyRecommendationOperation = new ApplyRecommendationOperation(); $applyRecommendationOperation->setResourceName($recommendationResourceName); return $applyRecommendationOperation; }
Python
def build_recommendation_operation(client, recommendation): """Creates a ApplyRecommendationOperation to apply the given recommendation. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. recommendation: a resource name for the recommendation to be applied. """ # If you have a recommendation ID instead of a resource name, you can create # a resource name like this: # # googleads_service = client.get_service("GoogleAdsService") # resource_name = googleads_service.recommendation_path( # customer_id, recommendation.id # ) operation = client.get_type("ApplyRecommendationOperation") # Each recommendation type has optional parameters to override the # recommended values. Below is an example showing how to override a # recommended ad when a TextAdRecommendation is applied. # # operation.text_ad.ad.resource_name = "INSERT_AD_RESOURCE_NAME" # # For more details, see: # https://developers.google.com/google-ads/api/reference/rpc/latest/ApplyRecommendationOperation#apply_parameters operation.resource_name = recommendation return operation
小茹
def build_recommendation_operation(client, recommendation) # If you have a recommendation_id instead of the resource_name # you can create a resource name from it like this: # recommendation_resource = # client.path.recommendation(customer_id, recommendation_id) operations = client.operation.apply_recommendation operations.resource_name = recommendation_resource # Each recommendation type has optional parameters to override the recommended # values. This is an example to override a recommended ad when a # TextAdRecommendation is applied. # # text_ad_parameters = client.resource.text_ad_parameters do |tap| # tap.ad = client.resource.ad do |ad| # ad.id = "INSERT_AD_ID_AS_INTEGER_HERE" # end # end # operation.text_ad = text_ad_parameters # # For more details, see: # https://developers.google.com/google-ads/api/reference/rpc/latest/ApplyRecommendationOperation#apply_parameters return operation end
Perl
sub build_recommendation_operation { my ($recommendation) = @_; # If you have a recommendation ID instead of a resource name, you can create a resource # name like this: # my $recommendation_resource_name = # Google::Ads::GoogleAds::V18::Utils::ResourceNames::recommendation( # $customer_id, $recommendation_id); # Each recommendation type has optional parameters to override the recommended values. # Below is an example showing how to override a recommended ad when a TextAdRecommendation # is applied. # my $overriding_ad = Google::Ads::GoogleAds::V18::Resources::Ad->new({ # id => "INSERT_AD_ID_AS_INTEGER_HERE" # }); # my $text_ad_parameters = # Google::Ads::GoogleAds::V18::Services::RecommendationService::TextAdParameters # ->new({ad => $overriding_ad}); # $apply_recommendation_operation->{textAd} = $text_ad_parameters; # Create an apply recommendation operation. my $apply_recommendation_operation = Google::Ads::GoogleAds::V18::Services::RecommendationService::ApplyRecommendationOperation ->new({ resourceName => $recommendation->{resourceName}}); return $apply_recommendation_operation; }
下一個範例會呼叫 ApplyRecommendation
,傳送先前程式碼中建立的套用建議操作。
Java
// Issues a mutate request to apply the recommendations. ApplyRecommendationResponse applyRecommendationsResponse = recommendationServiceClient.applyRecommendation( Long.toString(customerId), applyRecommendationOperations); for (ApplyRecommendationResult applyRecommendationResult : applyRecommendationsResponse.getResultsList()) { System.out.printf( "Applied recommendation with resource name: '%s'.%n", applyRecommendationResult.getResourceName()); }
C#
private void ApplyRecommendation(GoogleAdsClient client, long customerId, List<ApplyRecommendationOperation> operations) { // Get the RecommendationServiceClient. RecommendationServiceClient recommendationService = client.GetService( Services.V18.RecommendationService); ApplyRecommendationRequest applyRecommendationRequest = new ApplyRecommendationRequest() { CustomerId = customerId.ToString(), }; applyRecommendationRequest.Operations.AddRange(operations); ApplyRecommendationResponse response = recommendationService.ApplyRecommendation(applyRecommendationRequest); foreach (ApplyRecommendationResult result in response.Results) { Console.WriteLine("Applied a recommendation with resource name: " + result.ResourceName); } }
PHP
private static function applyRecommendations( GoogleAdsClient $googleAdsClient, int $customerId, array $operations ): void { // Issues a mutate request to apply the recommendations. $recommendationServiceClient = $googleAdsClient->getRecommendationServiceClient(); $response = $recommendationServiceClient->applyRecommendation( ApplyRecommendationRequest::build($customerId, $operations) ); foreach ($response->getResults() as $appliedRecommendation) { /** @var Recommendation $appliedRecommendation */ printf( "Applied a recommendation with resource name: '%s'.%s", $appliedRecommendation->getResourceName(), PHP_EOL ); } }
Python
def apply_recommendations(client, customer_id, operations): """Applies a batch of recommendations. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. operations: a list of ApplyRecommendationOperation messages. """ # Issues a mutate request to apply the recommendations. recommendation_service = client.get_service("RecommendationService") response = recommendation_service.apply_recommendation( customer_id=customer_id, operations=operations ) for result in response.results: print( "Applied a recommendation with resource name: " f"'{result[0].resource_name}'." )
小茹
def apply_recommendations(client, customer_id, operations) # Issues a mutate request to apply the recommendation. recommendation_service = client.service.recommendation response = recommendation_service.apply_recommendation( customer_id: customer_id, operations: [operations], ) response.results.each do |applied_recommendation| puts "Applied recommendation with resource name: '#{applied_recommendation.resource_name}'." end end
Perl
# Issue a mutate request to apply the recommendations. my $apply_recommendation_response = $api_client->RecommendationService()->apply({ customerId => $customer_id, operations => $apply_recommendation_operations }); foreach my $result (@{$apply_recommendation_response->{results}}) { printf "Applied recommendation with resource name: '%s'.\n", $result->{resourceName}; }
觀看下列影片瞭解詳情
套用參數
大量
錯誤
測試命名空間
關閉建議
您可以使用 RecommendationService
關閉建議。程式碼結構與套用建議類似,但需使用 DismissRecommendationOperation
和 RecommendationService.DismissRecommendation
。
觀看下列影片瞭解詳情
大量
錯誤
測試命名空間
自動套用建議
您可以使用 RecommendationSubscriptionService
自動套用特定類型的最佳化建議。
如要訂閱特定推薦類型,請建立 RecommendationSubscription
物件,將 type
欄位設為其中一個支援的推薦類型,並將 status
欄位設為 ENABLED
。
訂閱支援的最佳化建議類型
ENHANCED_CPC_OPT_IN
KEYWORD
KEYWORD_MATCH_TYPE
LOWER_TARGET_ROAS
MAXIMIZE_CLICKS_OPT_IN
OPTIMIZE_AD_ROTATION
RAISE_TARGET_CPA
RESPONSIVE_SEARCH_AD
RESPONSIVE_SEARCH_AD_IMPROVE_AD_STRENGTH
SEARCH_PARTNERS_OPT_IN
SEARCH_PLUS_OPT_IN
SET_TARGET_CPA
SET_TARGET_ROAS
TARGET_CPA_OPT_IN
TARGET_ROAS_OPT_IN
USE_BROAD_MATCH_KEYWORD
擷取訂閱項目
如要取得帳戶推薦訂閱項目的相關資訊,請查詢 recommendation_subscription
資源。
如要查看自動套用的變更,請查詢 change_event
資源,並將 change_event.client_type
篩選為 GOOGLE_ADS_RECOMMENDATIONS_SUBSCRIPTION
。
建立廣告活動時的最佳化建議
使用 RecommendationService.GenerateRecommendationsRequest
即可在廣告活動建構期間,針對特定一組建議類型產生建議。
GenerateRecommendations
接受做為客戶 ID 輸入客戶 ID,廣告管道類型必須是 SEARCH
或 PERFORMANCE_MAX
,要產生的建議類型清單,以及依賴指定類型的各種資料點。這個函式會根據您提供的資料輸出 Recommendation
物件清單。如果資料不足以產生所要求的 recommendation_types
最佳化建議,或是廣告活動已處於建議狀態,則結果集不會包含該類型的最佳化建議。請確保應用程式能夠處理所要求推薦類型未傳回建議的情況。
下表說明 GenerateRecommendations
支援的推薦類型,以及您必須提供的欄位,才能接收該類型的推薦內容。最佳做法是,在收集到與要求建議類型相關的所有資訊之後,傳送 GenerateRecommendations
要求。如要進一步瞭解必填和選填欄位,包括巢狀欄位,請參閱參考說明文件。
RecommendationType | 必填欄位 | 選填欄位 |
---|---|---|
CAMPAIGN_BUDGET (自 v18 起) |
在搜尋和最高成效廣告活動中,下列欄位皆為必填:
|
|
KEYWORD |
|
|
MAXIMIZE_CLICKS_OPT_IN |
|
|
MAXIMIZE_CONVERSIONS_OPT_IN |
|
|
MAXIMIZE_CONVERSION_VALUE_OPT_IN |
|
|
SET_TARGET_CPA |
|
|
SET_TARGET_ROAS |
|
|
SITELINK_ASSET
注意:傳回的 SitelinkAssetRecommendation 物件會包含空白清單。如果 GenerateRecommendations 回應包含 SitelinkAssetRecommendation ,可視為信號,在廣告活動中新增至少一個網站連結素材資源。 |
|
|
TARGET_CPA_OPT_IN |
|
|
TARGET_ROAS_OPT_IN |
|
使用流程示例
假設貴公司是一間廣告代理商,負責向使用者提供廣告活動建構工作流程,且您想在該流程期間向使用者提供建議。您可以使用 GenerateRecommendationsRequest
隨選產生建議,並將這些建議整合至廣告活動建構使用者介面。
使用流程可能如下所示:
使用者前往您的應用程式建立最高成效廣告活動。
在廣告活動建構流程中,使用者會提供一些初始資訊。舉例來說,他們提供詳細資料來建立單一
SitelinkAsset
,並選取TARGET_SPEND
做為智慧出價策略。您傳送的
GenerateRecommendationsRequest
會設定下列欄位:campaign_sitelink_count
:設為1
,即進行中的廣告活動中網站連結素材資源的數量。bidding_info
:將巢狀bidding_strategy_type
欄位設為TARGET_SPEND
。conversion_tracking_status
:設為此客戶的ConversionTrackingStatus
。如要瞭解如何擷取這個欄位,請參閱轉換管理入門指南。recommendation_types
:設為[SITELINK_ASSET, MAXIMIZE_CLICKS_OPT_IN]
。advertising_channel_type
:設為PERFORMANCE_MAX
。customer_id
:設為建立廣告活動的客戶 ID。
您可以採用
GenerateRecommendationsResponse
中的最佳化建議 (在本例中為SitelinkAssetRecommendation
和MaximizeClicksOptInRecommendation
),並在廣告活動建構介面中顯示這些最佳化建議,向使用者提供建議。如果使用者接受建議,您可以在使用者完成廣告活動建構流程後,將建議納入廣告活動建立要求。