google-ads-java icon indicating copy to clipboard operation
google-ads-java copied to clipboard

Add Java example for creating a Demand Gen campaign using API V20

Open bobhancockg opened this issue 7 months ago • 0 comments

This commit introduces a new Java example, AddDemandGenCampaign.java, which demonstrates how to create a Google Ads Demand Gen campaign with a video ad. This example is a port of the equivalent C# version.

The example covers:

  • Creation of a campaign budget.
  • Creation of a Demand Gen campaign (AdvertisingChannelType.DEMAND_GEN) using Target CPA bidding.
  • Creation of an ad group with Demand Gen specific settings (DemandGenAdGroupSettings), including channel controls.
  • Creation of necessary assets: a YouTube video asset and a logo image asset.
  • Creation of a Demand Gen video responsive ad (DemandGenVideoResponsiveAdInfo) linking the assets and including headlines, descriptions, and business name.
  • Bundling all operations into a single MutateGoogleAdsRequest for atomic execution.
  • Command-line arguments for customer ID and video ID.
  • Error handling for GoogleAdsException.

The code uses Google Ads API V20 and follows the established patterns and conventions for Java examples in this repository.

bobhancockg avatar Jun 12 '25 15:06 bobhancockg