Google Ads API를 사용하여 호텔 광고에 대한 입찰가를 설정하거나 업데이트할 수 있습니다.
설정 시
bidding_strategy
드림
또는 bidding_strategy_type
있습니다. bidding_strategy_type
필드는
캠페인의 현재 설정을 읽을 수 있습니다. 필드는 읽기 전용입니다.
수수료 (전환당 또는 숙박 건당) 전략의 경우:
- 처음에는 캠페인의 일환으로 캠페인 수준에서 입찰 전략을 할당합니다.
- 고정 전환 비율을 업데이트하여 입찰가를 업데이트할 수 있습니다. 전략 할당 시 캠페인 수준에서 설정된 값입니다. 대상 자세한 내용은 입찰 전략을 업데이트합니다.
CPC 비율 또는 수동 CPC 전략의 경우:
- 광고그룹 수준에서 입찰가를 설정하거나 업데이트할 수 있습니다. 자세한 내용은 CPC 비율 또는 수동 CPC 입찰 금액 설정
- 캠페인 수준에서 향상된 CPC 입찰기능을 사용하도록 입찰을 업데이트할 수 있습니다 (자세한 내용은 자세한 내용은 호텔 광고에 적용할 수 있는 향상된 CPC 입찰기능에 대한 정보를 참고하세요. 사용할 입찰 업데이트 향상된 CPC 입찰기능에 대해 자세히 알아보려면 입찰 전략 할당을 참고하세요.
CPC 비율 또는 수동 CPC 입찰 금액 설정
CPC 비율 및 수동 CPC 입찰 전략의 경우 구체적인 입찰가를 다음과 같이 설정해야 합니다.
- 광고그룹 수준
- 등록정보 그룹 트리의 단위 노드에 있는 등록정보 그룹 수준
하지만 광고 그룹에서 이 값을 호텔 광고에서는 해당 값을 사용하지 않습니다. 호텔 광고는 등록정보 그룹 수준이며, 이는 광고에서 관련성 없는 값을 재정의합니다. 설정할 수 있습니다
또한 입찰 전략을 선택합니다. 자세한 내용은 입찰 전략 할당 또는 업데이트하기
광고 그룹 입찰가 설정하기
아래 코드는 생성 시 광고그룹 수준에서 입찰가를 설정하는 방법을 보여줍니다. 새 호텔 광고그룹을 만들 수 있습니다
자바
private String addHotelAdGroup( GoogleAdsClient googleAdsClient, long customerId, String campaignResourceName) { // Creates an ad group. AdGroup adGroup = AdGroup.newBuilder() .setName("Earth to Mars Cruises #" + getPrintableDateTime()) .setCampaign(campaignResourceName) // Sets the ad group type to HOTEL_ADS. This cannot be set to other types. .setType(AdGroupType.HOTEL_ADS) .setCpcBidMicros(1_000_000L) .setStatus(AdGroupStatus.ENABLED) .build(); // Creates an ad group operation. AdGroupOperation operation = AdGroupOperation.newBuilder().setCreate(adGroup).build(); // Issues a mutate request to add an ad group. try (AdGroupServiceClient adGroupServiceClient = googleAdsClient.getLatestVersion().createAdGroupServiceClient()) { MutateAdGroupResult mutateAdGroupResult = adGroupServiceClient .mutateAdGroups(Long.toString(customerId), Collections.singletonList(operation)) .getResults(0); System.out.printf( "Added a hotel ad group with resource name: '%s'%n", mutateAdGroupResult.getResourceName()); return mutateAdGroupResult.getResourceName(); } }
C#
private static string AddHotelAdGroup(GoogleAdsClient client, long customerId, string campaignResourceName) { // Get the AdGroupService. AdGroupServiceClient service = client.GetService(Services.V17.AdGroupService); // Create an ad group. AdGroup adGroup = new AdGroup() { Name = "Earth to Mars Cruise #" + ExampleUtilities.GetRandomString(), // Sets the campaign. Campaign = campaignResourceName, // Optional: Sets the ad group type to HOTEL_ADS. // This cannot be set to other types. Type = AdGroupType.HotelAds, CpcBidMicros = 10000000, Status = AdGroupStatus.Enabled }; // Create an ad group operation. AdGroupOperation adGroupOperation = new AdGroupOperation() { Create = adGroup }; // Issue a mutate request to add an ad group. MutateAdGroupsResponse response = service.MutateAdGroups(customerId.ToString(), new AdGroupOperation[] { adGroupOperation }); return response.Results[0].ResourceName; }
PHP
private static function addHotelAdGroup( GoogleAdsClient $googleAdsClient, int $customerId, string $campaignResourceName ) { // Creates an ad group. $adGroup = new AdGroup([ 'name' => 'Earth to Mars Cruise #' . Helper::getPrintableDatetime(), // Sets the campaign. 'campaign' => $campaignResourceName, // Sets the ad group type to HOTEL_ADS. // This cannot be set to other types. 'type' => AdGroupType::HOTEL_ADS, 'cpc_bid_micros' => 10000000, 'status' => AdGroupStatus::ENABLED, ]); // Creates an ad group operation. $adGroupOperation = new AdGroupOperation(); $adGroupOperation->setCreate($adGroup); // Issues a mutate request to add an ad group. $adGroupServiceClient = $googleAdsClient->getAdGroupServiceClient(); $response = $adGroupServiceClient->mutateAdGroups( MutateAdGroupsRequest::build($customerId, [$adGroupOperation]) ); /** @var AdGroup $addedAdGroup */ $addedAdGroup = $response->getResults()[0]; printf( "Added a hotel ad group with resource name '%s'.%s", $addedAdGroup->getResourceName(), PHP_EOL ); return $addedAdGroup->getResourceName(); }
Python
def add_hotel_ad_group(client, customer_id, campaign_resource_name): ad_group_service = client.get_service("AdGroupService") # Create ad group. ad_group_operation = client.get_type("AdGroupOperation") ad_group = ad_group_operation.create ad_group.name = f"Earth to Mars cruise {uuid.uuid4()}" ad_group.status = client.enums.AdGroupStatusEnum.ENABLED ad_group.campaign = campaign_resource_name # Sets the ad group type to HOTEL_ADS. This cannot be set to other types. ad_group.type_ = client.enums.AdGroupTypeEnum.HOTEL_ADS ad_group.cpc_bid_micros = 10000000 # Add the ad group. ad_group_response = ad_group_service.mutate_ad_groups( customer_id=customer_id, operations=[ad_group_operation] ) ad_group_resource_name = ad_group_response.results[0].resource_name print( "Added a hotel ad group with resource name '{ad_group_resource_name}'." ) return ad_group_resource_name
Ruby
def add_hotel_ad_group(client, customer_id, campaign_resource) # Create an ad group. ad_group_operation = client.operation.create_resource.ad_group do |ag| ag.name = generate_random_name_field("Earth to Mars Cruise") # Set the campaign. ag.campaign = campaign_resource # Optional: Set the ad group type to HOTEL_ADS. # This cannot be set to other types. ag.type = :HOTEL_ADS ag.cpc_bid_micros = 10_000_000 ag.status = :ENABLED end # Issue a mutate request to add the ad group. ad_group_service = client.service.ad_group response = ad_group_service.mutate_ad_groups( customer_id: customer_id, operations: [ad_group_operation] ) # Fetch the new ad group's resource name. ad_group_resource = response.results.first.resource_name puts "Added hotel ad group with resource name '#{ad_group_resource}'." ad_group_resource end
Perl
sub add_hotel_ad_group { my ($api_client, $customer_id, $campaign_resource_name) = @_; # Create an ad group. my $ad_group = Google::Ads::GoogleAds::V17::Resources::AdGroup->new({ name => "Earth to Mars Cruise #" . uniqid(), # Set the campaign. campaign => $campaign_resource_name, # Set the ad group type to HOTEL_ADS. # This cannot be set to other types. type => HOTEL_ADS, cpcBidMicros => 1000000, status => Google::Ads::GoogleAds::V17::Enums::AdGroupStatusEnum::ENABLED }); # Create an ad group operation. my $ad_group_operation = Google::Ads::GoogleAds::V17::Services::AdGroupService::AdGroupOperation-> new({create => $ad_group}); # Add the ad group. my $ad_group_resource_name = $api_client->AdGroupService()->mutate({ customerId => $customer_id, operations => [$ad_group_operation]})->{results}[0]{resourceName}; printf "Added a hotel ad group with resource name: '%s'.\n", $ad_group_resource_name; return $ad_group_resource_name; }
등록정보 그룹 단위 노드에 입찰가 설정
호텔 등록정보 그룹 만들기에 설명된 대로
하나 이상의 유효한 등록정보 그룹 트리를 만들어야 광고가 게재됩니다.
노드 단위입니다. 또한 노드는 클러스터의
ListingGroupInfo
클래스:
ListingGroupType
입력란
- 노드가 단위인지 하위 그룹인지를 나타냅니다. ListingGroupInfo
을(를) 다음으로 설정
링크 AdGroupCriterion
개 중 listing_group
개
ListingGroupInfo
객체를 AdGroup
에 추가합니다. 다음과 같은 작업을 할 수 있습니다.
percent_cpc_bid_micros
필드 또는
AdGroupCriterion
의 cpc_bid_micros
필드입니다. 하위 부문에서 이렇게 하려는 경우
노드가 실패합니다
등록정보 그룹 수준에서 입찰가를 설정할 때는 다음 사항에 유의하세요.
- '모든 호텔'에서는 입찰가를 설정할 수 없습니다. (루트) 호텔 등록정보 그룹
- 하위 그룹에는 입찰가를 설정할 수 없습니다.
- '기타'에 입찰가를 설정하지 않는 것이 좋습니다. 사용 중인 노드에는 사용할 수 있습니다 '기타'에 입찰 (단위) 노드는 다른 노드에 의도치 않은 영향을 줄 수 있습니다 호텔 광고 입찰가
아래 코드는 등록정보 그룹 단위 노드에 입찰가를 설정하는 방법을 보여줍니다.
자바
private static String addLevel1Nodes( long customerId, long adGroupId, String rootResourceName, List<AdGroupCriterionOperation> operations, long percentCpcBidMicroAmount) { // Creates hotel class info and dimension info for 5-star hotels. ListingDimensionInfo fiveStarredDimensionInfo = ListingDimensionInfo.newBuilder() .setHotelClass(HotelClassInfo.newBuilder().setValue(5).build()) .build(); // Creates listing group info for 5-star hotels as a UNIT node. ListingGroupInfo fiveStarredUnit = ListingGroupInfo.newBuilder() .setType(ListingGroupType.UNIT) .setParentAdGroupCriterion(rootResourceName) .setCaseValue(fiveStarredDimensionInfo) .build(); // Creates an ad group criterion for 5-star hotels. AdGroupCriterion fiveStarredAdGroupCriterion = createAdGroupCriterion(customerId, adGroupId, fiveStarredUnit, percentCpcBidMicroAmount); // Decrements the temp ID for the next ad group criterion. AdGroupCriterionOperation operation = generateCreateOperation(fiveStarredAdGroupCriterion); operations.add(operation); // You can also create more UNIT nodes for other hotel classes by copying the above code in // this method and modifying the value passed to HotelClassInfo() to the value you want. // For instance, passing 4 instead of 5 in the above code will create a UNIT node of 4-star // hotels instead. // Creates hotel class info and dimension info for other hotel classes by not specifying // any attributes on those object. ListingDimensionInfo otherHotelsDimensionInfo = ListingDimensionInfo.newBuilder() .setHotelClass(HotelClassInfo.newBuilder().build()) .build(); // Creates listing group info for other hotel classes as a SUBDIVISION node, which will be // used as a parent node for children nodes of the next level. ListingGroupInfo otherHotelsSubdivision = createListingGroupInfo( ListingGroupType.SUBDIVISION, rootResourceName, otherHotelsDimensionInfo); // Creates an ad group criterion for other hotel classes. AdGroupCriterion otherHotelsAdGroupCriterion = createAdGroupCriterion( customerId, adGroupId, otherHotelsSubdivision, percentCpcBidMicroAmount); operation = generateCreateOperation(otherHotelsAdGroupCriterion); operations.add(operation); return otherHotelsAdGroupCriterion.getResourceName(); }
C#
private string AddLevel1Nodes(long customerId, long adGroupId, string rootResourceName, List<AdGroupCriterionOperation> operations, long percentCpcBidMicroAmount) { // Create listing dimension info for 5-star class hotels. ListingDimensionInfo fiveStarredListingDimensionInfo = new ListingDimensionInfo { HotelClass = new HotelClassInfo { Value = 5 } }; // Create a listing group info for 5-star hotels as a UNIT node. ListingGroupInfo fiveStarredUnit = CreateListingGroupInfo(ListingGroupType.Unit, rootResourceName, fiveStarredListingDimensionInfo); // Create an ad group criterion for 5-star hotels. AdGroupCriterion fiveStarredAdGroupCriterion = CreateAdGroupCriterion(customerId, adGroupId, fiveStarredUnit, percentCpcBidMicroAmount); // Create an operation and add it to the list of operations. operations.Add(new AdGroupCriterionOperation { Create = fiveStarredAdGroupCriterion }); // Decrement the temp ID for the next ad group criterion. nextTempId--; // You can also create more UNIT nodes for other hotel classes by copying the above code // in this method and modifying the value passed to HotelClassInfo(). // For instance, passing 4 instead of 5 in the above code will instead create a UNIT // node of 4-star hotels. // Create hotel class info and dimension info for other hotel classes by *not* // specifying any attributes on those object. ListingDimensionInfo otherHotelsListingDimensionInfo = new ListingDimensionInfo { HotelClass = new HotelClassInfo() }; // Create listing group info for other hotel classes as a SUBDIVISION node, which will // be used as a parent node for children nodes of the next level. ListingGroupInfo otherHotelsSubdivisionListingGroupInfo = CreateListingGroupInfo (ListingGroupType.Subdivision, rootResourceName, otherHotelsListingDimensionInfo); // Create an ad group criterion for other hotel classes. AdGroupCriterion otherHotelsAdGroupCriterion = CreateAdGroupCriterion(customerId, adGroupId, otherHotelsSubdivisionListingGroupInfo, percentCpcBidMicroAmount); // Create an operation and add it to the list of operations. operations.Add(new AdGroupCriterionOperation { Create = otherHotelsAdGroupCriterion }); // Decrement the temp ID for the next ad group criterion. nextTempId--; return otherHotelsAdGroupCriterion.ResourceName; }
PHP
private static function addLevel1Nodes( int $customerId, int $adGroupId, string $rootResourceName, array &$operations, int $percentCpcBidMicroAmount ) { // Creates hotel class info and dimension info for 5-star hotels. $fiveStarredDimensionInfo = new ListingDimensionInfo([ 'hotel_class' => new HotelClassInfo(['value' => 5]) ]); // Creates listing group info for 5-star hotels as a UNIT node. $fiveStarredUnit = self::createListingGroupInfo( ListingGroupType::UNIT, $rootResourceName, $fiveStarredDimensionInfo ); // Creates an ad group criterion for 5-star hotels. $fiveStarredAdGroupCriterion = self::createAdGroupCriterion( $customerId, $adGroupId, $fiveStarredUnit, $percentCpcBidMicroAmount ); // Decrements the temp ID for the next ad group criterion. self::$nextTempId--; $operation = self::generateCreateOperation($fiveStarredAdGroupCriterion); $operations[] = $operation; // You can also create more UNIT nodes for other hotel classes by copying the above code in // this method and modifying the value passed to HotelClassInfo() to the value you want. // For instance, passing 4 instead of 5 in the above code will create a UNIT node of 4-star // hotels instead. // Creates hotel class info and dimension info for other hotel classes by *not* specifying // any attributes on those object. $othersHotelsDimensionInfo = new ListingDimensionInfo([ 'hotel_class' => new HotelClassInfo() ]); // Creates listing group info for other hotel classes as a SUBDIVISION node, which will be // used as a parent node for children nodes of the next level. $otherHotelsSubDivision = self::createListingGroupInfo( ListingGroupType::SUBDIVISION, $rootResourceName, $othersHotelsDimensionInfo ); // Creates an ad group criterion for other hotel classes. $otherHotelsAdGroupCriterion = self::createAdGroupCriterion( $customerId, $adGroupId, $otherHotelsSubDivision, $percentCpcBidMicroAmount ); $operation = self::generateCreateOperation($otherHotelsAdGroupCriterion); $operations[] = $operation; self::$nextTempId--; return $otherHotelsAdGroupCriterion->getResourceName(); }
Python
def add_level1_nodes( client, customer_id, ad_group_id, root_resource_name, operations, percent_cpc_bid_micro_amount, ): """Creates child nodes on level 1, partitioned by the hotel class info. Args: client: The Google Ads API client. customer_id: The Google Ads customer ID. ad_group_id: The ad group ID to which the hotel listing group will be added. root_resource_name: The string resource name of the listing group's root node. operations: A list of AdGroupCriterionOperations. percent_cpc_bid_micro_amount: The CPC bid micro amount to be set on created ad group criteria. Returns: The string resource name of the "other hotel classes" node, which serves as the parent node for the next level of the listing tree. """ global next_temp_id # Create listing dimension info for 5-star class hotels. five_starred_listing_dimension_info = client.get_type( "ListingDimensionInfo" ) five_starred_listing_dimension_info.hotel_class.value = 5 # Create a listing group info for 5-star hotels as a UNIT node. five_starred_unit = create_listing_group_info( client, client.enums.ListingGroupTypeEnum.UNIT, root_resource_name, five_starred_listing_dimension_info, ) # Create an ad group criterion for 5-star hotels. five_starred_ad_group_criterion = create_ad_group_criterion( client, customer_id, ad_group_id, five_starred_unit, percent_cpc_bid_micro_amount, ) # Create an operation and add it to the list of operations. five_starred_ad_group_criterion_operation = client.get_type( "AdGroupCriterionOperation" ) client.copy_from( five_starred_ad_group_criterion_operation.create, five_starred_ad_group_criterion, ) operations.append(five_starred_ad_group_criterion_operation) # Decrement the temp ID for the next ad group criterion. next_temp_id -= 1 # You can also create more UNIT nodes for other hotel classes by copying the # above code in this method and modifying the hotel class value. # For instance, passing 4 instead of 5 in the above code will instead create # a UNIT node of 4-star hotels. # Create hotel class info and dimension info without any specifying # attributes. This node will then represent hotel classes other than those # already covered by UNIT nodes at this level. other_hotels_listing_dimension_info = client.get_type( "ListingDimensionInfo" ) # Set "hotel_class" as the oneof field on the ListingDimensionInfo object # without specifying the optional hotel_class field. client.copy_from( other_hotels_listing_dimension_info.hotel_class, client.get_type("HotelClassInfo"), ) # Create listing group info for other hotel classes as a SUBDIVISION node, # which will be used as a parent node for children nodes of the next level. other_hotels_subdivision_listing_group_info = create_listing_group_info( client, client.enums.ListingGroupTypeEnum.SUBDIVISION, root_resource_name, other_hotels_listing_dimension_info, ) # Create an ad group criterion for other hotel classes. other_hotels_ad_group_criterion = create_ad_group_criterion( client, customer_id, ad_group_id, other_hotels_subdivision_listing_group_info, percent_cpc_bid_micro_amount, ) # Create an operation and add it to the list of operations. other_hotels_ad_group_criterion_operation = client.get_type( "AdGroupCriterionOperation" ) client.copy_from( other_hotels_ad_group_criterion_operation.create, other_hotels_ad_group_criterion, ) operations.append(other_hotels_ad_group_criterion_operation) # Decrement the temp ID for the next ad group criterion. next_temp_id -= 1 return other_hotels_ad_group_criterion.resource_name
Ruby
def add_level1_nodes( client, customer_id, ad_group_id, root_resource_name, operations, percent_cpc_bid_micro_amount) # Creates hotel class info and dimension info for 5-star hotels. five_starred_dimension_info = client.resource.listing_dimension_info do |d| d.hotel_class = client.resource.hotel_class_info do |c| c.value = 5 end end # Creates listing group info for 5-star hotels as a UNIT node. five_starred_unit = create_listing_group_info( client, :UNIT, root_resource_name, five_starred_dimension_info, ) # Creates an ad group criterion for 5-star hotels. five_starred_ad_group_criterion = create_ad_group_criterion( client, customer_id, ad_group_id, five_starred_unit, percent_cpc_bid_micro_amount, ) operations << generate_create_operation( client, five_starred_ad_group_criterion, ) # You can also create more UNIT nodes for other hotel classes by copying the # above code in this method and modifying the value passed to HotelClassInfo() # to the value you want. # For instance, passing 4 instead of 5 in the above code will create a UNIT # node of 4-star hotels instead. # Creates hotel class info and dimension info for other hotel classes # by *not* specifying any attributes on those object. other_hotels_dimention_info = client.resource.listing_dimension_info do |d| d.hotel_class = client.resource.hotel_class_info end # Creates listing group info for other hotel classes as a SUBDIVISION node, # which will be used as a parent node for children nodes of the next level. other_hotels_subdivision = create_listing_group_info( client, :SUBDIVISION, root_resource_name, other_hotels_dimention_info, ) # Creates an ad group criterion for other hotel classes. other_hotels_ad_group_criterion = create_ad_group_criterion( client, customer_id, ad_group_id, other_hotels_subdivision, percent_cpc_bid_micro_amount, ) operations << generate_create_operation( client, other_hotels_ad_group_criterion, ) other_hotels_ad_group_criterion.resource_name end
Perl
sub add_level_1_nodes { my ($customer_id, $ad_group_id, $root_resource_name, $operations, $percent_cpc_bid_micro_amount) = @_; # Create hotel class info and dimension info for 5-star hotels. my $five_starred_dimension_info = Google::Ads::GoogleAds::V17::Common::ListingDimensionInfo->new({ hotelClass => Google::Ads::GoogleAds::V17::Common::HotelClassInfo->new({ value => 5 })}); # Create listing group info for 5-star hotels as a UNIT node. my $five_starred_unit = create_listing_group_info(UNIT, $root_resource_name, $five_starred_dimension_info); # Create an ad group criterion for 5-star hotels. my $five_starred_ad_group_criterion = create_ad_group_criterion($customer_id, $ad_group_id, $five_starred_unit, $percent_cpc_bid_micro_amount); my $operation = generate_create_operation($five_starred_ad_group_criterion); push @$operations, $operation; # You can also create more UNIT nodes for other hotel classes by copying the # above code in this method and modifying the value passed to HotelClassInfo # to the value you want. For instance, passing 4 instead of 5 in the above code # will create a UNIT node of 4-star hotels instead. # Create hotel class info and dimension info for other hotel classes by *not* # specifying any attributes on those object. my $others_hotels_dimension_info = Google::Ads::GoogleAds::V17::Common::ListingDimensionInfo->new({ hotelClass => Google::Ads::GoogleAds::V17::Common::HotelClassInfo->new()} ); # Create listing group info for other hotel classes as a SUBDIVISION node, which # will be used as a parent node for children nodes of the next level. my $other_hotels_subdivision = create_listing_group_info(SUBDIVISION, $root_resource_name, $others_hotels_dimension_info); # Create an ad group criterion for other hotel classes. my $other_hotels_ad_group_criterion = create_ad_group_criterion($customer_id, $ad_group_id, $other_hotels_subdivision, $percent_cpc_bid_micro_amount); $operation = generate_create_operation($other_hotels_ad_group_criterion); push @$operations, $operation; return $other_hotels_ad_group_criterion->{resourceName}; }