Add Hotel Ad Group Bid Modifiers

  • The code demonstrates how to add ad group bid modifiers to a hotel ad group using the Google Ads API.

  • Bid modifiers are created based on hotel check-in day (specifically Monday with a 150% increase) and hotel length of stay (3 to 7 nights with a 170% increase).

  • The example shows how to construct the necessary objects, set their properties, and issue a mutate request to apply the bid modifiers.

  • After successfully adding the bid modifiers, the code prints the resource names of the newly created bid modifiers.

Java

// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.ads.googleads.examples.travel;

import com.beust.jcommander.Parameter;
import com.google.ads.googleads.examples.utils.ArgumentNames;
import com.google.ads.googleads.examples.utils.CodeSampleParams;
import com.google.ads.googleads.lib.GoogleAdsClient;
import com.google.ads.googleads.v25.common.HotelCheckInDayInfo;
import com.google.ads.googleads.v25.common.HotelLengthOfStayInfo;
import com.google.ads.googleads.v25.enums.DayOfWeekEnum.DayOfWeek;
import com.google.ads.googleads.v25.errors.GoogleAdsError;
import com.google.ads.googleads.v25.errors.GoogleAdsException;
import com.google.ads.googleads.v25.resources.AdGroupBidModifier;
import com.google.ads.googleads.v25.services.AdGroupBidModifierOperation;
import com.google.ads.googleads.v25.services.AdGroupBidModifierServiceClient;
import com.google.ads.googleads.v25.services.MutateAdGroupBidModifierResult;
import com.google.ads.googleads.v25.services.MutateAdGroupBidModifiersResponse;
import com.google.ads.googleads.v25.utils.ResourceNames;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;