สร้างกลุ่มข้อมูลกิจกรรมน่าสนใจ

การสร้างกลุ่มข้อมูลสำหรับกลุ่มโฆษณาสิ่งที่ควรทำเป็นไปตามลำดับชั้นโครงสร้างและกระบวนการสร้างโครงสร้างเดียวกันกับกลุ่มข้อมูลโฆษณาโรงแรม

หากต้องการแบ่งพาร์ติชันพื้นที่โฆษณากิจกรรมน่าสนใจ ให้ใช้มิติข้อมูลกิจกรรมเฉพาะที่มีใน 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: กรองตามรหัสกิจกรรมที่เฉพาะเจาะจง ที่กำหนดไว้ในฟีดศูนย์กิจกรรมน่าสนใจ (value)

กฎลำดับชั้นของมิติข้อมูล

เมื่อสร้างโครงสร้างกลุ่มรายชื่อกิจกรรมน่าสนใจ ให้ทำตามกฎต่อไปนี้

  1. โหนดรูท: ต้นไม้กลุ่มรายชื่อแต่ละต้นต้องเริ่มต้นด้วยรูทเดียว AdGroupCriterion ซึ่งมี listing_group.type เป็น SUBDIVISION (หรือ UNIT หาก ต้องการโหนดแบบครอบคลุมรายการเดียว) และมี case_value เป็นไม่ได้ตั้งค่า
  2. หน่วยย่อยและหน่วย: สาขาขั้นกลางต้องตั้งค่า type เป็น SUBDIVISION ส่วนโหนดใบต้องตั้งค่า type เป็น UNIT การตั้งค่า cpc_bid_micros ในโหนด UNIT เป็นตัวเลือกสำหรับแคมเปญกิจกรรมน่าสนใจ เนื่องจากระบบจะจัดการการเสนอราคาโดยอัตโนมัติด้วยMaximizeConversionValueกลยุทธ์ของแคมเปญ หากต้องการยกเว้นหน่วยย่อยไม่ให้แสดงโฆษณา ให้ตั้งค่า negative = true ใน AdGroupCriterion
  3. โหนดสำรอง ("อื่นๆ ที่เหลือ"): หมวดย่อยทุกรายการต้องได้รับการแบ่งพาร์ติชันอย่างสมบูรณ์ บุตรหลานทั้งหมดของกลุ่มย่อยต้องใช้ListingDimensionInfoประเภทย่อยเดียวกัน และบุตรหลาน 1 คนต้องเป็นอินสแตนซ์ว่างของประเภทย่อยนั้นเพื่อบันทึกพื้นที่โฆษณาที่เหลือทั้งหมด

แผนผังต่อไปนี้แสดงลําดับชั้นที่ถูกต้องซึ่งแบ่งพาร์ติชันตามประเทศ เมือง และรหัสกิจกรรม

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 ต่อไปนี้สร้างรูท SUBDIVISION โดยใช้รหัสชั่วคราว (-1) และแบ่งพาร์ติชันตาม 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
)

ขั้นตอนถัดไป