创建“推荐活动”商品详情组

为“旅游服务”广告组创建信息组的结构层次和树状结构构建流程与酒店广告信息组相同。

如需对“推荐活动”广告资源进行分区,请使用 ListingDimensionInfo 中提供的专用活动维度:

  • ActivityCountryInfo:按目标国家/地区 (value) 进行过滤,使用地理位置定位常量资源名称(geoTargetConstants/{criterion_id},例如美国的 "geoTargetConstants/2840")。
  • ActivityStateInfo:按目的地州/省/自治区或地区 (value) 进行过滤,使用地理位置定位常量资源名称 (geoTargetConstants/{criterion_id})。
  • ActivityCityInfo:按目的地城市 (value) 进行过滤,使用地理位置定位常量资源名称(geoTargetConstants/{criterion_id},例如纽约市的 "geoTargetConstants/1023191")。
  • ActivityRatingInfo:按活动星级或房客评分(value,介于 1 到 5 之间的整数,其中 5 为最高分)进行过滤。
  • ActivityIdInfo:按“待办事项中心”Feed (value) 中定义的特定活动 ID 进行过滤。

维度层次结构规则

构建“推荐活动”产品信息组树时,请遵循以下规则:

  1. 根节点:每个产品信息组树都必须以单个根 AdGroupCriterion 开头,该根的 listing_group.type 为 SUBDIVISION(如果您想要单个全方位节点,则为 UNIT),且 case_value 未设置。
  2. 细分和单位:中间分支必须将 type 设置为 SUBDIVISION,而叶节点必须将 type 设置为 UNIT。对于推荐活动广告系列,您可以选择在 UNIT 节点上设置 cpc_bid_micros,因为出价由广告系列的 MaximizeConversionValue 策略自动管理。如需排除某个叶单元,使其无法提供服务,请在其 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
)

后续步骤