Używaj ustawienia kierowania w grupach reklam i kampaniach, aby określić, czy chcesz wyświetlać reklamy tylko określonym segmentom odbiorców lub obok wybranych przez Ciebie treści.
Konfigurowanie ustawienia kierowania
Możesz skonfigurować szczegóły dotyczące sposobu używania różnych typów kryteriów do kierowania, ustawiając pole TargetingSetting z tablicą target_restrictions (lub stosując aktualizacje przyrostowe za pomocą target_restriction_operations). Każdy obiekt TargetRestriction pozwala kontrolować, czy obiekt TargetingDimension (AUDIENCE, TOPIC, GENDER, AGE_RANGE, PLACEMENT, PARENTAL_STATUS lub INCOME_RANGE) używa opcji bid_only.
Gdy ustawisz bid_only na true, ustawienie kierowania zostanie ustawione na „Obserwacja”, a kryteria nie będą używane do ograniczania ruchu, ale pozwolą Ci ustalać różne stawki dla różnych użytkowników na listach. Ustawienie bid_only na false powoduje, że ustawienie kierowania ma wartość „Kierowanie”, i włącza kryteria ograniczające ruch w grupie reklam tylko do użytkowników z listy, na którą kierujesz reklamy.
Najważniejsze różnice zostały podsumowane w tej tabeli:
| Ustawienie | bid_only |
Wpływ na zasięg | Wpływ na określanie stawek |
|---|---|---|---|
| Kierowanie | false |
Ogranicza zasięg tylko do wybranych kryteriów. | Można ustawiać konkretne stawki dla kryteriów. |
| Obserwacja | true |
Nie zawęża zasięgu; reklamy wyświetlają się normalnie. | Umożliwia dostosowywanie stawek na podstawie kryteriów. |
Praktyczne scenariusze
Oto krótkie przykłady, kiedy należy używać trybu Obserwacja, a kiedy trybu Kierowanie:
- Obserwacja
- Użyj trybu obserwacji, jeśli prowadzisz kampanię w sieci wyszukiwania i chcesz wiedzieć, jak dobrze konwertują konkretni odbiorcy (np. „fani sportu”) w porównaniu z ogółem użytkowników, bez ograniczania wyświetlania reklam tylko do tej grupy odbiorców. Możesz dodać „fanów sportu” jako kryterium odbiorców z ustawieniem
bid_only = true(Obserwacja) i zastosować dostosowanie stawki o +10%. Dzięki temu możesz zbierać dane o skuteczności dotyczące tej grupy odbiorców i ustalać bardziej konkurencyjne stawki, jeśli jej skuteczność jest wysoka, bez utraty ruchu od użytkowników spoza tej grupy. - Kierowanie
- Użyj trybu kierowania, jeśli prowadzisz kampanię w sieci reklamowej, aby prowadzić remarketing wśród użytkowników, którzy wcześniej odwiedzili Twoją witrynę, ale nie dokonali konwersji, i chcesz, aby te konkretne reklamy widzieli tylko użytkownicy z listy „Porzucający koszyk”. W tym przypadku dodajesz listę „Porzucający koszyk” jako kryterium
UserListz ustawieniembid_only = false(Kierowanie). Dzięki temu budżet grupy reklam będzie wydawany tylko na docieranie do tego segmentu odbiorców o sprecyzowanych zamiarach.
Sprawdzone metody
W przypadku wymiarów kierowania innych niż kierowanie demograficzne (np. AUDIENCE) parametr bid_only jest domyślnie ustawiony na false, co oznacza, że ustawienie kierowania ma wartość „Kierowanie”.
Jeśli ograniczenie kierowania dla jednego z tych wymiarów zostanie pominięte lub nie będzie obecne w tablicy target_restrictions elementu TargetingSetting, system przyjmie domyślne działanie „Kierowanie” (bid_only jest domyślnie ustawione na false) dla tego wymiaru.
To zachowanie interfejsu API niskiego poziomu może się różnić od zachowania interfejsu Google Ads, który może automatycznie stosować domyślnie ustawienie „Obserwacja” (bid_only to true) w przypadku niektórych wymiarów kierowania (np. AUDIENCE w kampaniach w sieci wyszukiwania) podczas tworzenia kampanii lub grup reklam. Na przykład kampanie produktowe utworzone za pomocą interfejsu mogą domyślnie pomijać ustawienia wymiaru AUDIENCE z perspektywy interfejsu API, co oznacza, że domyślnie dziedziczą zachowanie interfejsu API „Kierowanie” (bid_only to false).
Jeśli dodajesz segmenty odbiorców do kampanii w sieci wyszukiwania lub kampanii produktowej, rozważ wyraźne skonfigurowanie ustawienia kierowania bid_only na true, aby ustawić je na „Obserwacja”.
Jeśli konfigurujesz zduplikowaną kampanię na potrzeby segmentów odbiorców w przypadku reklam w sieci wyszukiwania,
ustaw kierowanie na bid_only na false.
Ograniczenia
Nie możesz dodać ani zaktualizować pola targeting_setting w obiekcie AdGroup, jeśli w kampanii nadrzędnej jest ustawione pole targeting_setting. Jeśli targeting_setting jest ustawiony w nadrzędnym elemencie Campaign, musisz najpierw usunąć targeting_setting z nadrzędnego elementu Campaign. Podobnie musisz najpierw usunąć targeting_setting z AdGroup, aby ustawić go na Campaign.
Aby usunąć element targeting_setting z elementu Campaign lub AdGroup, wyślij operację update, w której pole targeting_setting.target_restrictions jest wyczyszczone (ustawione na pustą listę), i uwzględnij pole targeting_setting.target_restrictions w parametrze update_mask.
Pobieranie ustawienia kierowania
Aby sprawdzić, czy kierowanie jest skonfigurowane zgodnie z Twoimi oczekiwaniami, sprawdź targeting_setting w grupach reklam lub kampaniach, wysyłając w zapytaniu żądanie pola ad_group.targeting_setting.target_restrictions z zasobu ad_group lub pola campaign.targeting_setting.target_restrictions z zasobu campaign.
Przykład
Ten przykład aktualizuje targeting_setting w grupie reklam, tak aby bid_only miało wartość true dla instancji TargetRestriction z targeting_dimension o wartości AUDIENCE. Pozwala to obserwować skuteczność i ustawiać dostosowania stawek dla użytkowników w segmencie odbiorców bez ograniczania zasięgu.
Najpierw pobierz wszystkie ad_group.targeting_setting.target_restrictions z grupy reklam o podanym identyfikatorze.
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
Następnie przejdź przez ograniczenia dotyczące celu i zrekonstruuj obiekty TargetingSetting. Jeśli kod napotka obiekt TargetRestriction z wartością targeting_dimension równą AUDIENCE i wartością bid_only równą false, zaktualizuje pole bid_only obiektu TargetRestriction do wartości true (lub „Observation”) i doda je do obiektu TargetingSetting. W przeciwnym razie dodaj obiekt TargetRestriction zwrócony z serwera do 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
Na koniec, jeśli kod napotka ograniczenie kierowania, które wymaga aktualizacji, zaktualizuje grupę reklam, stosując nowe ustawienia kierowania.
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
Proces ustawiania pola bid_only w kampaniach jest prawie identyczny.
Co dalej?
- Obsługiwane typy kryteriów znajdziesz w przewodniku po kryteriach.