优化得分和建议

视频:深入探究

建议可以改善您的 您的广告系列:

  • 引入相关的新功能
  • 通过改进出价、关键字和广告获得更多的投入回报
  • 提高广告系列的整体效果和效率

若要提高优化得分,您可以使用 RecommendationService(用于检索) 然后相应地采纳或拒绝这些建议从 v15 开始 Google Ads API 后,您还可以订阅自动应用 使用 RecommendationSubscriptionService 进行推荐。

优化得分

视频:优化得分

优化得分是 预估您的 Google Ads 账号在设置方面的优化程度和可用情况 在CustomerCampaign 级。

通过 Customer.optimization_score_weight 仅适用于非经理账号,用于计算 多个账号的优化得分。检索优化得分并 将账号的优化得分权重相乘 (Customer.optimization_score * Customer.optimization_score_weight) 可计算 整体优化得分。

针对customercampaign,可以使用与优化相关的指标 报告:

  1. 通过 metrics.optimization_score_url 提供了指向账号的深层链接,用于查看 Google Ads 界面中的建议。
  2. 通过 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 为因以下原因而被降位的商品添加 age group [年龄段] 属性: 缺少年龄段
SHOPPING_ADD_COLOR 为因缺少商品而降位的商品添加颜色 颜色
SHOPPING_ADD_GENDER 请为因缺失而降位的商品添加性别 性别
SHOPPING_ADD_GTIN 为降位的商品添加 GTIN(全球贸易项目代码) 因为缺少 GTIN
SHOPPING_ADD_MORE_IDENTIFIERS 为因缺失而被降位的商品添加更多标识码 标识符
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 中的大多数其他实体一样,Recommendation 对象使用 GoogleAdsService.SearchStream

对于每种类型的建议 建议字段。例如,CAMPAIGN_BUDGET 项建议 请查看 campaign_budget_recommendation 字段,并封装在 CampaignBudgetRecommendation 对象。

recommendation 并集字段。

对建议的影响

某些建议类型会填充 impact 字段。 RecommendationImpact 包含估算广告对账号效果可能产生的影响, 来采纳建议以下 推荐指标 (在 impact.base_metricsimpact.potential_metrics 字段中提供):

  • impressions

  • clicks

  • cost_micros

  • conversions

  • all_conversions(从 Google Ads API v16 开始提供)

  • 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.V17.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)
    )
      

Ruby

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 可以 会在检索到建议后过时。

最好在检索后尽快对建议采取措施。

采纳建议

视频:采纳建议

您可以通过 ApplyRecommendation 方法的 RecommendationService

建议类型可以包含必需参数或可选参数。大多数人 建议附带默认使用的推荐值。

无法为自动采纳建议设置账号 支持所有建议类型。不过,您也可以实现类似的 Google Ads API 完全支持的建议类型的行为。 参阅 DetectAndApplyRecommendations 代码 示例了解详情。

使用 apply_parameters ApplyRecommendationOperation 的并集字段,以对其应用建议 特定的参数值每种合适的建议类型都有自己的字段。 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
      

Ruby

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::V17::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::V17::Resources::Ad->new({
  #   id => "INSERT_AD_ID_AS_INTEGER_HERE"
  # });
  # my $text_ad_parameters =
  #   Google::Ads::GoogleAds::V17::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::V17::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.V17.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}'."
        )
      

Ruby

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。代码 结构与采纳建议类似,但改用 DismissRecommendationOperationRecommendationService.DismissRecommendation

观看这些视频,了解详情

批量

错误

测试

自动采纳建议

从 Google Ads API v15 开始,您可以使用 RecommendationSubscriptionService 来自动采纳特定类型的建议

如需订阅特定的推荐类型,请创建一个 RecommendationSubscription 对象, 将 type 字段设为以下其中一项: 支持的建议 types,并设置 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_client_typeGOOGLE_ADS_RECOMMENDATIONS_SUBSCRIPTION

广告系列制作方面的建议

从 Google Ads API v16 版开始,您可以使用 RecommendationService.GenerateRecommendationsRequest 在广告系列制作期间针对指定的一组数据生成建议, 建议类型。

GenerateRecommendations 接受客户 ID(一个广告渠道)作为输入内容 该类型必须是 SEARCHPERFORMANCE_MAX, 要生成的建议类型列表,以及根据相关数据 指定的类型。它会根据Recommendation 您提供的数据。如果数据不足,无法生成建议 针对所请求的 recommendation_types、 或者,如果广告系列已处于建议状态,则结果集不会 包含针对该类型的建议请确保您的应用会处理 未针对所请求的建议返回任何建议的情况 。

下表介绍了 GenerateRecommendations 支持,以及您必须提供的字段才能接收 建议。按照最佳做法, 收集到所有信息之后GenerateRecommendations 请求 与所请求的建议类型有关如需了解更多详情,请参阅 必填字段和选填字段(包括嵌套字段),请查阅 参考文档

RecommendationType 必填字段 可选字段
KEYWORD
  • seed_info
  • ad_group_info
MAXIMIZE_CLICKS_OPT_IN
  • conversion_tracking_status
  • bidding_info
MAXIMIZE_CONVERSIONS_OPT_IN
  • conversion_tracking_status
  • bidding_info
MAXIMIZE_CONVERSION_VALUE_OPT_IN
  • conversion_tracking_status
  • bidding_info
SET_TARGET_CPA
  • conversion_tracking_status
  • bidding_info
SET_TARGET_ROAS
  • conversion_tracking_status
  • bidding_info
SITELINK_ASSET
注意:返回的 SitelinkAssetRecommendation 对象将包含空列表。如果 GenerateRecommendations 包含 SitelinkAssetRecommendation,其可以是 视作向广告系列添加至少一个站内链接素材资源的信号。
  • campaign_sitelink_count
TARGET_CPA_OPT_IN
  • conversion_tracking_status
  • bidding_info
TARGET_ROAS_OPT_IN
  • conversion_tracking_status
  • bidding_info

使用流程示例

假设您的公司是一家广告代理机构 并且希望向用户提供建议 会非常有用您可以使用 GenerateRecommendationsRequest 按需生成建议,并将这些建议 复制到广告系列制作界面中

使用流程可能如下所示:

  1. 用户进入您的应用制作效果最大化广告系列。

  2. 用户提供一些初始信息作为广告系列的一部分 构建流程。例如,它们提供了构建单个 SitelinkAsset,他们选择 TARGET_SPEND 用作智能出价 策略

  3. 您发送一个 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。

  4. 您可以在 GenerateRecommendationsResponse - 在这个示例中, SitelinkAssetRecommendationMaximizeClicksOptInRecommendation ,并通过在您的广告系列中展示这些素材资源,向用户推荐这些素材资源 构建界面。如果用户接受了某个建议,您可以 在用户完成上述操作后,将代码添加到广告系列制作请求中。 广告系列制作流程