Set or Update Bids

You can use the Google Ads API to set or update bids for Hotel ads.

For a Commission (per conversion or per stay) strategy:

  • You initially set bids at the campaign level as part of assigning the bidding strategy.
  • You can update bid amounts by updating the fixed percentage of the conversion value that was set at the campaign level when you assigned the strategy. For details, see Update a bidding strategy.

For a CPC% or Manual CPC strategy:

Set CPC% or Manual CPC bid amounts

For CPC% and Manual CPC bid strategies, specific bid amounts need to be set at:

  • The ad group level
  • The listing group level on unit nodes of a listing group tree

However, although you must set the value at the ad group level, that value won't be used by Hotel ads. Hotel ads will use the value at the listing group level, which will override the irrelevant value at the ad group level.

You can also control bid ceilings at the campaign level as part of setting the bid strategy. For details, see Assign or Update a Bidding Strategy.

Set a bid on an ad group

The code below shows how to set a bid at the ad group level when creating a new hotel ad group.

PHP

private static function addHotelAdGroup(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    string $campaignResourceName
) {
    // Creates an ad group.
    $adGroup = new AdGroup([
        'name' => 'Earth to Mars Cruise #' . uniqid(),
        // Sets the campaign.
        'campaign' => $campaignResourceName,
        // Sets the ad group type to HOTEL_ADS.
        // This cannot be set to other types.
        'type' => AdGroupType::HOTEL_ADS,
        'cpc_bid_micros' => 10000000,
        'status' => AdGroupStatus::ENABLED,
    ]);

    // Creates an ad group operation.
    $adGroupOperation = new AdGroupOperation();
    $adGroupOperation->setCreate($adGroup);

    // Issues a mutate request to add an ad group.
    $adGroupServiceClient = $googleAdsClient->getAdGroupServiceClient();
    $response = $adGroupServiceClient->mutateAdGroups($customerId, [$adGroupOperation]);

    /** @var AdGroup $addedAdGroup */
    $addedAdGroup = $response->getResults()[0];
    printf(
        "Added a hotel ad group with resource name '%s'.%s",
        $addedAdGroup->getResourceName(),
        PHP_EOL
    );

    return $addedAdGroup->getResourceName();
}

Set a bid on a listing group unit node

As described in Create Hotel Listing Groups, Hotel ads will not serve until you create a valid listing group tree with at least one unit node. Also, nodes are objects of the ListingGroupInfo class, which contains the ListingGroupType field that indicates if nodes are a unit or subdivision. Setting ListingGroupInfo to listing_group of AdGroupCriterion links the ListingGroupInfo object to the AdGroup. You can set bids on unit nodes by setting the percent_cpc_bid_micros field or the cpc_bid_micros field of AdGroupCriterion. Attempting to do so on subdivision nodes will fail with an error.

When setting bids at the listing group level, note the following:

  • You can't set the bid amount on the "All hotels" (root) hotel listing group.
  • You can't set the bid amount on a subdivision.
  • Google recommends not setting bids on "Other" nodes that are unit nodes. Bids on "Other" (unit) nodes can have unintended effects on other hotel ad bids.

The code below shows how to set a bid on a listing group unit node.

PHP

private static function addLevel1Nodes(
    int $customerId,
    int $adGroupId,
    string $rootResourceName,
    array &$operations,
    int $percentCpcBidMicroAmount
) {
    // Creates hotel class info and dimension info for 5-star hotels.
    $fiveStarredDimensionInfo = new ListingDimensionInfo([
        'hotel_class' => new HotelClassInfo(['value' => 5])
    ]);
    // Creates listing group info for 5-star hotels as a UNIT node.
    $fiveStarredUnit = self::createListingGroupInfo(
        ListingGroupType::UNIT,
        $rootResourceName,
        $fiveStarredDimensionInfo
    );
    // Creates an ad group criterion for 5-star hotels.
    $fiveStarredAdGroupCriterion = self::createAdGroupCriterion(
        $customerId,
        $adGroupId,
        $fiveStarredUnit,
        $percentCpcBidMicroAmount
    );
    // Decrements the temp ID for the next ad group criterion.
    self::$nextTempId--;
    $operation = self::generateCreateOperation($fiveStarredAdGroupCriterion);
    $operations[] = $operation;

    // You can also create more UNIT nodes for other hotel classes by copying the above code in
    // this method and modifying the value passed to HotelClassInfo() to the value you want.
    // For instance, passing 4 instead of 5 in the above code will create a UNIT node of 4-star
    // hotels instead.

    // Creates hotel class info and dimension info for other hotel classes by *not* specifying
    // any attributes on those object.
    $othersHotelsDimensionInfo = new ListingDimensionInfo([
        'hotel_class' => new HotelClassInfo()
    ]);
    // Creates listing group info for other hotel classes as a SUBDIVISION node, which will be
    // used as a parent node for children nodes of the next level.
    $otherHotelsSubDivision = self::createListingGroupInfo(
        ListingGroupType::SUBDIVISION,
        $rootResourceName,
        $othersHotelsDimensionInfo
    );
    // Creates an ad group criterion for other hotel classes.
    $otherHotelsAdGroupCriterion = self::createAdGroupCriterion(
        $customerId,
        $adGroupId,
        $otherHotelsSubDivision,
        $percentCpcBidMicroAmount
    );
    $operation = self::generateCreateOperation($otherHotelsAdGroupCriterion);
    $operations[] = $operation;

    self::$nextTempId--;
    return $otherHotelsAdGroupCriterion->getResourceName();
}