วิดีโอ: ดูการพูดคุยเรื่องกลุ่มการแสดงข้อมูลจากเวิร์กช็อปปี 2019
กลุ่มโฆษณาโรงแรมรองรับการแบ่งพาร์ติชันโรงแรมออกเป็นกลุ่มข้อมูลโรงแรมหลายกลุ่ม ในมิติข้อมูลต่างๆ เพื่อให้คุณปรับราคาเสนอสำหรับแต่ละกลุ่มได้ตามต้องการ พิจารณาแผนผังด้านล่าง ซึ่งในระดับแรก โรงแรมจะแบ่งออกเป็นโรงแรม 5 ดาว โรงแรม 4 ดาว และระดับโรงแรมอื่นๆ ในระดับที่ 2 เราได้แบ่งโรงแรมในระดับอื่นๆ ออกเป็นโรงแรมใน "สหรัฐอเมริกา" โรงแรมใน "สหราชอาณาจักร" และโรงแรมในภูมิภาคอื่นๆ
แต่ละโหนดในแผนผังจะเป็นทั้งหน่วยย่อยหรือหน่วยตามที่กำหนดโดย
ListingGroupType
การแบ่งย่อยจะสร้าง
ระดับใหม่ในโครงสร้างแบบต้นไม้ ขณะที่หน่วยต่างๆ คือใบของต้นไม้ การแบ่งย่อยแต่ละรายการต้อง
ได้รับการแบ่งพาร์ติชันอย่างสมบูรณ์เสมอ ดังนั้นจึงต้องมีโหนดที่แสดงถึง
อื่นๆ ในตัวอย่างนี้ โหนดรูทและ Hotel Class: (Other) คือ
การแบ่งย่อย โครงสร้างแบบต้นไม้นี้ที่มีการแบ่งย่อยและหน่วยช่วยให้คุณตั้ง
ราคาเสนอที่ระดับหน่วยได้ และยังช่วยให้มั่นใจว่าข้อมูลโรงแรมทุกรายการจะอยู่ในโหนดหน่วยใดหน่วยหนึ่ง
ในโครงสร้างแบบต้นไม้
โหนดคือออบเจ็กต์ของคลาส ListingGroupInfo
ซึ่งมีฟิลด์ ListingGroupType
ที่
ระบุว่าโหนดเป็นหน่วยหรือส่วนย่อย การตั้งค่า ListingGroupInfo
เป็น
listing_group
ของ AdGroupCriterion
จะลิงก์กับ
AdGroup
การตั้งราคาเสนอ CPC เปอร์เซ็นต์
คุณได้รับอนุญาตให้ตั้งค่า percent_cpc_bid_micros
ของ
AdGroupCriterion
ในโหนดหน่วยเท่านั้น การพยายาม
ทำเช่นนี้ในโหนดการแบ่งย่อยจะล้มเหลวพร้อมข้อผิดพลาด
มิติข้อมูลของข้อมูล
ListingGroupInfo
ยังมีcase_value
ซึ่งเป็นListingDimensionInfo
ที่มีมิติข้อมูลประเภทใดประเภทหนึ่งจากหลายประเภท ListingGroupInfo
แสดงค่าที่เชื่อมโยงกับโรงแรม เช่น รหัสโรงแรม ประเทศของโรงแรม หรือระดับโรงแรม ดูคำอธิบายแบบเต็มของประเภท ListingDimensionInfo
ที่ใช้ได้ในเอกสารอ้างอิง
บุตรหลานโดยตรงแต่ละคนของเขตย่อยต้องมี case_value
ที่มี
ListingDimensionInfo
ประเภทเดียวกัน มีเพียงโหนดรูทเท่านั้นที่ไม่มี case_value
โปรดทราบว่าแต่ละส่วนย่อยต้องมี case_value
"ว่าง" ของ
ประเภทที่ถูกต้อง ซึ่งแสดงถึง "ค่าอื่นๆ ทั้งหมด"
ดูรายละเอียดเพิ่มเติมได้ที่โค้ดต่อไปนี้ ซึ่งจะเพิ่มระดับแรกของแผนผังกลุ่มข้อมูล
Java
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: GoogleAdsClient, customer_id: str, ad_group_id: str, root_resource_name: str, operations: List[AdGroupCriterionOperation], percent_cpc_bid_micro_amount: int, ) -> str: """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: ListingDimensionInfo = 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: ListingGroupInfo = 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: AdGroupCriterion = ( 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: AdGroupCriterionOperation = ( 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: ListingDimensionInfo = 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: ListingGroupInfo = ( 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: AdGroupCriterion = ( 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: AdGroupCriterionOperation = ( 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::V21::Common::ListingDimensionInfo->new({ hotelClass => Google::Ads::GoogleAds::V21::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::V21::Common::ListingDimensionInfo->new({ hotelClass => Google::Ads::GoogleAds::V21::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}; }
มิติข้อมูลที่ใช้ได้สำหรับ ListingDimensionInfo
ListingDimensionInfo
ประเภทต่อไปนี้ใช้ได้กับโฆษณาโรงแรม
รหัสชั่วคราว
ระบบจะไม่กําหนดรหัสให้กับเกณฑ์กลุ่มโฆษณาจนกว่าเซิร์ฟเวอร์จะประมวลผลคําขอ Mutate ที่สร้างเกณฑ์เหล่านั้น อย่างไรก็ตาม ListingGroupInfo
จะไม่ถูกต้องจนกว่าจะเสร็จสมบูรณ์ ดังนั้นเมื่อใดก็ตามที่คุณสร้างหน่วยย่อย คุณต้องสร้างหน่วยย่อยอย่างน้อย 1 หน่วยในหน่วยย่อยนั้นในการดำเนินการเดียวกันด้วย
หากต้องการตั้งค่า parent_ad_group_criterion
ของ
ListingGroupInfo
สำหรับโหนดย่อย คุณสามารถใช้
รหัสเกณฑ์ชั่วคราวได้ ตัวระบุเหล่านี้จะไม่ซ้ำกันในเครื่อง (ไม่ใช่ไม่ซ้ำกันทั่วโลก)
ซึ่งใช้ได้เฉพาะในบริบทของคำขอการเปลี่ยนแปลงรายการเดียวเท่านั้น ใช้จำนวนเต็มลบใดก็ได้ (เช่น -1
) เป็นรหัสชั่วคราว
เมื่อประมวลผลคำขอแล้ว ระบบจะกำหนดรหัสส่วนกลางที่เป็นบวกให้กับAdGroupCriterion
แต่ละรายการตามปกติ