建立觀光景點商家資訊群組

為觀光景點廣告群組建立商家資訊群組時,採用的結構階層和樹狀結構建立程序,與飯店廣告商家資訊群組相同。

如要劃分觀光景點商品目錄,請使用 ListingDimensionInfo 中提供的專用活動維度:

  • ActivityCountryInfo:使用指定地理區域常數資源名稱 (geoTargetConstants/{criterion_id},例如美國為 "geoTargetConstants/2840"),依目的地國家/地區 (value) 篩選。
  • ActivityStateInfo:使用指定地理區域常數資源名稱 (geoTargetConstants/{criterion_id}),依目的地州/省或區域 (value) 篩選。
  • ActivityCityInfo:使用指定地理區域常數資源名稱 (geoTargetConstants/{criterion_id},例如紐約市的 "geoTargetConstants/1023191"),依目的地城市 (value) 篩選。
  • ActivityRatingInfo:依活動星級或使用者評分篩選 (value,1 到 5 之間的整數,5 為最高)。
  • ActivityIdInfo:依觀光景點中心動態饋給 (value) 中定義的特定活動 ID 篩選。

維度階層規則

建立觀光景點商家資訊群組樹狀結構時,請遵循下列規則:

  1. 根節點:每個商家資訊群組樹狀結構都必須以單一根 AdGroupCriterion 開頭,其 listing_group.type 為 SUBDIVISION (如果您想要單一涵蓋所有節點,則為 UNIT),且其 case_value 未設定。
  2. 子部門和單位:中繼分支必須將 type 設為 SUBDIVISION,而葉節點必須將 type 設為 UNIT。觀光景點廣告活動的出價是由廣告活動的MaximizeConversionValue策略自動管理,因此不一定要在 UNIT 節點上設定 cpc_bid_micros。如要排除葉單元,請在 AdGroupCriterion 上設定 negative = true。
  3. 備用 (「其他所有項目」) 節點:每個子類別都必須完整劃分。子類別的所有直接子項都必須使用相同的 ListingDimensionInfo 子類型,且其中一個子項必須是該子類型的空白例項,才能擷取所有剩餘的廣告空間。

下圖顯示依國家/地區、城市和活動 ID 分割的有效階層:

Root (SUBDIVISION)
 ├── ActivityCountryInfo: "geoTargetConstants/2840" (US, SUBDIVISION)
 │    ├── ActivityCityInfo: "geoTargetConstants/1023191" (New York, SUBDIVISION)
 │    │    ├── ActivityIdInfo: "activity_123" (UNIT, biddable)
 │    │    └── ActivityIdInfo: <empty> (UNIT, "Everything else in New York")
 │    └── ActivityCityInfo: <empty> (UNIT, "Everything else in US")
 └── ActivityCountryInfo: <empty> (UNIT, negative=true, excluded)

程式碼範例

以下 Python 範例使用臨時 ID (-1) 建立根 SUBDIVISION,並依 ActivityCountryInfo 將其分區為美國的指定單元 ("geoTargetConstants/2840"),以及所有其他國家/地區的排除備用單元:

ad_group_service = client.get_service("AdGroupService")
ad_group_criterion_service = client.get_service("AdGroupCriterionService")
ad_group_resource_name = ad_group_service.ad_group_path(
    customer_id, ad_group_id
)
operations = []

# 1. Create the root SUBDIVISION node with temporary criterion ID -1.
root_op = client.get_type("AdGroupCriterionOperation")
root = root_op.create
root.resource_name = ad_group_criterion_service.ad_group_criterion_path(
    customer_id, ad_group_id, -1
)
root.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
root.listing_group.type_ = client.enums.ListingGroupTypeEnum.SUBDIVISION
operations.append(root_op)

# 2. Create a child UNIT node targeting activities in the US.
us_op = client.get_type("AdGroupCriterionOperation")
us_unit = us_op.create
us_unit.ad_group = ad_group_resource_name
us_unit.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
us_unit.listing_group.type_ = client.enums.ListingGroupTypeEnum.UNIT
us_unit.listing_group.parent_ad_group_criterion = root.resource_name
us_unit.listing_group.case_value.activity_country.value = "geoTargetConstants/2840"
operations.append(us_op)

# 3. Create the required fallback ("Everything else") UNIT node.
other_op = client.get_type("AdGroupCriterionOperation")
other_unit = other_op.create
other_unit.ad_group = ad_group_resource_name
other_unit.negative = True
other_unit.listing_group.type_ = client.enums.ListingGroupTypeEnum.UNIT
other_unit.listing_group.parent_ad_group_criterion = root.resource_name
client.copy_from(
    other_unit.listing_group.case_value.activity_country,
    client.get_type("ActivityCountryInfo"),
)
operations.append(other_op)

response = ad_group_criterion_service.mutate_ad_group_criteria(
    customer_id=customer_id, operations=operations
)

後續步驟