Google Ads API is returning to beta status. Please read our blog post for more details.

Creating a Hotel Ad Group Ad

Creating a Hotel ad involves two steps:

  1. Creating an Ad and setting its hotel_ad to an instance of HotelAdInfo.

  2. Creating an AdGroupAd and associating the previously created Ad to it.

private static function addHotelAdGroupAd(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    string $adGroupResourceName
) {
    // Creates a new hotel ad.
    $ad = new Ad([
        'hotel_ad' => new HotelAdInfo(),

    // Creates a new ad group ad and sets the hotel ad to it.
    $adGroupAd = new AdGroupAd([
        'ad' => $ad,
        'status' => AdGroupAdStatus::PAUSED,
        // Sets the ad group.
        'ad_group' => new StringValue(['value' => $adGroupResourceName])

    // Creates an ad group ad operation.
    $adGroupAdOperation = new AdGroupAdOperation();

    // Issues a mutate request to add an ad group ad.
    $adGroupAdServiceClient = $googleAdsClient->getAdGroupAdServiceClient();
    $response = $adGroupAdServiceClient->mutateAdGroupAds($customerId, [$adGroupAdOperation]);

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