Sử dụng chế độ cài đặt tiêu chí nhắm mục tiêu trong nhóm quảng cáo hoặc chiến dịch để chỉ định xem có thu hẹp quảng cáo để chỉ hiển thị cho các phân khúc đối tượng cụ thể hay không, hoặc trên nội dung cụ thể mà bạn đã chọn.
Thiết lập chế độ cài đặt nhắm mục tiêu
Bạn có thể thiết lập thông tin chi tiết về cách sử dụng các loại tiêu chí khác nhau để nhắm mục tiêu bằng cách đặt trường TargetingSetting bằng một mảng target_restrictions (hoặc bằng cách áp dụng các bản cập nhật gia tăng bằng target_restriction_operations). Mỗi TargetRestriction cho phép bạn kiểm soát xem TargetingDimension (AUDIENCE, TOPIC, GENDER, AGE_RANGE, PLACEMENT, PARENTAL_STATUS hoặc INCOME_RANGE) có sử dụng tuỳ chọn bid_only hay không.
Khi bạn đặt bid_only thành true, chế độ cài đặt tiêu chí nhắm mục tiêu sẽ được đặt thành "Quan sát" và tiêu chí này sẽ không được dùng để hạn chế lưu lượng truy cập, nhưng sẽ cho phép bạn đặt giá thầu khác nhau cho những người dùng khác nhau trong danh sách của bạn. Việc đặt bid_only thành false sẽ đặt chế độ cài đặt nhắm mục tiêu thành "Nhắm mục tiêu" và bật tiêu chí để hạn chế lưu lượng truy cập của nhóm quảng cáo chỉ cho người dùng trong danh sách được nhắm mục tiêu.
Bảng sau đây tóm tắt những điểm khác biệt chính:
| Cài đặt | bid_only |
Ảnh hưởng đối với phạm vi tiếp cận | Tác động đến hoạt động đặt giá thầu |
|---|---|---|---|
| Nhắm mục tiêu | false |
Thu hẹp phạm vi tiếp cận để chỉ nhắm đến những tiêu chí đã chọn | Có thể đặt giá thầu cụ thể cho các tiêu chí |
| Quan sát | true |
Không thu hẹp phạm vi tiếp cận; quảng cáo hiển thị như bình thường | Cho phép điều chỉnh giá thầu theo tiêu chí |
Các trường hợp thực tế
Sau đây là một số ví dụ ngắn gọn về thời điểm nên sử dụng chế độ Quan sát so với chế độ Nhắm mục tiêu:
- Quan sát
- Sử dụng chế độ Quan sát nếu bạn chạy chiến dịch Tìm kiếm và muốn biết mức độ chuyển đổi của một đối tượng cụ thể (ví dụ: "người hâm mộ thể thao") so với công chúng nói chung, mà không hạn chế quảng cáo của bạn chỉ cho đối tượng đó. Bạn có thể thêm "người hâm mộ thể thao" làm tiêu chí Đối tượng bằng chế độ cài đặt
bid_only = true(Quan sát) và áp dụng mức điều chỉnh giá thầu +10%. Nhờ đó, bạn có thể thu thập dữ liệu hiệu suất cho đối tượng đó và đặt giá thầu cạnh tranh hơn cho họ nếu họ hoạt động hiệu quả mà không làm mất lưu lượng truy cập từ những người dùng không thuộc đối tượng đó. - Nhắm mục tiêu
- Sử dụng chế độ Nhắm mục tiêu nếu bạn chạy chiến dịch Hiển thị để tái tiếp thị cho những người dùng đã từng truy cập vào trang web của bạn nhưng không chuyển đổi, và bạn chỉ muốn những người dùng trong danh sách người dùng "Người bỏ dở giỏ hàng" nhìn thấy những quảng cáo cụ thể này. Trong trường hợp này, bạn thêm danh sách "Người bỏ dở giỏ hàng" làm tiêu chí
UserListvớibid_only = false(Nhắm mục tiêu). Điều này đảm bảo ngân sách của nhóm quảng cáo chỉ được chi tiêu để tiếp cận phân khúc đối tượng có ý định cao này.
Các phương pháp hay nhất
Đối với các phương diện nhắm mục tiêu không theo nhân khẩu học (chẳng hạn như AUDIENCE), bid_only được đặt thành false theo mặc định, tức là chế độ cài đặt tiêu chí nhắm mục tiêu được đặt thành "Nhắm mục tiêu".
Nếu một quy định hạn chế về tiêu chí nhắm mục tiêu cho một trong các phương diện này bị bỏ qua hoặc không có trong mảng target_restrictions của TargetingSetting, thì hệ thống sẽ áp dụng hành vi mặc định của "Nhắm mục tiêu" (bid_only ngầm định là false) cho phương diện đó.
Hành vi của API cấp thấp này có thể khác với giao diện người dùng Google Ads, giao diện này có thể tự động áp dụng "Quan sát" (bid_only là true) theo mặc định cho một số phương diện nhắm mục tiêu (chẳng hạn như AUDIENCE cho chiến dịch Tìm kiếm) khi chiến dịch hoặc nhóm quảng cáo được tạo. Ví dụ: theo mặc định, các chiến dịch Mua sắm được tạo thông qua giao diện người dùng có thể bỏ qua chế độ cài đặt phương diện AUDIENCE theo quan điểm của API, tức là các chiến dịch này ngầm kế thừa hành vi mặc định của API là "Nhắm mục tiêu" (bid_only là false).
Nếu bạn đang thêm phân khúc đối tượng vào chiến dịch Tìm kiếm hoặc chiến dịch Mua sắm, hãy cân nhắc việc định cấu hình rõ ràng chế độ cài đặt tiêu chí nhắm mục tiêu của bid_only thành true để đặt chế độ này thành "Quan sát".
Nếu bạn đang thiết lập một chiến dịch trùng lặp cho các phân khúc đối tượng cho quảng cáo tìm kiếm,
hãy đặt tiêu chí nhắm mục tiêu của bid_only thành false.
Quy định hạn chế
Bạn không thể thêm hoặc cập nhật targeting_setting trên một
AdGroup nếu targeting_setting được đặt trên
chiến dịch gốc. Nếu targeting_setting được đặt trên Campaign mẹ, thì trước tiên, bạn phải xoá targeting_setting trên Campaign mẹ. Tương tự,
trước tiên, bạn phải xoá targeting_setting trên AdGroup để đặt
trên Campaign.
Để xoá targeting_setting khỏi Campaign hoặc AdGroup, hãy gửi thao tác update trong đó targeting_setting.target_restrictions bị xoá (đặt thành danh sách trống) và thêm targeting_setting.target_restrictions vào update_mask.
Truy xuất chế độ cài đặt tiêu chí nhắm mục tiêu
Để xác minh rằng tiêu chí nhắm mục tiêu của bạn được thiết lập như dự kiến, hãy kiểm tra targeting_setting trên các nhóm quảng cáo hoặc chiến dịch bằng cách yêu cầu trường ad_group.targeting_setting.target_restrictions từ tài nguyên ad_group hoặc trường campaign.targeting_setting.target_restrictions từ tài nguyên campaign trong một cụm từ tìm kiếm.
Ví dụ
Ví dụ này cập nhật targeting_setting trên một nhóm quảng cáo để bid_only là true cho các thực thể TargetRestriction có targeting_dimension là AUDIENCE, cho phép bạn quan sát hiệu suất và đặt mức điều chỉnh giá thầu cho người dùng trong phân khúc đối tượng mà không hạn chế phạm vi tiếp cận.
Trước tiên, hãy truy xuất tất cả ad_group.targeting_setting.target_restrictions từ nhóm quảng cáo có mã nhận dạng được cung cấp.
Java
String searchQuery = "SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions " + "FROM ad_group " + "WHERE ad_group.id = " + adGroupId;
C#
string query = $@" SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions FROM ad_group WHERE ad_group.id = {adGroupId}";
PHP
$query = "SELECT ad_group.id, ad_group.name, " . "ad_group.targeting_setting.target_restrictions " . "FROM ad_group " . "WHERE ad_group.id = $adGroupId";
Python
query: str = f""" SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions FROM ad_group WHERE ad_group.id = {ad_group_id}"""
Ruby
query = <<~QUERY SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions FROM ad_group WHERE ad_group.id = #{ad_group_id} QUERY
Perl
my $query = "SELECT ad_group.id, ad_group.name, " . "ad_group.targeting_setting.target_restrictions FROM ad_group " . "WHERE ad_group.id = $ad_group_id";
curl
Tiếp theo, hãy lặp lại các quy định hạn chế về mục tiêu và tạo lại các đối tượng TargetingSetting. Nếu mã gặp TargetRestriction có targeting_dimension là AUDIENCE và giá trị bid_only là false, thì mã sẽ cập nhật trường bid_only của đối tượng TargetRestriction thành true (hoặc "Observation") và thêm trường đó vào đối tượng TargetingSetting. Nếu không, hãy thêm đối tượng TargetRestriction được trả về từ máy chủ vào TargetingSetting.
Java
for (TargetRestriction targetRestriction : targetRestrictions) { TargetingDimension targetingDimension = targetRestriction.getTargetingDimension(); boolean bidOnly = targetRestriction.getBidOnly(); System.out.printf( "- Targeting restriction with targeting dimension '%s' and bid only set to '%b'.%n", targetingDimension, bidOnly); // Adds the target restriction to the TargetingSetting object as is if the targeting // dimension has a value other than AUDIENCE because those should not change. if (!targetingDimension.equals(TargetingDimension.AUDIENCE)) { targetingSettingBuilder.addTargetRestrictions(targetRestriction); } else if (!bidOnly) { shouldUpdateTargetingSetting = true; // Adds an AUDIENCE target restriction with bid_only set to true to the targeting // setting object. This has the effect of setting the AUDIENCE target restriction to // "Observation". For more details about the targeting setting, visit // https://support.google.com/google-ads/answer/7365594. targetingSettingBuilder.addTargetRestrictions( TargetRestriction.newBuilder() .setTargetingDimensionValue(TargetingDimension.AUDIENCE_VALUE) .setBidOnly(true)); } }
C#
foreach (TargetRestriction targetRestriction in targetRestrictions) { TargetingDimension targetingDimension = targetRestriction.TargetingDimension; bool bidOnly = targetRestriction.BidOnly; Console.WriteLine("\tTargeting restriction with targeting dimension " + $"'{targetingDimension}' and bid only set to '{bidOnly}'."); // Add the target restriction to the TargetingSetting object as is if the // targeting dimension has a value other than AUDIENCE because those should // not change. if (targetingDimension != TargetingDimension.Audience) { targetingSetting.TargetRestrictions.Add(targetRestriction); } else if (!bidOnly) { shouldUpdateTargetingSetting = true; // Add an AUDIENCE target restriction with bid_only set to true to the // targeting setting object. This has the effect of setting the AUDIENCE // target restriction to "Observation". For more details about the // targeting setting, visit // https://support.google.com/google-ads/answer/7365594. targetingSetting.TargetRestrictions.Add(new TargetRestriction { TargetingDimension = TargetingDimension.Audience, BidOnly = true }); } }
PHP
foreach ( $adGroup->getTargetingSetting()->getTargetRestrictions() as $targetRestriction ) { // Prints the results. $targetingDimension = $targetRestriction->getTargetingDimension(); $bidOnly = $targetRestriction->getBidOnly(); printf( "- Targeting restriction with targeting dimension '%s' and bid only set to " . "'%s'.%s", TargetingDimension::name($targetingDimension), $bidOnly ? 'true' : 'false', PHP_EOL ); // Adds the target restriction to the TargetingSetting object as is if the targeting // dimension has a value other than AUDIENCE because those should not change. if ($targetingDimension !== TargetingDimension::AUDIENCE) { $targetRestrictions[] = $targetRestriction; } elseif (!$bidOnly) { $shouldUpdateTargetingSetting = true; // Adds an AUDIENCE target restriction with bid_only set to true to the // targeting setting object. This has the effect of setting the AUDIENCE // target restriction to "Observation". // For more details about the targeting setting, visit // https://support.google.com/google-ads/answer/7365594. $targetRestrictions[] = new TargetRestriction( [ 'targeting_dimension' => TargetingDimension::AUDIENCE, 'bid_only' => true ] ); } }
Python
target_restriction: TargetRestriction for target_restriction in target_restrictions: targeting_dimension: TargetingDimensionEnum.TargetingDimension = ( target_restriction.targeting_dimension ) bid_only: bool = target_restriction.bid_only print( "\tTargeting restriction with targeting dimension " f"'{targeting_dimension.name}' " f"and bid only set to '{bid_only}'." ) # Add the target restriction to the TargetingSetting object as # is if the targeting dimension has a value other than audience # because those should not change. if targeting_dimension != targeting_dimension_enum.AUDIENCE: targeting_setting.target_restrictions.append(target_restriction) elif not bid_only: should_update_targeting_setting: bool = True # Add an audience target restriction with bid_only set to # true to the targeting setting object. This has the effect # of setting the audience target restriction to # "Observation". For more details about the targeting # setting, visit # https://support.google.com/google-ads/answer/7365594. new_target_restriction: TargetRestriction = ( targeting_setting.target_restrictions.add() ) new_target_restriction.targeting_dimension = ( targeting_dimension_enum.AUDIENCE ) new_target_restriction.bid_only = True
Ruby
ad_group.targeting_setting.target_restrictions.each do |r| # Prints the results. targeting_dimension = r.targeting_dimension bid_only = r.bid_only puts "- Targeting restriction with targeting dimension " \ "#{targeting_dimension} and bid only set to #{bid_only}." # Adds the target restriction to the TargetingSetting object as is if the # targeting dimension has a value other than AUDIENCE because those should # not change. if targeting_dimension != :AUDIENCE target_restrictions << r elsif !bid_only should_update_targeting_setting = true # Adds an AUDIENCE target restriction with bid_only set to true to the # targeting setting object. This has the effect of setting the AUDIENCE # target restriction to "Observation". # For more details about the targeting setting, visit # https://support.google.com/google-ads/answer/7365594. target_restrictions << client.resource.target_restriction do |tr| tr.targeting_dimension = :AUDIENCE tr.bid_only = true end end end
Perl
foreach my $target_restriction (@target_restrictions) { my $targeting_dimension = $target_restriction->{targetingDimension}; printf "\tTargeting restriction with targeting dimension '%s' and bid " . "only set to '%s'.\n", $targeting_dimension, $target_restriction->{bidOnly} ? "TRUE" : "FALSE"; # Add the target restriction to the TargetingSetting object as is if the # targeting dimension has a value other than AUDIENCE because those # should not change. if ($targeting_dimension ne AUDIENCE) { $target_restriction->{bidOnly} = $target_restriction->{bidOnly} ? "true" : "false"; push @{$targeting_setting->{targetRestrictions}}, $target_restriction; } elsif (!$target_restriction->{bidOnly}) { $should_update_target_setting = 1; # Add an AUDIENCE target restriction with bid_only set to true to the # targeting setting object. This has the effect of setting the # AUDIENCE target restriction to "Observation". For more details about # the targeting setting, visit # https://support.google.com/google-ads/answer/7365594. my $new_restriction = Google::Ads::GoogleAds::V26::Common::TargetRestriction->new({ targetingDimension => AUDIENCE, bidOnly => "true" }); push @{$targeting_setting->{targetRestrictions}}, $new_restriction; } }
curl
Cuối cùng, nếu mã gặp phải một quy định hạn chế về tiêu chí nhắm mục tiêu cần cập nhật, thì mã sẽ cập nhật nhóm quảng cáo bằng chế độ cài đặt tiêu chí nhắm mục tiêu mới.
Java
private void updateTargetingSetting( GoogleAdsClient googleAdsClient, long customerId, long adGroupId, TargetingSetting targetingSetting) { // Creates the ad group service client. try (AdGroupServiceClient adGroupServiceClient = googleAdsClient.getLatestVersion().createAdGroupServiceClient()) { // Creates an ad group object with the proper resource name and updated targeting setting. AdGroup adGroup = AdGroup.newBuilder() .setResourceName(ResourceNames.adGroup(customerId, adGroupId)) .setTargetingSetting(targetingSetting) .build(); // Constructs an operation that will update the ad group, using the FieldMasks utility to // derive the update mask. This mask tells the Google Ads API which attributes of the // ad group you want to change. AdGroupOperation operation = AdGroupOperation.newBuilder() .setUpdate(adGroup) .setUpdateMask(FieldMasks.allSetFieldsOf(adGroup)) .build(); // Sends the operation in a mutate request. MutateAdGroupsResponse response = adGroupServiceClient.mutateAdGroups( Long.toString(customerId), ImmutableList.of(operation)); // Prints the resource name of the updated object. System.out.printf( "Updated targeting setting of ad group with resource name '%s'; set the AUDIENCE " + "target restriction to 'Observation'.%n", response.getResults(0).getResourceName()); } }
C#
private void UpdateTargetingSetting(GoogleAdsClient client, long customerId, long adGroupId, TargetingSetting targetingSetting) { // Get the AdGroupService client. AdGroupServiceClient adGroupServiceClient = client.GetService(Services.V26.AdGroupService); // Create an ad group object with the updated targeting setting. AdGroup adGroup = new AdGroup { ResourceName = ResourceNames.AdGroup(customerId, adGroupId), TargetingSetting = targetingSetting }; // Construct an operation that will update the ad group, using the FieldMasks utility // to derive the update mask. This mask tells the Google Ads API which attributes of the // ad group you want to change. AdGroupOperation operation = new AdGroupOperation { Update = adGroup, UpdateMask = FieldMasks.AllSetFieldsOf(adGroup) }; // Send the operation in a mutate request. MutateAdGroupsResponse response = adGroupServiceClient.MutateAdGroups(customerId.ToString(), new[] { operation }); // Print the resource name of the updated object. Console.WriteLine("Updated targeting setting of ad group with resource name " + $"'{response.Results.First().ResourceName}'; set the AUDIENCE target restriction " + "to 'Observation'."); }
PHP
private static function updateTargetingSetting( GoogleAdsClient $googleAdsClient, int $customerId, int $adGroupId, TargetingSetting $targetingSetting ) { // Creates an ad group object with the proper resource name and updated targeting setting. $adGroup = new AdGroup( [ 'resource_name' => ResourceNames::forAdGroup($customerId, $adGroupId), 'targeting_setting' => $targetingSetting ] ); // Constructs an operation that will update the ad group with the specified resource name, // using the FieldMasks utility to derive the update mask. This mask tells the Google Ads // API which attributes of the ad group you want to change. $adGroupOperation = new AdGroupOperation(); $adGroupOperation->setUpdate($adGroup); $adGroupOperation->setUpdateMask(FieldMasks::allSetFieldsOf($adGroup)); // Issues a mutate request to update the ad group. $adGroupServiceClient = $googleAdsClient->getAdGroupServiceClient(); $response = $adGroupServiceClient->mutateAdGroups( MutateAdGroupsRequest::build($customerId, [$adGroupOperation]) ); // Prints the resource name of the updated ad group. printf( "Updated targeting setting of ad group with resource name '%s'; set the AUDIENCE " . "target restriction to 'Observation'.%s", $response->getResults()[0]->getResourceName(), PHP_EOL ); }
Python
def update_targeting_setting( client: GoogleAdsClient, customer_id: str, ad_group_id: str, targeting_setting: TargetingSetting, ) -> None: """Updates the given TargetingSetting of an ad group. Args: client: The Google Ads client. customer_id: The Google Ads customer ID. ad_group_id: The ad group ID for which to update the audience targeting restriction. targeting_setting: The updated targeting setting. """ # Get the AdGroupService client. ad_group_service: AdGroupServiceClient = client.get_service( "AdGroupService" ) # Construct an operation that will update the ad group. ad_group_operation: AdGroupOperation = client.get_type("AdGroupOperation") # Populate the ad group object with the updated targeting setting. ad_group: AdGroup = ad_group_operation.update ad_group.resource_name = ad_group_service.ad_group_path( customer_id, ad_group_id ) ad_group.targeting_setting.target_restrictions.extend( targeting_setting.target_restrictions ) # Use the field_mask utility to derive the update mask. This mask tells the # Google Ads API which attributes of the ad group you want to change. client.copy_from( ad_group_operation.update_mask, protobuf_helpers.field_mask(None, ad_group._pb), ) # Send the operation in a mutate request and print the resource name of the # updated object. mutate_ad_groups_response: MutateAdGroupsResponse = ( ad_group_service.mutate_ad_groups( customer_id=customer_id, operations=[ad_group_operation] ) ) print( "Updated targeting setting of ad group with resource name " f"'{mutate_ad_groups_response.results[0].resource_name}'; set the " "audience target restriction to 'Observation'." )
Ruby
def update_targeting_setting( client, customer_id, ad_group_id, targeting_setting) # Constructs an operation that will update the ad group with the specified # resource name. ad_group_resource_name = client.path.ad_group(customer_id, ad_group_id) operation = client.operation.update_resource.ad_group(ad_group_resource_name) do |ag| ag.targeting_setting = targeting_setting end # Issues a mutate request to update the ad group. response = client.service.ad_group.mutate_ad_groups( customer_id: customer_id, operations: [operation], ) # Prints the resource name of the updated ad group. puts "Updated targeting setting of ad group with resource name " \ "#{response.results.first.resource_name}; set the AUDIENCE target " \ "restriction to 'Observation'." end
Perl
sub update_targeting_setting { my ($api_client, $customer_id, $ad_group_id, $targeting_setting) = @_; # Construct an ad group object with the updated targeting setting. my $ad_group = Google::Ads::GoogleAds::V26::Resources::AdGroup->new({ resourceName => Google::Ads::GoogleAds::V26::Utils::ResourceNames::ad_group( $customer_id, $ad_group_id ), targetingSetting => $targeting_setting }); # Create an operation that will update the ad group, using the FieldMasks # utility to derive the update mask. This mask tells the Google Ads API which # attributes of the ad group you want to change. my $ad_group_operation = Google::Ads::GoogleAds::V26::Services::AdGroupService::AdGroupOperation-> new({ update => $ad_group, updateMask => all_set_fields_of($ad_group)}); # Send the operation in a mutate request and print the resource name of the # updated resource. my $ad_groups_response = $api_client->AdGroupService()->mutate({ customerId => $customer_id, operations => [$ad_group_operation]}); printf "Updated targeting setting of ad group with resourceName " . "'%s'; set the AUDIENCE target restriction to 'Observation'.\n", $ad_groups_response->{results}[0]{resourceName}; }
curl
Quy trình đặt trường bid_only cho chiến dịch gần như giống hệt nhau.
Bước tiếp theo
- Khám phá các loại tiêu chí được hỗ trợ trong Hướng dẫn về tiêu chí.