Page Summary
-
The Google Ads API allows you to set bid adjustments for Hotel ads at both the campaign and ad group levels.
-
Setting bid adjustments at the ad group level requires creating specific objects like
HotelAdvanceBookingWindowInfoorHotelDateSelectionTypeInfoand associating them with anAdGroupBidModifierobject. -
The examples provided demonstrate how to create ad group bid modifiers based on hotel check-in day and length of stay using various programming languages.
You can use the Google Ads API to set bid adjustments (also called bid modifiers) for hotel ads. For details about how bid adjustments work, see About bid adjustments for Hotel ads.
Campaign-level bid adjustments
To use the Google Ads API to set bid adjustments at the campaign level, see Manage bid modifiers.
Ad group-level bid adjustments
Starting in v26, the five hotel-specific criteria on
AdGroupBidModifier are renamed to vertical-agnostic
names (such as start day of week and length of booking), replacing the
hotel-specific criteria from earlier versions. These bid adjustments remain
supported only for hotel ads—both in Hotel campaigns and in Search Campaigns
for Travel. Existing bid modifiers created in v25 or earlier carry over
automatically with identical criterion IDs and resource names. For a summary of
all v26 breaking changes, see the release notes.
To set bid adjustments at the ad group level, create a criterion object for the
dimension you want to target and set its fields to the appropriate values. In
v26 and later, use the vertical-agnostic criterion objects:
AdvanceBookingWindowInfo,
UserSetDatesInfo,
StartDayOfWeekInfo,
LengthOfBookingInfo, or
StartDateRangeInfo. In v25 and earlier, use the
hotel-specific criterion objects:
HotelAdvanceBookingWindowInfo,
HotelDateSelectionTypeInfo,
HotelCheckInDayInfo,
HotelLengthOfStayInfo, or
HotelCheckInDateRangeInfo.
The following table summarizes the AdGroupBidModifier criterion fields,
message types, subfields, and valid bid_modifier ranges across API versions:
| v25 and earlier | v26 and later | Subfields and types | Description and valid range |
|---|---|---|---|
hotel_date_selection_type (HotelDateSelectionTypeInfo) |
user_set_dates (UserSetDatesInfo) |
type: DateSelectionType in v26 (HotelDateSelectionType in v25). Values: DEFAULT_SELECTION (criterion ID 50), USER_SELECTED (criterion ID 51). IMMUTABLE. |
Default dates versus user-selected dates. Valid bid_modifier range: 0.5 to 2.0 (does not support 0 opt-out). |
hotel_advance_booking_window (HotelAdvanceBookingWindowInfo) |
advance_booking_window (AdvanceBookingWindowInfo) |
min_days, max_days (int64, 0–330). IMMUTABLE, required. |
Number of days before the start date of the booking. Valid bid_modifier range: 0.1 to 10.0, or 0 to opt out. |
hotel_length_of_stay (HotelLengthOfStayInfo) |
length_of_booking (LengthOfBookingInfo) |
min_days, max_days in v26 (min_nights, max_nights in v25) (int64, 1–30). IMMUTABLE, required. |
Length of the booking. Valid bid_modifier range: 0.1 to 10.0, or 0 to opt out. |
hotel_check_in_day (HotelCheckInDayInfo) |
start_day_of_week (StartDayOfWeekInfo) |
day_of_week (DayOfWeek, criterion IDs 60–66 for MONDAY–SUNDAY). IMMUTABLE. |
Day of the week of the booking start date. Valid bid_modifier range: 0.1 to 10.0, or 0 to opt out. |
hotel_check_in_date_range (HotelCheckInDateRangeInfo) |
start_date_range (StartDateRangeInfo) |
start_date, end_date (string, YYYY-MM-DD). IMMUTABLE, required. |
Date range of the booking start date. Valid bid_modifier range: 0.1 to 10.0, or 0 to opt out. |
For example, to create an ad group bid modifier using an advance booking window
between 30 and 60 days in v26 and later, create an
AdvanceBookingWindowInfo object (or
HotelAdvanceBookingWindowInfo in v25 and
earlier) and set min_days to 30 and max_days to 60.
Associate the criterion object with an
AdGroupBidModifier object using the corresponding
criterion field (advance_booking_window, user_set_dates,
start_day_of_week, length_of_booking, or start_date_range), specify the
resource name of the target ad group using ad_group, and set the
bid_modifier field to a multiplier:
advance_booking_window,length_of_booking,start_day_of_week,start_date_range, anddevice: Specify a multiplier from0.1to10.0(for example,1.5for a +50% adjustment, or0.5for a -50% adjustment), or setbid_modifierto0(0.0) to opt out (-100%) of the criterion.user_set_dates: Specify a multiplier from0.5to2.0. Settingbid_modifierto0is not supported foruser_set_datesand returnsRangeError.TOO_LOW.
For more details about how each adjustment type works, see About bid adjustments for Hotel ads.
The following reporting segment and resource limit details also apply in v26:
segments.user_set_dates: In v26 and later, the enum type ofsegments.user_set_datesisDateSelectionType(updated fromHotelDateSelectionTypein v25 and earlier; Hotel campaign reports usingsegments.hotel_date_selection_typecontinue to useHotelDateSelectionType). The other itinerary segments (segments.advance_booking_window,segments.length_of_booking,segments.start_date, andsegments.start_day_of_week) are unchanged.- Resource limits:
ResourceLimitType.HOTEL_ADVANCE_BOOKING_WINDOW_BID_MODIFIERS_PER_AD_GROUPandResourceLimitType.HOTEL_CHECK_IN_DATE_RANGE_BID_MODIFIERS_PER_AD_GROUPretain their existing names in v26.
Java
private void runExample(GoogleAdsClient googleAdsClient, long customerId, long adGroupId) { List<AdGroupBidModifierOperation> operations = new ArrayList<>(); // Constructs the ad group resource name to use for each bid modifier. String adGroupResourceName = ResourceNames.adGroup(customerId, adGroupId); // 1) Creates an ad group bid modifier based on the hotel check-in day. AdGroupBidModifier checkInDayAdGroupBidModifier = AdGroupBidModifier.newBuilder() // Sets the resource name to the ad group resource name joined with the criterion ID // whose value corresponds to the desired check-in day. .setAdGroup(adGroupResourceName) .setStartDayOfWeek(StartDayOfWeekInfo.newBuilder().setDayOfWeek(DayOfWeek.MONDAY)) // Sets the bid modifier value to 150%. .setBidModifier(1.5d) .build(); operations.add( AdGroupBidModifierOperation.newBuilder().setCreate(checkInDayAdGroupBidModifier).build()); // 2) Creates an ad group bid modifier based on the hotel length of stay. AdGroupBidModifier lengthOfStayAdGroupBidModifier = AdGroupBidModifier.newBuilder() // Sets the ad group. .setAdGroup(adGroupResourceName) // Creates the length of booking info. .setLengthOfBooking( LengthOfBookingInfo.newBuilder().setMinDays(3L).setMaxDays(7L).build()) // Sets the bid modifier value to 170%. .setBidModifier(1.7d) .build(); operations.add( AdGroupBidModifierOperation.newBuilder().setCreate(lengthOfStayAdGroupBidModifier).build()); // Issues a mutate request to add the ad group bid modifiers. try (AdGroupBidModifierServiceClient adGroupBidModifierServiceClient = googleAdsClient.getLatestVersion().createAdGroupBidModifierServiceClient()) { MutateAdGroupBidModifiersResponse response = adGroupBidModifierServiceClient.mutateAdGroupBidModifiers( Long.toString(customerId), operations); // Prints the resource names of the added ad group bid modifiers. System.out.printf("Added %d hotel ad group bid modifiers:%n", response.getResultsCount()); for (MutateAdGroupBidModifierResult mutateAdGroupBidModifierResult : response.getResultsList()) { System.out.printf(" %s%n", mutateAdGroupBidModifierResult.getResourceName()); } } }
C#
public void Run(GoogleAdsClient client, long customerId, long adGroupId) { // Get the AdGroupBidModifierService. AdGroupBidModifierServiceClient service = client.GetService( Services.V26.AdGroupBidModifierService); // Constructs the ad group resource name to use for each bid modifier. string adGroupResourceName = ResourceNames.AdGroup(customerId, adGroupId); // 1) Create an ad group bid modifier based on the hotel check-in day. AdGroupBidModifier checkInDayAdGroupBidModifier = new AdGroupBidModifier() { // Sets the resource name to the ad group resource name joined with the criterion // ID whose value corresponds to the desired check-in day. AdGroup = adGroupResourceName, StartDayOfWeek = new StartDayOfWeekInfo() { DayOfWeek = DayOfWeek.Monday }, // Set the bid modifier value to 150%. BidModifier = 1.5, }; // Creates an ad group bid modifier operation. var checkInDayAdGroupBidModifierOperation = new AdGroupBidModifierOperation() { Create = checkInDayAdGroupBidModifier }; // 2) Create an ad group bid modifier based on the hotel length of stay. AdGroupBidModifier lengthOfStayAdGroupBidModifier = new AdGroupBidModifier() { // Set the ad group. AdGroup = ResourceNames.AdGroup(customerId, adGroupId), // Set the length of booking info. LengthOfBooking = new LengthOfBookingInfo() { MinDays = 3, MaxDays = 7 }, // Set the bid modifier value to 170%. BidModifier = 1.7 }; // Create an ad group bid modifier operation. var lengthOfStayAdGroupBidModifierOperation = new AdGroupBidModifierOperation() { Create = lengthOfStayAdGroupBidModifier }; try { // Issue a mutate request to add an ad group bid modifiers. MutateAdGroupBidModifiersResponse response = service.MutateAdGroupBidModifiers( customerId.ToString(), new AdGroupBidModifierOperation[] { checkInDayAdGroupBidModifierOperation, lengthOfStayAdGroupBidModifierOperation } ); // Display the resource names of the added ad group bid modifiers. Console.WriteLine($"Added {response.Results.Count} hotel ad group bid modifiers:"); foreach (MutateAdGroupBidModifierResult result in response.Results) { Console.WriteLine($"- {result.ResourceName}"); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
public static function runExample( GoogleAdsClient $googleAdsClient, int $customerId, int $adGroupId ) { $operations = []; // 1) Creates an ad group bid modifier based on the hotel check-in day. $checkInDayAdGroupBidModifier = new AdGroupBidModifier( [ // Sets the ad group. 'ad_group' => ResourceNames::forAdGroup($customerId, $adGroupId), 'hotel_check_in_day' => new HotelCheckInDayInfo( [ 'day_of_week' => DayOfWeek::MONDAY ] ), // Sets the bid modifier value to 150%. 'bid_modifier' => 1.5 ] ); // Creates an ad group bid modifier operation. $checkInDayAdGroupBidModifierOperation = new AdGroupBidModifierOperation(); $checkInDayAdGroupBidModifierOperation->setCreate($checkInDayAdGroupBidModifier); $operations[] = $checkInDayAdGroupBidModifierOperation; // 2) Creates an ad group bid modifier based on the hotel length of stay. $lengthOfStayAdGroupBidModifier = new AdGroupBidModifier( [ // Sets the ad group. 'ad_group' => ResourceNames::forAdGroup($customerId, $adGroupId), // Creates the hotel length of stay info. 'hotel_length_of_stay' => new HotelLengthOfStayInfo( [ 'min_nights' => 3, 'max_nights' => 7, ] ), // Sets the bid modifier value to 170%. 'bid_modifier' => 1.7 ] ); // Creates an ad group bid modifier operation. $lengthOfStayAdGroupBidModifierOperation = new AdGroupBidModifierOperation(); $lengthOfStayAdGroupBidModifierOperation->setCreate( $lengthOfStayAdGroupBidModifier ); $operations[] = $lengthOfStayAdGroupBidModifierOperation; // Issues a mutate request to add an ad group bid modifiers. $adGroupBidModifierServiceClient = $googleAdsClient->getAdGroupBidModifierServiceClient(); $response = $adGroupBidModifierServiceClient->mutateAdGroupBidModifiers( MutateAdGroupBidModifiersRequest::build($customerId, $operations) ); // Print out resource names of the added ad group bid modifiers. printf( "Added %d hotel ad group bid modifiers:%s", $response->getResults()->count(), PHP_EOL ); foreach ($response->getResults() as $addedAdGroupBidModifier) { /** * @var AdGroupBidModifier $addedAdGroupBidModifier */ print $addedAdGroupBidModifier->getResourceName() . PHP_EOL; } }
Python
def main(client: GoogleAdsClient, customer_id: str, ad_group_id: str) -> None: ad_group_service: AdGroupServiceClient = client.get_service( "AdGroupService" ) ag_bm_service: AdGroupBidModifierServiceClient = client.get_service( "AdGroupBidModifierService" ) # Create ad group bid modifier based on hotel check-in day. check_in_ag_bm_operation: AdGroupBidModifierOperation = client.get_type( "AdGroupBidModifierOperation" ) check_in_ag_bid_modifier: AdGroupBidModifier = ( check_in_ag_bm_operation.create ) check_in_ag_bid_modifier.hotel_check_in_day.day_of_week = ( client.enums.DayOfWeekEnum.MONDAY ) check_in_ag_bid_modifier.ad_group = ad_group_service.ad_group_path( customer_id, ad_group_id ) # Sets the bid modifier value to 150%. check_in_ag_bid_modifier.bid_modifier = 1.5 # Create ad group bid modifier based on hotel length of stay info. los_ag_bm_operation: AdGroupBidModifierOperation = client.get_type( "AdGroupBidModifierOperation" ) los_ag_bid_modifier: AdGroupBidModifier = los_ag_bm_operation.create los_ag_bid_modifier.ad_group = ad_group_service.ad_group_path( customer_id, ad_group_id ) # Creates the hotel length of stay info. hotel_length_of_stay_info: HotelLengthOfStayInfo = ( los_ag_bid_modifier.hotel_length_of_stay ) hotel_length_of_stay_info.min_nights = 3 hotel_length_of_stay_info.max_nights = 7 # Sets the bid modifier value to 170%. los_ag_bid_modifier.bid_modifier = 1.7 # Add the bid modifiers ag_bm_response: MutateAdGroupBidModifiersResponse = ( ag_bm_service.mutate_ad_group_bid_modifiers( customer_id=customer_id, operations=[check_in_ag_bm_operation, los_ag_bm_operation], ) ) # Print out resource names of the added ad group bid modifiers. print(f"Added {len(ag_bm_response.results)} hotel ad group bid modifiers:") result: MutateAdGroupBidModifierResult for result in ag_bm_response.results: print(result.resource_name)
Ruby
def add_hotel_ad_group_bid_modifiers(customer_id, ad_group_id) # GoogleAdsClient will read a config file from # ENV['HOME']/google_ads_config.rb when called without parameters client = Google::Ads::GoogleAds::GoogleAdsClient.new operations = [] ad_group_resource = client.path.ad_group(customer_id, ad_group_id) # 1) Creates an ad group bid modifier based on the check-in day. operations << client.operation.create_resource.ad_group_bid_modifier do |bm| # Sets the ad group. bm.ad_group = ad_group_resource # Sets the check-in day to Monday. bm.start_day_of_week = client.resource.start_day_of_week_info do |info| info.day_of_week = :MONDAY end # Sets the bid modifier value to 150%. bm.bid_modifier = 1.5 end # 2) Creates an ad group bid modifier based on the length of booking. operations << client.operation.create_resource.ad_group_bid_modifier do |bm| # Sets the ad group. bm.ad_group = ad_group_resource # Creates the length of booking info. bm.length_of_booking = client.resource.length_of_booking_info do |info| info.min_days = 3 info.max_days = 7 end # Sets the bid modifier value to 170%. bm.bid_modifier = 1.7 end # 3) Issues a mutate request to add an ad group bid modifiers. ad_group_bid_modifier_service = client.service.ad_group_bid_modifier response = ad_group_bid_modifier_service.mutate_ad_group_bid_modifiers( customer_id: customer_id, operations: operations, ) # Print out resource names of the added ad group bid modifiers. puts "Added #{response.results.size} hotel ad group bid modifiers:" response.results.each do |added_ad_group_bid_modifier| puts "\t#{added_ad_group_bid_modifier.resource_name}" end end
Perl
sub add_hotel_ad_group_bid_modifiers { my ($api_client, $customer_id, $ad_group_id) = @_; # 1) Create an ad group bid modifier based on the hotel check-in day. my $check_in_day_ad_group_bid_modifier = Google::Ads::GoogleAds::V26::Resources::AdGroupBidModifier->new({ # Set the ad group. adGroup => Google::Ads::GoogleAds::V26::Utils::ResourceNames::ad_group( $customer_id, $ad_group_id ), hotelCheckInDay => Google::Ads::GoogleAds::V26::Common::HotelCheckInDayInfo->new({ dayOfWeek => MONDAY } ), # Set the bid modifier value to 150%. bidModifier => 1.5 }); # Create an ad group bid modifier operation. my $check_in_day_ad_group_bid_modifier_operation = Google::Ads::GoogleAds::V26::Services::AdGroupBidModifierService::AdGroupBidModifierOperation ->new({ create => $check_in_day_ad_group_bid_modifier }); # 2) Create an ad group bid modifier based on the hotel length of stay. my $length_of_stay_ad_group_bid_modifier = Google::Ads::GoogleAds::V26::Resources::AdGroupBidModifier->new({ # Set the ad group. adGroup => Google::Ads::GoogleAds::V26::Utils::ResourceNames::ad_group( $customer_id, $ad_group_id ), # Create the hotel length of stay info. hotelLengthOfStay => Google::Ads::GoogleAds::V26::Common::HotelLengthOfStayInfo->new({ minNights => 3, maxNights => 7 } ), # Set the bid modifier value to 170%. bidModifier => 1.7 }); # Create an ad group bid modifier operation. my $length_of_stay_ad_group_bid_modifier_operation = Google::Ads::GoogleAds::V26::Services::AdGroupBidModifierService::AdGroupBidModifierOperation ->new({ create => $length_of_stay_ad_group_bid_modifier }); # 3) Add the ad group bid modifiers. my $ad_group_bid_modifiers_response = $api_client->AdGroupBidModifierService()->mutate({ customerId => $customer_id, operations => [ $check_in_day_ad_group_bid_modifier_operation, $length_of_stay_ad_group_bid_modifier_operation ]}); # Print out resource names of the added ad group bid modifiers. my $ad_group_bid_modifier_results = $ad_group_bid_modifiers_response->{results}; printf "Added %d hotel ad group bid modifiers:\n", scalar @$ad_group_bid_modifier_results; foreach my $ad_group_bid_modifier_result (@$ad_group_bid_modifier_results) { printf "\t%s\n", $ad_group_bid_modifier_result->{resourceName}; } return 1; }
curl
Examples
The following examples show how to query, create, update, and remove ad group bid modifiers using GAQL and REST JSON payloads.
Reading bid modifiers with GAQL
The following queries illustrate retrieving length of booking bid modifiers in v25 and earlier compared to v26 and later:
v25 and earlier:
SELECT
ad_group_bid_modifier.resource_name,
ad_group_bid_modifier.bid_modifier,
ad_group_bid_modifier.hotel_length_of_stay.min_nights,
ad_group_bid_modifier.hotel_length_of_stay.max_nights
FROM ad_group_bid_modifier
WHERE ad_group_bid_modifier.hotel_length_of_stay.min_nights = 5
v26 and later:
SELECT
ad_group_bid_modifier.resource_name,
ad_group_bid_modifier.bid_modifier,
ad_group_bid_modifier.length_of_booking.min_days,
ad_group_bid_modifier.length_of_booking.max_days
FROM ad_group_bid_modifier
WHERE ad_group_bid_modifier.length_of_booking.min_days = 5
Creating bid modifiers (JSON payload)
The following JSON payloads demonstrate creating ad group bid modifiers in v26 and later.
Creating a length of booking bid modifier in v26:
{
"customerId": "1234567890",
"operations": [
{
"create": {
"adGroup": "customers/1234567890/adGroups/987654321",
"bidModifier": 1.2,
"lengthOfBooking": {
"minDays": "3",
"maxDays": "5"
}
}
}
]
}
In v25 and earlier, this used hotelLengthOfStay with minNights and
maxNights.
Creating a start date range bid modifier in v26:
{
"customerId": "1234567890",
"operations": [
{
"create": {
"adGroup": "customers/1234567890/adGroups/987654321",
"bidModifier": 1.5,
"startDateRange": {
"startDate": "2026-12-20",
"endDate": "2026-12-31"
}
}
}
]
}
Creating a user set dates bid modifier in v26:
{
"customerId": "1234567890",
"operations": [
{
"create": {
"adGroup": "customers/1234567890/adGroups/987654321",
"bidModifier": 1.3,
"userSetDates": {
"type": "USER_SELECTED"
}
}
}
]
}
Updating and removing bid modifiers
You can update the multiplier on an existing bid modifier or remove the bid modifier entirely:
- Updating: Criterion fields are
IMMUTABLE. To modify the bid multiplier, send anupdateoperation withupdateMask(update_maskin protobuf) set to"bidModifier"("bid_modifier") and setbidModifier(bid_modifier) to a valid value (0.1to10.0or0to opt out foradvance_booking_window,length_of_booking,start_day_of_week,start_date_range, anddevice;0.5to2.0foruser_set_dates). To change the targeting criteria, remove the bid modifier and create a new one. - Removing: Send a
removeoperation with the resource name:
{
"customerId": "1234567890",
"operations": [
{
"remove": "customers/1234567890/adGroupBidModifiers/987654321~555444333"
}
]
}
Validation rules and error handling
Validation rules stay the same across versions, but six CriterionError enum
values are renamed in v26 as shown in the following table:
| Scenario | v25 and earlier | v26 and later |
|---|---|---|
| Length of booking range overlaps existing criterion | HOTEL_LENGTH_OF_STAY_OVERLAPS_WITH_EXISTING_CRITERION |
LENGTH_OF_BOOKING_OVERLAPS_WITH_EXISTING_CRITERION |
| Advance booking window range overlaps existing criterion | HOTEL_ADVANCE_BOOKING_WINDOW_OVERLAPS_WITH_EXISTING_CRITERION |
ADVANCE_BOOKING_WINDOW_OVERLAPS_WITH_EXISTING_CRITERION |
| Start date range overlaps existing criterion | HOTEL_CHECK_IN_DATE_RANGE_OVERLAPS_WITH_EXISTING_CRITERION |
START_DATE_RANGE_OVERLAPS_WITH_EXISTING_CRITERION |
start_date earlier than yesterday (UTC) |
HOTEL_CHECK_IN_DATE_RANGE_START_DATE_TOO_EARLY |
START_DATE_RANGE_START_DATE_TOO_EARLY |
end_date more than 330 days in future (UTC) |
HOTEL_CHECK_IN_DATE_RANGE_END_DATE_TOO_LATE |
START_DATE_RANGE_END_DATE_TOO_LATE |
start_date after end_date |
HOTEL_CHECK_IN_DATE_RANGE_REVERSED |
START_DATE_RANGE_REVERSED |
The following validation errors apply across all API versions:
FieldError.REQUIRED: Missing a required range bound (such asadvance_booking_windowwithoutmin_daysormax_days).RangeError.TOO_HIGH/RangeError.TOO_LOW: Value out of bounds, such asadvance_booking_window.max_daysgreater than 330,min_daysgreater thanmax_daysonadvance_booking_windoworlength_of_booking,bid_modifieroutside0.1–10.0foradvance_booking_window,length_of_booking,start_day_of_week, orstart_date_range, orbid_modifieroutside0.5–2.0(including0) foruser_set_dates.ResourceCountLimitExceededError.RESOURCE_LIMIT: Ad group exceeds the per-ad-group limit for bid modifiers.MutateError.INCONSISTENT_FIELD_VALUES: A fixed-ID enum subfield (such asuser_set_dates.type,start_day_of_week.day_of_week, ordevice.type) does not match the criterion ID specified inresource_name.ContextError.OPERATION_NOT_PERMITTED_FOR_CONTEXT: Attempting to add a travel bid modifier on an unsupported campaign type or ineligible Search campaign.