Điểm tối ưu hoá và các đề xuất

Video: Tìm hiểu chuyên sâu

Đề xuất có thể cải thiện chiến dịch của bạn theo một số cách:

  • Ra mắt các tính năng mới và phù hợp
  • Sử dụng ngân sách hiệu quả hơn bằng cách cải thiện giá thầu, từ khóa và quảng cáo
  • Tăng hiệu suất và hiệu quả tổng thể của chiến dịch

Để tăng điểm tối ưu hoá, bạn có thể sử dụng RecommendationService để truy xuất các đề xuất, sau đó áp dụng hoặc loại bỏ các đề xuất đó cho phù hợp. Kể từ phiên bản 15 của API Google Ads, bạn cũng có thể đăng ký nhận các đề xuất tự động áp dụng bằng cách sử dụng RecommendationSubscriptionService.

Điểm tối ưu hóa

Video: Điểm tối ưu hoá

Điểm tối ưu hoá là điểm số ước tính về mức độ hiệu quả của tài khoản Google Ads của bạn và hiện có ở cấp CustomerCampaign.

Customer.optimization_score_weight chỉ dành cho các tài khoản không phải tài khoản người quản lý và được dùng để tính điểm tối ưu hoá tổng thể của nhiều tài khoản. Truy xuất điểm tối ưu hoá và trọng số của điểm tối ưu hoá của các tài khoản rồi nhân các tài khoản đó với nhau (Customer.optimization_score * Customer.optimization_score_weight) để tính toán điểm tối ưu hoá tổng thể.

Có các chỉ số liên quan đến việc tối ưu hoá trong báo cáo customercampaign:

  1. metrics.optimization_score_url cung cấp một đường liên kết sâu đến tài khoản để xem thông tin về các đề xuất có liên quan trong giao diện người dùng Google Ads.
  2. metrics.optimization_score_uplift cho biết điểm tối ưu hoá sẽ tăng bao nhiêu nếu bạn áp dụng tất cả các đề xuất liên quan. Đây là số liệu ước tính dựa trên tất cả các đề xuất có sẵn nói chung, không chỉ là tổng điểm mức tăng cho từng đề xuất.

Để nhóm và sắp xếp các đề xuất được trả về, bạn có thể phân đoạn cả hai chỉ số này theo loại đề xuất bằng cách sử dụng segments.recommendation_type trong truy vấn của mình.

Loại đề xuất

Các loại đề xuất được hỗ trợ đầy đủ

RecommendationType Nội dung mô tả
CAMPAIGN_BUDGET Khắc phục chiến dịch bị giới hạn ngân sách
KEYWORD Thêm từ khoá mới
TEXT_AD Thêm đề xuất quảng cáo
TARGET_CPA_OPT_IN Đặt giá thầu với CPA mục tiêu
MAXIMIZE_CONVERSIONS_OPT_IN Đặt giá thầu bằng Tối đa hóa lượt chuyển đổi
MAXIMIZE_CONVERSION_VALUE_OPT_IN Đặt giá thầu bằng chiến lược Tối đa hoá giá trị lượt chuyển đổi
ENHANCED_CPC_OPT_IN Đặt giá thầu bằng cách sử dụng chiến lược CPC nâng cao
MAXIMIZE_CLICKS_OPT_IN Đặt giá thầu với Tối đa hóa số nhấp chuột
OPTIMIZE_AD_ROTATION Sử dụng xoay vòng quảng cáo được tối ưu hóa
MOVE_UNUSED_BUDGET Chuyển chưa sử dụng sang ngân sách bị ràng buộc
TARGET_ROAS_OPT_IN Đặt giá thầu với lợi tức mục tiêu trên chi tiêu quảng cáo
FORECASTING_CAMPAIGN_BUDGET Khắc phục các chiến dịch dự kiến sẽ bị giới hạn theo ngân sách trong tương lai
RESPONSIVE_SEARCH_AD Thêm quảng cáo tìm kiếm thích ứng mới
MARGINAL_ROI_CAMPAIGN_BUDGET Điều chỉnh ngân sách chiến dịch để tăng ROI
USE_BROAD_MATCH_KEYWORD Sử dụng kiểu khớp mở rộng cho chiến dịch dựa trên lượt chuyển đổi có đặt giá thầu tự động
RESPONSIVE_SEARCH_AD_ASSET Thêm thành phần quảng cáo tìm kiếm thích ứng vào quảng cáo
RESPONSIVE_SEARCH_AD_IMPROVE_AD_STRENGTH Cải thiện độ mạnh của quảng cáo tìm kiếm thích ứng
DISPLAY_EXPANSION_OPT_IN Cập nhật chiến dịch để sử dụng tính năng Mở rộng hiển thị
SEARCH_PARTNERS_OPT_IN Mở rộng phạm vi tiếp cận bằng cách thêm các đối tác tìm kiếm của Google
CUSTOM_AUDIENCE_OPT_IN Tạo đối tượng tùy chỉnh
IMPROVE_DISCOVERY_AD_STRENGTH Cải thiện độ mạnh của quảng cáo trong chiến dịch Tạo nhu cầu
UPGRADE_SMART_SHOPPING_CAMPAIGN_TO_PERFORMANCE_MAX Nâng cấp chiến dịch Mua sắm thông minh lên chiến dịch Tối đa hoá hiệu suất
UPGRADE_LOCAL_CAMPAIGN_TO_PERFORMANCE_MAX Nâng cấp chiến dịch địa phương cũ lên chiến dịch Tối đa hoá hiệu suất
SHOPPING_MIGRATE_REGULAR_SHOPPING_CAMPAIGN_OFFERS_TO_PERFORMANCE_MAX Di chuyển những ưu đãi mà chiến dịch Mua sắm thông thường nhắm đến sang chiến dịch Tối đa hoá hiệu suất hiện có
MIGRATE_DYNAMIC_SEARCH_ADS_CAMPAIGN_TO_PERFORMANCE_MAX Di chuyển quảng cáo Tìm kiếm động sang chiến dịch Tối đa hoá hiệu suất
PERFORMANCE_MAX_OPT_IN Tạo chiến dịch Tối đa hoá hiệu suất trong tài khoản
IMPROVE_PERFORMANCE_MAX_AD_STRENGTH Cải thiện độ mạnh của nhóm thành phần của chiến dịch Tối đa hoá hiệu suất lên điểm xếp hạng "Rất tốt"
PERFORMANCE_MAX_FINAL_URL_OPT_IN Bật tính năng Mở rộng URL cuối cùng cho chiến dịch Tối đa hoá hiệu suất
RAISE_TARGET_CPA_BID_TOO_LOW Tăng CPA mục tiêu khi nó quá thấp và có rất ít hoặc không có lượt chuyển đổi nào
FORECASTING_SET_TARGET_ROAS Tăng ngân sách trước khi diễn ra một sự kiện theo mùa được dự đoán sẽ tăng lưu lượng truy cập và thay đổi chiến lược đặt giá thầu từ tối đa hoá giá trị lượt chuyển đổi thành lợi tức mục tiêu trên chi tiêu quảng cáo
LEAD_FORM Thêm thành phần biểu mẫu khách hàng tiềm năng vào chiến dịch
CALLOUT_ASSET Thêm thành phần chú thích vào cấp chiến dịch hoặc cấp khách hàng
SITELINK_ASSET Thêm thành phần đường liên kết của trang web vào cấp chiến dịch hoặc khách hàng
CALL_ASSET Thêm thành phần cuộc gọi vào cấp chiến dịch hoặc cấp khách hàng
SHOPPING_ADD_AGE_GROUP Thêm thuộc tính nhóm tuổi vào những mặt hàng bị giảm hạng do thiếu nhóm tuổi
SHOPPING_ADD_COLOR Thêm màu cho những mặt hàng bị giảm hạng do thiếu màu
SHOPPING_ADD_GENDER Thêm giới tính cho những mặt hàng bị giảm hạng do thiếu giới tính
SHOPPING_ADD_GTIN Thêm GTIN (Mã số sản phẩm thương mại toàn cầu) vào các mặt hàng bị giảm hạng do thiếu GTIN
SHOPPING_ADD_MORE_IDENTIFIERS Thêm giá trị nhận dạng khác vào những mặt hàng bị giảm hạng do thiếu giá trị nhận dạng
SHOPPING_ADD_SIZE Thêm kích thước vào những mặt hàng bị giảm hạng do thiếu kích thước
SHOPPING_ADD_PRODUCTS_TO_CAMPAIGN Thêm sản phẩm để chiến dịch phân phát
SHOPPING_FIX_DISAPPROVED_PRODUCTS Khắc phục sản phẩm bị từ chối
SHOPPING_TARGET_ALL_OFFERS Tạo một chiến dịch toàn diện nhắm đến tất cả ưu đãi
SHOPPING_FIX_SUSPENDED_MERCHANT_CENTER_ACCOUNT Khắc phục các vấn đề về việc tạm ngưng tài khoản Merchant Center
SHOPPING_FIX_MERCHANT_CENTER_ACCOUNT_SUSPENSION_WARNING Khắc phục các vấn đề về cảnh báo tạm ngưng tài khoản Merchant Center
DYNAMIC_IMAGE_EXTENSION_OPT_IN Bật phần mở rộng về hình ảnh linh hoạt trên tài khoản
RAISE_TARGET_CPA Tăng CPA mục tiêu
LOWER_TARGET_ROAS Giảm lợi tức mục tiêu trên chi tiêu quảng cáo
FORECASTING_SET_TARGET_CPA Đặt CPA mục tiêu cho những chiến dịch không được chỉ định CPA trước khi diễn ra một sự kiện theo mùa được dự đoán sẽ tăng lưu lượng truy cập
SET_TARGET_CPA Đặt CPA mục tiêu cho những chiến dịch chưa chỉ định CPA
SET_TARGET_ROAS Đặt lợi tức mục tiêu trên chi tiêu quảng cáo cho những chiến dịch chưa được chỉ định
REFRESH_CUSTOMER_MATCH_LIST Cập nhật danh sách khách hàng chưa được cập nhật trong 90 ngày qua
IMPROVE_GOOGLE_TAG_COVERAGE Triển khai Thẻ Google trên nhiều trang hơn
CALLOUT_EXTENSION (không dùng nữa) Không dùng nữa, chuyển sang dùng CALLOUT_ASSET
SITELINK_EXTENSION (không dùng nữa) Không dùng nữa, chuyển sang dùng SITELINK_ASSET
CALL_EXTENSION (không dùng nữa) Không dùng nữa, chuyển sang dùng CALL_ASSET
KEYWORD_MATCH_TYPE (không dùng nữa) Không dùng nữa, chuyển sang dùng USE_BROAD_MATCH_KEYWORD

Xem video này để tìm hiểu thêm

Xử lý các loại không được hỗ trợ

Truy xuất đề xuất

Video: Lập trình trực tiếp

Giống như hầu hết các thực thể khác trong API Google Ads, đối tượng Recommendation được tìm nạp bằng cách sử dụng GoogleAdsService.SearchStream với truy vấn Ngôn ngữ truy vấn Google Ads.

Đối với mỗi loại đề xuất, thông tin chi tiết được cung cấp trong trường dành riêng cho đề xuất. Ví dụ: thông tin chi tiết về đề xuất CAMPAIGN_BUDGET nằm trong trường campaign_budget_recommendation và được bao bọc trong đối tượng CampaignBudgetRecommendation.

Tìm tất cả trường dành riêng cho đề xuất trong trường hợp nhất recommendation.

Tác động của nội dung đề xuất

Một số loại đề xuất sẽ điền sẵn vào trường impact của đề xuất. RecommendationImpact chứa số liệu ước tính về mức tác động đối với hiệu suất của tài khoản khi áp dụng đề xuất. Các chỉ số đề xuất sau đây có trong các trường impact.base_metricsimpact.potential_metrics:

  • impressions

  • clicks

  • cost_micros

  • conversions

  • all_conversions (có từ phiên bản 16 của API Google Ads)

  • video_views

Ví dụ về mã

Mã mẫu sau đây truy xuất mọi đề xuất hiện có và đã bị loại bỏ thuộc loại KEYWORD từ một tài khoản, đồng thời in một số thông tin chi tiết của các đề xuất đó:

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.V16.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;
}
      

1.199

$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);
  });
      

Chọn cách giải quyết

Bạn có thể áp dụng hoặc loại bỏ mọi đề xuất đã truy xuất.

Tuỳ thuộc vào loại đề xuất, các đề xuất có thể thay đổi hằng ngày hoặc thậm chí nhiều lần trong một ngày. Khi điều đó xảy ra, resource_name của đối tượng đề xuất có thể trở nên lỗi thời sau khi đề xuất được truy xuất.

Bạn nên thực hiện hành động dựa trên đề xuất ngay sau khi truy xuất.

Áp dụng đề xuất

Video: Áp dụng đề xuất

Bạn có thể áp dụng các đề xuất đang hoạt động hoặc đã loại bỏ bằng phương thức ApplyRecommendation của RecommendationService.

Các loại đề xuất có thể có tham số bắt buộc hoặc không bắt buộc. Hầu hết các đề xuất đều đi kèm với các giá trị được đề xuất và được sử dụng theo mặc định.

Tính năng đặt tính năng tự động áp dụng đề xuất không được hỗ trợ cho một số loại đề xuất. Tuy nhiên, bạn có thể triển khai hành vi tương tự cho những loại đề xuất được API Google Ads hỗ trợ đầy đủ. Hãy tham khảo ví dụ về mã DetectAndApplyRecommendations để tìm hiểu thêm.

Sử dụng trường hợp nhất apply_parameters của ApplyRecommendationOperation để áp dụng các đề xuất bằng các giá trị thông số cụ thể. Mỗi loại đề xuất phù hợp đều có trường riêng. Mọi loại đề xuất không được liệt kê trong trường apply_parameters đều không sử dụng các giá trị tham số này.

Ví dụ về mã

Mã sau đây minh hoạ cách tạo ApplyRecommendationOperation và cách ghi đè các giá trị được đề xuất nếu bạn muốn thay thế các giá trị đó bằng giá trị của riêng mình.

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;
}
      

1.199

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::V16::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::V16::Resources::Ad->new({
  #   id => "INSERT_AD_ID_AS_INTEGER_HERE"
  # });
  # my $text_ad_parameters =
  #   Google::Ads::GoogleAds::V16::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::V16::Services::RecommendationService::ApplyRecommendationOperation
    ->new({
      resourceName => $recommendation->{resourceName}});

  return $apply_recommendation_operation;
}
      

Ví dụ tiếp theo gọi ApplyRecommendation, gửi các thao tác áp dụng đề xuất đã được tạo trong mã trước đó.

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.V16.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);
    }
}
      

1.199

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};
}
      

Xem những video này để tìm hiểu thêm

Áp dụng tham số

Hàng loạt

Lỗi

Kiểm thử

Loại bỏ đề xuất

Video: Loại bỏ đề xuất

Bạn có thể loại bỏ các đề xuất bằng RecommendationService. Cấu trúc mã tương tự như việc áp dụng các đề xuất, nhưng thay vào đó, bạn sử dụng DismissRecommendationOperationRecommendationService.DismissRecommendation.

Xem những video này để tìm hiểu thêm

Hàng loạt

Lỗi

Kiểm thử

Tự động áp dụng nội dung đề xuất

Kể từ phiên bản 15 của API Google Ads, bạn có thể dùng RecommendationSubscriptionService để tự động áp dụng các đề xuất thuộc một loại cụ thể.

Để đăng ký theo dõi một loại đề xuất cụ thể, hãy tạo một đối tượng RecommendationSubscription, đặt trường type thành một trong các loại đề xuất được hỗ trợ, và đặt trường status thành ENABLED.

Các loại đề xuất có hỗ trợ gói thuê bao

  • 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

Truy xuất gói thuê bao

Để biết thông tin về gói thuê bao đề xuất của một tài khoản, hãy truy vấn tài nguyên recommendation_subscription.

Để xem những thay đổi được tự động áp dụng, hãy truy vấn tài nguyên change_event, lọc change_client_type thành GOOGLE_ADS_RECOMMENDATIONS_SUBSCRIPTION.

Đề xuất trong quá trình tạo chiến dịch

Kể từ phiên bản 16 của API Google Ads, bạn có thể sử dụng RecommendationService.GenerateRecommendationsRequest để tạo đề xuất trong quá trình tạo chiến dịch, cho một nhóm các loại đề xuất nhất định.

GenerateRecommendations chấp nhận dữ liệu đầu vào làm mã khách hàng, một loại kênh quảng cáo phải là SEARCH hoặc PERFORMANCE_MAX, danh sách các loại đề xuất cần tạo và nhiều điểm dữ liệu phụ thuộc vào loại được chỉ định. Công cụ này sẽ xuất ra một danh sách các đối tượng Recommendation dựa trên dữ liệu mà bạn cung cấp. Nếu không có đủ dữ liệu để tạo đề xuất cho recommendation_types được yêu cầu hoặc nếu chiến dịch đã ở trạng thái được đề xuất, thì tập hợp kết quả sẽ không chứa đề xuất cho loại đó. Hãy đảm bảo ứng dụng của bạn xử lý trường hợp không có đề xuất nào được trả về cho các loại đề xuất đã yêu cầu.

Bảng sau đây mô tả các loại đề xuất mà GenerateRecommendations hỗ trợ và các trường mà bạn phải cung cấp để nhận được đề xuất cho loại đó. Cách tốt nhất là gửi yêu cầu GenerateRecommendations sau khi tất cả thông tin liên quan đến các loại đề xuất đã yêu cầu đã được thu thập. Để biết thêm thông tin chi tiết về các trường bắt buộc và không bắt buộc, bao gồm cả các trường lồng nhau, vui lòng xem tài liệu tham khảo.

RecommendationType Các trường bắt buộc Trường không bắt buộc
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
Lưu ý: Đối tượng SitelinkAssetRecommendation được trả về sẽ chứa các danh sách trống. Nếu phản hồi GenerateRecommendations chứa SitelinkAssetRecommendation, thì đó có thể được coi là tín hiệu để thêm ít nhất một thành phần đường liên kết của trang web vào chiến dịch.
  • campaign_sitelink_count
TARGET_CPA_OPT_IN
  • conversion_tracking_status
  • bidding_info
TARGET_ROAS_OPT_IN
  • conversion_tracking_status
  • bidding_info

Quy trình sử dụng mẫu

Giả sử công ty của bạn là đại lý quảng cáo cung cấp quy trình tạo chiến dịch cho người dùng và bạn muốn cung cấp đề xuất cho người dùng trong quy trình đó. Bạn có thể sử dụng GenerateRecommendationsRequest để tạo các đề xuất theo yêu cầu và tích hợp các đề xuất đó vào giao diện người dùng tạo chiến dịch.

Quy trình sử dụng có thể như sau:

  1. Người dùng truy cập vào ứng dụng của bạn để tạo chiến dịch Tối đa hoá hiệu suất.

  2. Người dùng cung cấp một số thông tin ban đầu trong quy trình tạo chiến dịch. Ví dụ: họ cung cấp thông tin chi tiết để tạo một SitelinkAsset duy nhất và chọn TARGET_SPEND làm chiến lược Đặt giá thầu thông minh.

  3. Bạn gửi GenerateRecommendationsRequest để đặt các trường sau:

    • campaign_sitelink_count: đặt thành 1, là số lượng thành phần đường liên kết của trang web trên chiến dịch đang hoạt động.

    • bidding_info: đặt trường bidding_strategy_type lồng thành TARGET_SPEND.

    • conversion_tracking_status: đặt thành ConversionTrackingStatus của khách hàng này. Để biết hướng dẫn về cách truy xuất trường này, hãy xem hướng dẫn Bắt đầu để quản lý lượt chuyển đổi.

    • recommendation_types: đã đặt thành [SITELINK_ASSET, MAXIMIZE_CLICKS_OPT_IN].

    • advertising_channel_type: đã đặt thành PERFORMANCE_MAX.

    • customer_id: đặt thành mã nhận dạng của khách hàng tạo chiến dịch.

  4. Bạn có thể lấy các đề xuất trong GenerateRecommendationsResponse — trong trường hợp này là SitelinkAssetRecommendationMaximizeClicksOptInRecommendation —rồi đề xuất cho người dùng bằng cách hiển thị các đề xuất đó trong giao diện tạo chiến dịch của bạn. Nếu người dùng chấp nhận đề xuất, thì bạn có thể đưa đề xuất đó vào yêu cầu tạo chiến dịch sau khi người dùng hoàn tất quy trình tạo chiến dịch.