Creating a Book on Google Campaign

Stay organized with collections Save and categorize content based on your preferences.

This guide shows how to create a Book on Google (BoG) campaign using the Google Ads API.

Here are the steps for creating and reverting a Book on Google campaign in Google Ads API:

  1. Create a BookOnGoogleAsset.
  2. Create a Hotel campaign.
  3. Associate the BookOnGoogleAsset with the Hotel campaign.
  4. Revert Book on Google Campaign using Google Ads API.

Create a BookOnGoogle Asset

A BookOnGoogleAsset is used to redirect users to book through Google. Book on Google changes the redirect URL to book directly through Google. A BookOnGoogleAsset can be reused, there is no need to create a BookOnGoogleAsset for each Hotel campaign.

A BookOnGoogleAsset is one of several Asset types available through the Google Ads API. When creating a BookOnGoogleAsset using the Google Ads API, no parameters need to be passed to the asset constructor.

Examples for creating an asset in different programming languages.

An example of how to create a BookOnGoogleAsset is shown below. This is a sample method written in C# showing how to create a BookOnGoogleAsset to be used later in the setup.

public void Run(GoogleAdsClient client, long customerId)
{
    // Get the AssetServiceClient.
    AssetServiceClient assetService = client.GetService(Services.V13.AssetService);

    // Creates a BookOnGoogle asset.
    BookOnGoogleAsset bogAsset = new BookOnGoogleAsset();

    // Creates an asset.
    Asset asset = new Asset()
    {
        Type = AssetType.BOOK_ON_GOOGLE,
        BookOnGoogleAsset = bogAsset
    };

    // Creates an asset operation.
    AssetOperation operation = new AssetOperation()
    {
        Create = asset
    };

    try
    {
        // Issues a mutate request to add the asset.
        MutateAssetsResponse response =
            assetService.MutateAssets(customerId.ToString(), new[] { operation });

        // Displays the result.
        Console.WriteLine($"Book on Google (BoG) asset with resource name: " +
            $"'{response.Results.First().ResourceName}' is created.");
    }
    catch (GoogleAdsException e)
    {
        Console.WriteLine("Failure:");
        Console.WriteLine($"Message: {e.Message}");
        Console.WriteLine($"Failure: {e.Failure}");
        Console.WriteLine($"Request ID: {e.RequestId}");
        throw;
    }
}

Create a Hotel campaign

Information and code samples for how to programmatically create a Hotel Campaign can be found on this page.

Associate the BookOnGoogleAsset with the Hotel campaign

After creating a BookOnGoogleAsset and Hotel campaign, the last step is to associate the new asset with the campaign. This step enables Google to know whether to show the vendor's website landing page or the Book on Google page.

Example of associating an asset with a campaign.

Revert a Book on Google campaign using Google Ads API

You can redirect users to the vendor landing page instead of the Book on Google page using the Google Ads API by modifying the Book on Google page configuration.

The example code Associate the asset with a campaign shows how to create a campaignAsset.

Instead of creating a campaignAsset, remove the campaignAsset using Remove = campaignAsset in place of Create = campaignAsset in the CampaignAssetOperation as follows:

CampaignAssetOperation operation = new CampaignAssetOperation()
{
    Remove = campaignAsset
};

This will cause users to be redirected to the vendor landing page instead of to the Book on Google page.