استراتژی پیشنهاد قیمت را اختصاص دهید یا به‌روز کنید

برای «آگهی‌های هتل»، می‌توانید استراتژی پیشنهاد قیمت را برای یک پویش تکی اختصاص دهید.

جزئیات مربوط به انتخاب استراتژی‌های پیشنهاد قیمت برای «آگهی‌های هتل» را می‌توانید در نمای کلی پیشنهاد قیمت برای «آگهی‌های هتل» پیدا کنید. پس‌از آشنایی با استراتژی‌های پیشنهاد قیمت، می‌توانید از Google Ads API برای اختصاص دادن و به‌روزرسانی استراتژی‌های پیشنهاد قیمت پویش «هتل» استفاده کنید.

اختصاص دادن راهبرد پیشنهاد قیمت

برای اختصاص دادن استراتژی به‌عنوان بخشی از ایجاد پویش جدید «هتل»، این مراحل را دنبال کنید:

  1. campaign_bidding_strategy را انتخاب کنید. از oneof استراتژی زیر در Campaign می‌توان برای «آگهی‌های هتل» استفاده کرد:

    برای فعال کردن کلیک‌بهای بهبودیافته برای پویش «هتل»، manual_cpc.enhanced_cpc_enabled یا percent_cpc.enhanced_cpc_enabled را روی true تنظیم کنید.

    استراتژی commission دیگر برای «پویش‌های هتل» دردسترس نیست. برای جزئیات، انواع استراتژی پیشنهاد قیمت را ببینید.

  2. جفت نام-مقدار فیلدی را که می‌خواهید برای استراتژی انتخاب‌شده استفاده کنید تعیین کنید.

  3. فیلد استراتژی انتخاب‌شده را در شیء Campaign هنگام ساختن پویش جدید تنظیم کنید.

این مثال نشان می‌دهد که چگونه هنگام ایجاد پویش جدید، استراتژی پیشنهاد قیمت percent_cpc را تنظیم کنید:

جاوا

// Creates the campaign.
Campaign campaign =
    Campaign.newBuilder()
        .setName("Interplanetary Cruise #" + getPrintableDateTime())
        // Configures settings related to hotel campaigns including advertising channel type
        // and hotel setting info.
        .setAdvertisingChannelType(AdvertisingChannelType.HOTEL)
        .setHotelSetting(hotelSettingInfo)
        // 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 Percent CPC. Only Manual CPC and Percent CPC can be used
        // for hotel campaigns.
        .setPercentCpc(
            PercentCpc.newBuilder().setCpcBidCeilingMicros(cpcBidCeilingMicroAmount).build())
        // Sets the budget.
        .setCampaignBudget(budgetResourceName)
        // Adds the networkSettings configured above.
        .setNetworkSettings(networkSettings)
        // Declares whether this campaign serves political ads targeting the EU.
        .setContainsEuPoliticalAdvertising(DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING)
        .build();
      

C#‎

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

    // Configure settings related to hotel campaigns including advertising channel type
    // and hotel setting info.
    AdvertisingChannelType = AdvertisingChannelType.Hotel,
    HotelSetting = new HotelSettingInfo()
    {
        HotelCenterId = hotelCenterAccountId
    },

    // 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 PercentCpc. Only Manual CPC and Percent CPC can
    // be used for hotel campaigns.
    PercentCpc = new PercentCpc()
    {
        CpcBidCeilingMicros = cpcBidCeilingMicroAmount
    },

    // Set the budget.
    CampaignBudget = budgetResourceName,

    // Configure the campaign network options. Only Google Search is allowed for
    // hotel campaigns.
    NetworkSettings = new NetworkSettings()
    {
        TargetGoogleSearch = true
    },

    // Declare whether or not this campaign contains political ads targeting the EU.
    ContainsEuPoliticalAdvertising = EuPoliticalAdvertisingStatus.DoesNotContainEuPoliticalAdvertising,
};
      

PHP

// Creates a campaign.
$campaign = new Campaign(
    [
    'name' => 'Interplanetary Cruise Campaign #' . Helper::getPrintableDatetime(),
    // Configures settings related to hotel campaigns including advertising channel type
    // and hotel setting info.
    'advertising_channel_type' => AdvertisingChannelType::HOTEL,
    'hotel_setting' => new HotelSettingInfo(['hotel_center_id' => $hotelCenterAccountId]),
    // 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 PercentCpc. Only Manual CPC and Percent CPC can be used
    // for hotel campaigns.
    'percent_cpc' => new PercentCpc(
        [
        'cpc_bid_ceiling_micros' => $cpcBidCeilingMicroAmount
        ]
    ),
    // Sets the budget.
    'campaign_budget' => $budgetResourceName,
    // Configures the campaign network options. Only Google Search is allowed for
    // hotel campaigns.
    'network_settings' => new NetworkSettings(
        [
        'target_google_search' => true,
        ]
    ),
    // Declare whether or not this campaign serves political ads targeting the EU.
    'contains_eu_political_advertising' =>
        EuPoliticalAdvertisingStatus::DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
    ]
);
      

Python

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

# Configures settings related to hotel campaigns including advertising
# channel type and hotel setting info.
campaign.advertising_channel_type = (
    client.enums.AdvertisingChannelTypeEnum.HOTEL
)
campaign.hotel_setting.hotel_center_id = hotel_center_account_id

# 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

# Set the bidding strategy to PercentCpc. Only Manual CPC and Percent CPC
# can be used for hotel campaigns.
campaign.percent_cpc.cpc_bid_ceiling_micros = cpc_bid_ceiling_micro_amount

# Sets the budget.
campaign.campaign_budget = budget_resource_name

# Set the campaign network options. Only Google Search is allowed for hotel
# campaigns.
campaign.network_settings.target_google_search = True

# Declare whether or not this campaign serves political ads targeting the
# EU. Valid values are:
#   CONTAINS_EU_POLITICAL_ADVERTISING
#   DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
campaign.contains_eu_political_advertising = (
    client.enums.EuPoliticalAdvertisingStatusEnum.DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
)
      

Ruby

# Create a campaign.
campaign_operation = client.operation.create_resource.campaign do |c|
  c.name = generate_random_name_field("Interplanetary Cruise Campaign")

  # Configure settings related to hotel campaigns.
  c.advertising_channel_type = :HOTEL
  c.hotel_setting = client.resource.hotel_setting_info do |hsi|
    hsi.hotel_center_id = hotel_center_account_id
  end

  # 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.
  c.status = :PAUSED

  # Set the bidding strategy to PercentCpc. Only Manual CPC and Percent CPC can
  # be used for hotel campaigns.
  c.percent_cpc = client.resource.percent_cpc do |pcpc|
    pcpc.cpc_bid_ceiling_micros = cpc_bid_ceiling_micro_amount
  end

  # Set the budget.
  c.campaign_budget = budget_resource

  # Configures the campaign network options. Only Google Search is allowed for
  # hotel campaigns.
  c.network_settings = client.resource.network_settings do |ns|
    ns.target_google_search = true
  end

  # Declare whether or not this campaign serves political ads targeting the EU.
  # Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and
  # DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.
  c.contains_eu_political_advertising = :DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
end
      

پرل

# Create a hotel campaign.
my $campaign = Google::Ads::GoogleAds::V26::Resources::Campaign->new({
    name => "Interplanetary Cruise Campaign #" . uniqid(),
    # Configure settings related to hotel campaigns including advertising
    # channel type and hotel setting info.
    advertisingChannelType => HOTEL,
    hotelSetting           =>
      Google::Ads::GoogleAds::V26::Resources::HotelSettingInfo->new({
        hotelCenterId => $hotel_center_account_id
      }
      ),
    # 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::V26::Enums::CampaignStatusEnum::PAUSED,
    # Set the bidding strategy to PercentCpc. Only Manual CPC and Percent CPC
    # can be used for hotel campaigns.
    percentCpc => Google::Ads::GoogleAds::V26::Common::PercentCpc->new(
      {cpcBidCeilingMicros => $cpc_bid_ceiling_micro_amount}
    ),
    # Declare whether or not this campaign serves political ads targeting the EU.
    # Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and
    # DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.
    containsEuPoliticalAdvertising =>
      DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING,
    # Set the budget.
    campaignBudget => $budget_resource_name,
    # Configure the campaign network options. Only Google Search is allowed for
    # hotel campaigns.
    networkSettings =>
      Google::Ads::GoogleAds::V26::Resources::NetworkSettings->new({
        targetGoogleSearch => "true"
      })});
      

curl

به‌روزرسانی استراتژی پیشنهاد قیمت

برای به‌روز کردن استراتژی پیشنهاد قیمت پویش، CampaignOperation.update را با Campaign نمونه‌ای که حاوی فیلد استراتژی به‌روزشده است (همان‌طور که در تخصیص استراتژی پیشنهاد قیمت توضیح داده شده است) و update_mask که شامل مسیر فیلد استراتژی‌ای است که تنظیم کرده‌اید (برای نمونه، percent_cpc یا target_roas) بسازید. ازآنجایی‌که فیلدهای استراتژی متعلق به oneof واحدی هستند، تنظیم یکی از آن‌ها استراتژی‌ای را که قبلاً تنظیم شده است پاک می‌کند، بنابراین وقتی از یک نوع استراتژی به نوع دیگر تغییر می‌دهید، همین عملکرد کار می‌کند. برای راهنمایی درباره ساختن ماسک‌های به‌روزرسانی، به ابزارهای کمکی ماسک فیلد در کتابخانه کارخواه خود مراجعه کنید.