4.4 广告系列管理

简介


务必要让商家能够在制作广告系列后对其广告系列进行更改。他们应能够更改的最关键的方面如下:

  • 预算
  • 状态(暂停、启用、移除)
  • 地理位置定位(建议选择,但并非强制要求)
  • 您在广告系列制作界面中添加的任何其他字段

用户体验指南


在概览页以及广告系列效果报告的单独页面上显示广告系列列表。允许用户暂停、删除和修改广告系列。

pmax_campaign

修改广告系列应该允许商家修改他们在制作广告系列时提供的输入字段。如下例所示:

edit_pmax

技术指南


制作零售专用效果最大化广告系列后,您可以更改以下广告系列设置:

  • 广告系列名称
  • 广告系列预算
  • 广告系列状态
  • 广告系列定位条件

您可以在开发者指南中找到如何更改资源的详细概览。您可以使用公开的服务端点更改特定资源(例如 CampaignService.MutateCampaigns)以更改该资源,或使用 GoogleAdsService.Mutate 端点提供的批量更改功能跨多个不同资源更改资源。

我们建议尽可能批量更改广告系列,以减少更新广告系列所需的操作次数。考虑到这一点,您应该围绕使用 GoogleAdsService.Mutate 端点而不是单个资源端点来设计架构。这也有助于将来更轻松地扩展功能。

后面的示例假设您已将相关 ID 存储在本地数据库中。

广告系列名称

如需更新广告系列名称,您需要更改 Campaign.name 字段。

且不得包含任何 null(码位 0x0)、NL 换行(码位 0xA)或回车符(码位 0xD)字符。

广告系列预算

更新现有预算,而不是将其替换为新预算,这被认为是最佳做法。这样可确保广告系列支出符合预期,不会导致超额投放。

您只能更新预算的值,而不应改变任何其他字段,这样会提高 DAILY 支出的价值。

Python
budget_resource_name = client.get_service(
        "CampaignBudgetService"
    ).campaign_budget_path(customer_id, budget_id)

mutate_operation = client.get_type("MutateOperation")
campaign_budget = mutate_operation.campaign_budget_operation.update

campaign_budget.resource_name = budget_resource_name

# update the budget amount to the new value

campaign_budget.amount_micros = 50000000

client.copy_from(
    mutate_operation.campaign_budget_operation.update_mask,
    protobuf_helpers.field_mask(None, campaign_budget._pb),
)
return mutate_operation

广告系列状态

若要更新广告系列的状态(启用/暂停/移除),您需要更改 Campaign.status 字段并从 CampaignStatus 枚举分配相关状态。

您可以在更新广告系列的示例代码中找到更改广告系列状态的示例。

广告系列条件

更新广告系列条件时,您只需提供更新向用户显示的条件的功能,这至少是地理位置定位和语言定位。您可以在更新广告系列条件出价调节系数的示例代码中找到更新广告系列条件的示例。

若要更新地理位置定位条件,您可以将 CampaignCriterion.location 更新为新的地理位置定位条件常量的值。

Python
criterion_rname = client.get_service(
    "CampaignCriterionService"
    ).campaign_criterion_path(
    customer_id, campaign_id, criterion_id
)

mutate_operation = client.get_type("MutateOperation")
campaign_criterion = mutate_operation.campaign_criterion_operation.update

campaign_criterion.resource_name = criterion_rname

# Set the geo to the update geo targeting

campaign_criterion.location.geo_target_constant = (
   geo_target_constant_service.geo_target_constant_path("1022762")
) # Brooklyn

client.copy_from(
    mutate_operation.campaign_criterion_operation.update_mask,
    protobuf_helpers.field_mask(None, campaign_criterion._pb),
)
return mutate_operation

如需更新语言定位条件,您需要使用新的语言常量更新 CampaignCriterion.language 的值。

Python
campaign_criterion_service = client.get_service("CampaignCriterionService")

criterion_rname = campaign_criterion_service.campaign_criterion_path(
   customer_id, campaign_id, criterion_id
)

mutate_operation = client.get_type("MutateOperation")
campaign_criterion = mutate_operation.campaign_criterion_operation.update

campaign_criterion.resource_name = criterion_rname

# Set the language to the updated language
# For a list of all language codes, see:
# https://developers.google.com/google-ads/api/data/codes-formats#languages
campaign_criterion.language.language_constant = (
    googleads_service.language_constant_path("1000")
)  # English

client.copy_from(
    mutate_operation.campaign_criterion_operation.update_mask,
    protobuf_helpers.field_mask(None, campaign_criterion._pb),
)
return mutate_operation