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

Creating a Shopping Campaign

The first step in implementing Shopping Ads is to create a Shopping campaign. Shopping campaigns allow users to see Ads that show an image of the product including title, price, store name and more. When creating a Shopping campaign, you will need to set its budget, bidding strategy and the shopping settings.

Before you can create a Shopping campaign, you need to link your Google Ads account to your Google Merchant Center account. Consult the article on linking your accounts for more information. Once you have linked accounts, you can use the Google Merchant Center account ID when specifying the shopping settings.

There are two types of Shopping campaign that can be created using the Google Ads API:

Different campaign settings are required to support these types of campaign, which are covered below.

Standard Shopping campaigns

This is the campaign required to create Product Shopping ads. Product Shopping ads allow you to include an image, title, price, and your store or business name inside your ads, without the need for you to create unique ads for each product you sell.

Here are the steps for setting up a standard Shopping campaign:

  1. Set the campaign's advertising_channel_type to SHOPPING.
  2. Create a ShoppingSetting, set the fields and then add it to the campaign.
  3. Create a portfolio bid strategy or set a campaign level bid strategy.
  4. Create a new campaign budget or set an existing shared budget.

For standard Shopping campaigns, ShoppingSetting supports the following fields:

Required

  • merchant_id - The Merchant Center ID of the account that contains the products to advertise.
  • sales_country - The target sales country of the products to include in this campaign.
  • campaign_priority - The priority of the shopping campaign. Campaigns with numerically higher priorities take precedence over those with lower priorities. Allowed values are between 0 and 2, inclusive.

Optional

  • enable_local - The option to enable ads for products sold in local stores for this campaign.

A bid strategy can be set up as a:

For standard Shopping campaigns, the following bid strategies are supported:

Portfolio bid strategy

Campaign bid strategy

This code example demonstrates how to create a standard Shopping campaign.

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 campaigns

This is the campaign required to configure Smart Shopping ads. A Smart Shopping campaign combines standard Shopping and display remarketing campaigns, and uses automated bidding and ad placement to promote your products and business across networks.

Here are the steps in setting up a Smart Shopping campaign:

  1. Setting the campaign's advertising_channel_type to SHOPPING.
  2. Setting the campaign's advertising_channel_sub_type to SHOPPING_SMART_ADS.
  3. Create a ShoppingSettingInfo, setting the merchant_id and sales_country then adding it to the campaign.
  4. Set a campaign level bid strategy.
  5. Create a new campaign budget (only non-shared budgets).

For Smart Shopping campaigns, ShoppingSetting supports the following fields:

Required

  • merchant_id - The Merchant Center ID of the account that contains the products to advertise.
  • sales_country - The target sales country of the products to include in this campaign.

Optional

  • campaign_priority - The priority of the shopping campaign. Campaigns with numerically higher priorities take precedence over those with lower priorities. This field is optional for Smart Shopping campaigns, but must be equal to 3 if set.

  • enable_local - The option to enable ads for products sold in local stores for this campaign.

A bid strategy can be set up as a:

  • Campaign bid strategy - A bid strategy set directly on the campaign. This can include automated bidding strategies compatible with Smart Shopping campaigns.

For Smart Shopping campaigns, the following bid strategy is supported:

Campaign bid strategy

A ROAS target can be optionally set for maximize_conversion_value. This can be set using the target_roas field on MaximizeConversionValue. For more information on maximize conversion value, see the support article: About maximize conversion value bidding.

These steps are demonstrated in the following code:

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();
  }
}

Оставить отзыв о...

Текущей странице
Google Ads API Beta
Google Ads API Beta
Нужна помощь? Обратитесь в службу поддержки.