Tạo chiến dịch Mua sắm

Bước đầu tiên trong việc triển khai quảng cáo Mua sắm là tạo chiến dịch Mua sắm. Chiến dịch Mua sắm cho phép người dùng thấy quảng cáo hiển thị hình ảnh của sản phẩm, bao gồm tiêu đề, giá, tên cửa hàng và các thông tin khác. Khi tạo chiến dịch Mua sắm, bạn cần đặt ngân sách, chiến lược đặt giá thầu và chế độ cài đặt mua sắm cho chiến dịch đó.

Để có thể tạo chiến dịch Mua sắm, bạn cần liên kết tài khoản Google Ads với tài khoản Google Merchant Center. Sau khi liên kết các tài khoản, bạn có thể sử dụng mã tài khoản Google Merchant Center khi chỉ định chế độ cài đặt mua sắm.

Chiến dịch Mua sắm thông thường

Đây là chiến dịch bắt buộc để tạo Quảng cáo mua sắm sản phẩm. Quảng cáo mua sắm sản phẩm cho phép bạn đưa hình ảnh, tiêu đề, giá và tên cửa hàng hoặc tên doanh nghiệp của mình vào quảng cáo mà không cần tạo quảng cáo riêng cho mỗi sản phẩm bạn bán.

Dưới đây là các bước để thiết lập một chiến dịch Mua sắm thông thường:

  1. Đặt advertising_channel_type của chiến dịch thành SHOPPING.
  2. Tạo một ShoppingSetting, đặt các trường rồi thêm vào chiến dịch.
  3. Tạo chiến lược giá thầu danh mục đầu tư hoặc đặt chiến lược giá thầu cấp chiến dịch.
  4. Tạo ngân sách chiến dịch mới hoặc đặt ngân sách dùng chung hiện tại.

Đối với các chiến dịch Mua sắm thông thường, ShoppingSetting hỗ trợ các trường sau:

Bắt buộc

merchant_id
Mã truy cập Merchant Center của tài khoản chứa sản phẩm cần quảng cáo.
campaign_priority
Mức độ ưu tiên của chiến dịch Mua sắm. Các chiến dịch có mức độ ưu tiên cao hơn về mặt số lượng sẽ được ưu tiên hơn các chiến dịch có mức độ ưu tiên thấp hơn. Các giá trị được phép nằm trong khoảng từ 0 đến 2.

Không bắt buộc

feed_label

Một chuỗi dùng cho nhãn nguồn cấp dữ liệu như được xác định trong Merchant Center. Bạn nên sử dụng trường này trong trường hợp cần chọn sản phẩm từ một nguồn cấp dữ liệu Merchant Center cụ thể. Nếu bạn không chỉ định, chiến dịch sẽ sử dụng tất cả các nguồn cấp dữ liệu có sẵn trong Merchant Center.

Nếu trước đây bạn đã sử dụng sales_country không dùng nữa ở định dạng mã quốc gia gồm hai chữ cái (XX), thì bạn nên sử dụng feed_label. Để biết thêm thông tin, hãy xem bài viết hỗ trợ về nhãn nguồn cấp dữ liệu.

Xin lưu ý rằng việc gửi mã quốc gia trong feed_label sẽ không tự động cho phép quảng cáo phân phát ở quốc gia đó; trước tiên, bạn phải thiết lập tính năng nhắm mục tiêu theo vị trí địa lý.

enable_local

Lựa chọn bật quảng cáo cho các sản phẩm được bán tại cửa hàng địa phương cho chiến dịch này.

Chiến lược giá thầu có thể được thiết lập như sau:

Chiến lược giá thầu danh mục đầu tư
Chiến lược đặt giá thầu tự động có thể dùng chung cho các chiến dịch, nhóm quảng cáo và từ khoá. Được tạo bằng BiddingStrategyService.
Chiến lược giá thầu cấp chiến dịch
Chiến lược giá thầu được thiết lập trực tiếp cho chiến dịch. Điều này có thể bao gồm chiến lược đặt giá thầu tự động tương thích với chiến dịch Mua sắm.

Đối với chiến dịch Mua sắm thông thường, các chiến lược giá thầu sau được hỗ trợ:

Chiến lược giá thầu danh mục đầu tư

Chiến lược giá thầu cấp chiến dịch

Cài đặt mạng

Kể từ tuần bắt đầu từ ngày 28 tháng 2 năm 2022, chiến dịch Mua sắm thông thường không còn hỗ trợ trường network_settings.target_content_network nữa.

Việc đặt trường này thành true cho một chiến dịch Mua sắm thông thường trong một yêu cầu thay đổi sẽ tạo ra lỗi CANNOT_TARGET_CONTENT_NETWORK.

Để biết thêm thông tin chi tiết, hãy xem bài viết Các thay đổi trong chế độ cài đặt mạng cho Chiến dịch mua sắm thông thường của Google Ads.

Ví dụ về mã này minh hoạ cách tạo một chiến dịch Mua sắm thông thường.

Java

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

  // Configures the shopping settings.
  ShoppingSetting shoppingSetting =
      ShoppingSetting.newBuilder()
          // 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(0)
          .setMerchantId(merchantCenterAccountId)
          // Enables local inventory ads for this campaign.
          .setEnableLocal(true)
          .build();

  // Create the standard shopping campaign.
  Campaign campaign =
      Campaign.newBuilder()
          .setName("Interplanetary Cruise #" + getPrintableDateTime())
          // 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 disabled). eCPC for standard
          // Shopping campaigns is deprecated. If eCPC is set to true, Google Ads ignores the
          // setting and behaves as if the setting was false. See this blog post for more
          // information:
          // https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
          // 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(false).build())
          // Sets the budget.
          .setCampaignBudget(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();
  }
}

      

C#

private string AddStandardShoppingCampaign(GoogleAdsClient client, long customerId,
    string budgetResourceName, long merchantCenterAccountId)
{
    // Get the CampaignService.
    CampaignServiceClient campaignService =
        client.GetService(Services.V16.CampaignService);

    // Configures the shopping settings.
    ShoppingSetting shoppingSetting = new ShoppingSetting()
    {
        // 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.
        CampaignPriority = 0,

        MerchantId = merchantCenterAccountId,

        // Enables local inventory ads for this campaign.
        EnableLocal = true
    };

    // Create the standard shopping campaign.
    Campaign campaign = new Campaign()
    {
        Name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString(),

        // Configures settings related to shopping campaigns including advertising channel
        // type and shopping setting.
        AdvertisingChannelType = AdvertisingChannelType.Shopping,

        ShoppingSetting = shoppingSetting,

        // Recommendation: Set 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
        Status = CampaignStatus.Paused,

        // Sets the bidding strategy to Manual CPC (with eCPC disabled). eCPC for standard
        // Shopping campaigns is deprecated. If eCPC is set to true, Google Ads ignores the
        // setting and behaves as if the setting was false. See this blog post for more
        // information:
        // https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
        // 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
        ManualCpc = new ManualCpc()
        {
            EnhancedCpcEnabled = false
        },

        // Sets the budget.
        CampaignBudget = budgetResourceName
    };

    // Creates a campaign operation.
    CampaignOperation operation = new CampaignOperation()
    {
        Create = campaign
    };

    // Issues a mutate request to add the campaign.
    MutateCampaignsResponse response =
        campaignService.MutateCampaigns(customerId.ToString(),
            new CampaignOperation[] { operation });
    MutateCampaignResult result = response.Results[0];
    Console.WriteLine("Added a standard shopping campaign with resource name: '{0}'.",
        result.ResourceName);
    return result.ResourceName;
}
      

1.199

private static function addStandardShoppingCampaign(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    string $budgetResourceName,
    int $merchantCenterAccountId
) {
    // Creates a standard shopping campaign.
    $campaign = new Campaign([
        'name' => 'Interplanetary Cruise Campaign #' . Helper::getPrintableDatetime(),
        // Configures settings related to shopping campaigns including advertising channel type
        // and shopping setting.
        'advertising_channel_type' => AdvertisingChannelType::SHOPPING,
        // Configures the shopping settings.
        'shopping_setting' => new ShoppingSetting([
            // 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.
            'campaign_priority' => 0,
            'merchant_id' => $merchantCenterAccountId,
            // Enables local inventory ads for this campaign
            'enable_local' => true
        ]),
        // Recommendation: Set 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.
        'status' => CampaignStatus::PAUSED,
        // Sets the bidding strategy to Manual CPC (with eCPC disabled). eCPC for standard
        // Shopping campaigns is deprecated. If eCPC is set to true, Google Ads ignores the
        // setting and behaves as if the setting was false. See this blog post for more
        // information:
        // https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
        // 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.
        'manual_cpc' => new ManualCpc(['enhanced_cpc_enabled' => false]),
        // Sets the budget.
        'campaign_budget' => $budgetResourceName
    ]);

    // Creates a campaign operation.
    $campaignOperation = new CampaignOperation();
    $campaignOperation->setCreate($campaign);

    // Issues a mutate request to add campaigns.
    $campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
    $response = $campaignServiceClient->mutateCampaigns(
        MutateCampaignsRequest::build($customerId, [$campaignOperation])
    );

    /** @var Campaign $addedCampaign */
    $addedCampaign = $response->getResults()[0];
    printf(
        "Added a standard shopping campaign with resource name '%s'.%s",
        $addedCampaign->getResourceName(),
        PHP_EOL
    );

    return $addedCampaign->getResourceName();
}
      

Python

def add_standard_shopping_campaign(
    client, customer_id, budget_resource_name, merchant_center_account_id
):
    """Creates a new standard shopping campaign in the specified client account."""
    campaign_service = client.get_service("CampaignService")

    # Create standard shopping campaign.
    campaign_operation = client.get_type("CampaignOperation")
    campaign = campaign_operation.create
    campaign.name = f"Interplanetary Cruise Campaign {uuid.uuid4()}"

    # Configures settings related to shopping campaigns including advertising
    # channel type and shopping setting.
    campaign.advertising_channel_type = (
        client.enums.AdvertisingChannelTypeEnum.SHOPPING
    )
    campaign.shopping_setting.merchant_id = merchant_center_account_id

    # Sets the priority of the campaign. Higher numbers take priority over lower
    # numbers. For standard shopping campaigns, allowed values are between 0 and
    # 2, inclusive.
    campaign.shopping_setting.campaign_priority = 0

    # Enables local inventory ads for this campaign.
    campaign.shopping_setting.enable_local = True

    # Recommendation: Set 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.
    campaign.status = client.enums.CampaignStatusEnum.PAUSED

    # Sets the bidding strategy to Manual CPC (with eCPC disabled). eCPC for
    # standard Shopping campaigns is deprecated. If eCPC is set to true, Google
    # Ads ignores the setting and behaves as if the setting was false. See this
    # blog post for more information:
    # https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
    # 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
    campaign.manual_cpc.enhanced_cpc_enabled = False

    # Sets the budget.
    campaign.campaign_budget = budget_resource_name

    # Add the campaign.
    campaign_response = campaign_service.mutate_campaigns(
        customer_id=customer_id, operations=[campaign_operation]
    )

    campaign_resource_name = campaign_response.results[0].resource_name

    print(
        "Added a standard shopping campaign with resource name "
        f"'{campaign_resource_name}'."
    )

    return campaign_resource_name
      

Ruby

def add_standard_shopping_campaign(
    client, customer_id, budget_name, merchant_center_id)

  operation = client.operation.create_resource.campaign do |campaign|
    campaign.name = "Interplanetary Cruise Campaign ##{(Time.new.to_f * 1000).to_i}"

    # Shopping campaign specific settings
    campaign.advertising_channel_type = :SHOPPING

    campaign.shopping_setting = client.resource.shopping_setting do |shopping_setting|
      shopping_setting.merchant_id = merchant_center_id
      shopping_setting.campaign_priority = 0
      shopping_setting.enable_local = true
    end

    campaign.status = :PAUSED

    # Sets the bidding strategy to Manual CPC (with eCPC disabled). eCPC for standard
    # Shopping campaigns is deprecated. If eCPC is set to true, Google Ads ignores the
    # setting and behaves as if the setting was false. See this blog post for more
    # information:
    # https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
    campaign.manual_cpc = client.resource.manual_cpc do |manual_cpc|
      manual_cpc.enhanced_cpc_enabled = false
    end

    campaign.campaign_budget = budget_name
  end

  service = client.service.campaign
  response = service.mutate_campaigns(
    customer_id: customer_id,
    operations: [operation],
  )

  campaign_name = response.results.first.resource_name

  puts "Added a standard shopping campaign with resource name #{campaign_name}."

  campaign_name
end
      

Perl

sub add_standard_shopping_campaign {
  my ($api_client, $customer_id, $budget_resource_name,
    $merchant_center_account_id)
    = @_;

  # Create a standard shopping campaign.
  my $campaign = Google::Ads::GoogleAds::V16::Resources::Campaign->new({
      name => "Interplanetary Cruise Campaign #" . uniqid(),
      # Configure settings related to shopping campaigns including advertising
      # channel type and shopping setting.
      advertisingChannelType => SHOPPING,
      shoppingSetting        =>
        Google::Ads::GoogleAds::V16::Resources::ShoppingSetting->new({
          merchantId => $merchant_center_account_id,
          # Set the priority of the campaign. Higher numbers take priority over
          # lower numbers. For standard shopping campaigns, allowed values are
          # between 0 and 2, inclusive.
          campaignPriority => 0,
          # Enable local inventory ads for this campaign.
          enableLocal => "true"
        }
        ),
      # Recommendation: Set 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.
      status => Google::Ads::GoogleAds::V16::Enums::CampaignStatusEnum::PAUSED,
      # Set the bidding strategy to Manual CPC (with eCPC disabled). eCPC for
      # standard Shopping campaigns is deprecated. If eCPC is set to true,
      # Google Ads ignores the setting and behaves as if the setting was false.
      # See this blog post for more information:
      # https://ads-developers.googleblog.com/2023/09/google-ads-shopping-campaign-enhanced.html
      # 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.
      manualCpc => Google::Ads::GoogleAds::V16::Common::ManualCpc->new(
        {enhancedCpcEnabled => "false"}
      ),
      # Set the budget.
      campaignBudget => $budget_resource_name
    });

  # Create a campaign operation.
  my $campaign_operation =
    Google::Ads::GoogleAds::V16::Services::CampaignService::CampaignOperation->
    new({create => $campaign});

  # Add the campaign.
  my $campaign_resource_name = $api_client->CampaignService()->mutate({
      customerId => $customer_id,
      operations => [$campaign_operation]})->{results}[0]{resourceName};

  printf "Added a standard shopping campaign with resource name: '%s'.\n",
    $campaign_resource_name;

  return $campaign_resource_name;
}
      

Chiến dịch Mua sắm thông minh