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

为推荐活动广告组创建产品信息组时,遵循的结构层次和树形结构构建流程与 酒店广告产品信息组相同。

如需对推荐活动广告资源进行分区,请使用专用活动 维度,这些维度可在 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 中定义的特定活动 ID (value) 进行过滤。

维度层次结构规则

构建推荐活动商品详情组树形结构时,请遵循以下规则:

  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
)

后续步骤