Google Ads API is returning to beta status. Please read our blog post for more details.

制作购物广告系列

实施购物广告的第一步是制作购物广告系列。通过购物广告系列,用户可以查看各种展示产品图片的广告,包括名称、价格、商店名称等。在制作购物广告系列时,您需要为其设置预算、出价策略和购物设置。

在制作购物广告系列前,您必须先将自己的 Google Ads 帐号与 Google Merchant Center 帐号关联起来。如需了解详情,请参阅有关关联帐号的文章。关联帐号后,您可以在指定购物设置时使用 Google Merchant Center 帐号 ID。

您可以使用 Google Ads API 制作以下两种类型的购物广告系列:

要支持这些类型的广告系列,需要使用不同的广告系列设置,具体如下所述。

标准购物广告系列

这是制作产品购物广告所需使用的广告系列。通过产品购物广告,您可以在广告中加入图片、名称、价格以及商店或商家名称,而无需为销售的每件产品单独制作一个广告。

以下是设置标准购物广告系列的步骤:

  1. 将广告系列的 advertising_channel_type 设置为 SHOPPING
  2. 创建 ShoppingSetting,设置相关字段,然后将其添加到广告系列中。
  3. 创建组合出价策略或设置广告系列一级的出价策略。
  4. 创建新的广告系列预算或设置现有的共享预算。

对于标准购物广告系列,ShoppingSetting 支持以下字段:

必填

  • merchant_id - 包含待宣传产品的帐号的 Merchant Center ID。
  • sales_country - 此广告系列待涵盖产品的目标销售国家/地区。
  • campaign_priority - 购物广告系列的优先级。数值越高,相应广告系列的优先级就越高,反之越低。允许的值在 0 到 2 之间(包括 0 和 2)。

选填

  • enable_local - 此广告系列的“为本地店铺所售产品启用广告”选项。

出价策略可以设置为:

标准购物广告系列支持以下出价策略:

组合出价策略

广告系列出价策略

此代码示例演示了如何制作标准购物广告系列。

Java

private String addStandardShoppingCampaign(
    GoogleAdsClient googleAdsClient,
    long customerId,
    String budgetResourceName,
    long merchantCenterAccountId) {

  // Configures the shopping settings.
  ShoppingSetting shoppingSetting =
      ShoppingSetting.newBuilder()
          // Sets the sales country of products to include in the campaign.
          .setSalesCountry(StringValue.of("US"))
          // Sets the priority of the campaign. Higher numbers take priority over lower numbers.
          // For Shopping product ad campaigns, allowed values are between 0 and 2, inclusive.
          .setCampaignPriority(Int32Value.of(0))
          .setMerchantId(Int64Value.of(merchantCenterAccountId))
          // Enables local inventory ads for this campaign.
          .setEnableLocal(BoolValue.of(true))
          .build();

  // Create the standard shopping campaign.
  Campaign campaign =
      Campaign.newBuilder()
          .setName(StringValue.of("Interplanetary Cruise #" + System.currentTimeMillis()))
          // Configures settings related to shopping campaigns including advertising channel type
          // and shopping setting.
          .setAdvertisingChannelType(AdvertisingChannelType.SHOPPING)
          .setShoppingSetting(shoppingSetting)
          // Recommendation: Sets the campaign to PAUSED when creating it to prevent
          // the ads from immediately serving. Set to ENABLED once you've added
          // targeting and the ads are ready to serve.
          .setStatus(CampaignStatus.PAUSED)
          // Sets the bidding strategy to Manual CPC (with eCPC enabled)
          // Recommendation: Use one of the automated bidding strategies for Shopping campaigns
          // to help you optimize your advertising spend. More information can be found here:
          // https://support.google.com/google-ads/answer/6309029.
          .setManualCpc(ManualCpc.newBuilder().setEnhancedCpcEnabled(BoolValue.of(true)).build())
          // Sets the budget.
          .setCampaignBudget(StringValue.of(budgetResourceName))
          .build();

  // Creates a campaign operation.
  CampaignOperation operation = CampaignOperation.newBuilder().setCreate(campaign).build();

  // Issues a mutate request to add the campaign.
  try (CampaignServiceClient campaignServiceClient = googleAdsClient.getLatestVersion().createCampaignServiceClient()) {
    MutateCampaignsResponse response =
        campaignServiceClient.mutateCampaigns(
            Long.toString(customerId), Collections.singletonList(operation));
    MutateCampaignResult result = response.getResults(0);
    System.out.printf(
        "Added a standard shopping campaign with resource name: '%s'%n",
        result.getResourceName());
    return result.getResourceName();
  }
}

智能购物广告系列

这是配置 Smart Shopping ads 所需的广告系列。智能购物广告系列结合了标准购物广告系列和展示广告网络再营销广告系列,可以使用自动出价和广告展示位置,在各个广告网络中宣传您的商品和业务。

以下是设置智能购物广告系列的步骤:

  1. 将广告系列的 advertising_channel_type 设置为 SHOPPING
  2. 将广告系列的 advertising_channel_sub_type 设置为 SHOPPING_SMART_ADS
  3. 创建 ShoppingSettingInfo,设置 merchant_idsales_country,然后将其添加到广告系列中。
  4. 设置广告系列一级的出价策略。
  5. 创建新的广告系列预算(仅限非共享预算)。

对于智能购物广告系列,ShoppingSetting 支持以下字段:

必填

  • merchant_id - 包含待宣传产品的帐号的 Merchant Center ID。
  • sales_country - 此广告系列待涵盖产品的目标销售国家/地区。

选填

  • campaign_priority - 购物广告系列的优先级。数值越高,相应广告系列的优先级就越高,反之越低。对于智能购物广告系列而言,此字段是选填项,如进行设置则须等于 3。

  • enable_local - 此广告系列的“为本地店铺所售产品启用广告”选项。

出价策略可以设置为:

  • 广告系列出价策略 - 直接在广告系列上设置的出价策略,可包括与智能购物广告系列兼容的自动出价策略

智能购物广告系列支持以下出价策略:

广告系列出价策略

您可以选择性地为 maximize_conversion_value 设置广告支出回报率目标,使用 MaximizeConversionValue 上的 target_roas 字段即可。如需详细了解如何尽可能提高转化价值,请参阅支持文章:“尽可能提高转化价值”出价简介

以下代码演示了这些步骤:

Java

private String addSmartShoppingCampaign(
    GoogleAdsClient googleAdsClient,
    long customerId,
    String budgetResourceName,
    long merchantCenterAccountId) {

  // Configures the shopping settings for Smart Shopping campaigns.
  ShoppingSetting shoppingSetting =
      ShoppingSetting.newBuilder()
          // Sets the sales country of products to include in the campaign.
          // Only products from Merchant Center targeting this country will appear in the
          // campaign.
          .setSalesCountry(StringValue.of("US"))
          .setMerchantId(Int64Value.of(merchantCenterAccountId))
          .build();

  // Creates the campaign.
  Campaign campaign =
      Campaign.newBuilder()
          .setName(StringValue.of("Interplanetary Cruise #" + System.currentTimeMillis()))
          // Configures settings related to shopping campaigns including advertising channel type,
          // advertising sub-type and shopping setting.
          .setAdvertisingChannelType(AdvertisingChannelType.SHOPPING)
          .setAdvertisingChannelSubType(AdvertisingChannelSubType.SHOPPING_SMART_ADS)
          .setShoppingSetting(shoppingSetting)
          // Recommendation: Sets the campaign to PAUSED when creating it to prevent
          // the ads from immediately serving. Set to ENABLED once you've added
          // targeting and the ads are ready to serve.
          .setStatus(CampaignStatus.PAUSED)
          // Bidding strategy must be set directly on the campaign.
          // Setting a portfolio bidding strategy by resourceName is not supported.
          // Maximize conversion value is the only strategy supported for Smart Shopping
          // campaigns.
          // An optional ROAS (Return on Advertising Spend) can be set for
          // MaximizeConversionValue.
          // The ROAS value must be specified as a ratio in the API. It is calculated by dividing
          // "total value" by "total spend".
          // For more information on maximize conversion value, see the support article:
          // http://support.google.com/google-ads/answer/7684216)
          .setMaximizeConversionValue(
              MaximizeConversionValue.newBuilder().setTargetRoas(DoubleValue.of(3.5)).build())
          // Sets the budget.
          .setCampaignBudget(StringValue.of(budgetResourceName))
          .build();

  // Creates a campaign operation.
  CampaignOperation operation = CampaignOperation.newBuilder().setCreate(campaign).build();

  // Issues a mutate request to add the campaign.
  try (CampaignServiceClient campaignServiceClient = googleAdsClient.getLatestVersion().createCampaignServiceClient()) {
    MutateCampaignResult result =
        campaignServiceClient
            .mutateCampaigns(Long.toString(customerId), Collections.singletonList(operation))
            .getResults(0);
    System.out.printf(
        "Added a Smart Shopping campaign with resource name: '%s'%n", result.getResourceName());
    return result.getResourceName();
  }
}