AdsApp.​YouTubeVideoBuilder

  • The YouTubeVideoBuilder facilitates the creation and management of YouTube video criteria within Google Ads campaigns.

  • It allows for setting the video ID, which is a mandatory requirement, along with optional parameters like maximum CPC or CPM bids.

  • You can use the build() method to create a YouTubeVideo criterion, or the exclude() method to create an ExcludedYouTubeVideo criterion for negative targeting.

  • withCpc(), withCpm(), and withVideoId() methods are available to configure specific aspects of the YouTube video targeting.

Builder for YouTubeVideo objects.

Example usage:

var youTubeVideoBuilder = adGroup.display().newYouTubeVideoBuilder();
var youTubeVideoOperation = youTubeVideoBuilder
  .withVideoId('_YUugB4IUl4')      // required
  .build();                        // create the YouTube video

Methods:

MemberTypeDescription
build() AdsApp.YouTubeVideoOperation Builds the YouTube video criterion.
exclude() AdsApp.ExcludedYouTubeVideoOperation Builds the excluded YouTube video criterion.
withCpc(cpc) AdsApp.YouTubeVideoBuilder Sets the max CPC bid of the new YouTube video to the specified value.
withCpm(cpm) AdsApp.YouTubeVideoBuilder Sets the CPM bid of the new YouTube video to the specified value.
withVideoId(videoId) AdsApp.YouTubeVideoBuilder Sets the YouTube video ID.

build()

Builds the YouTube video criterion. Returns a YouTubeVideoOperation that corresponds to the creation of the YouTubeVideo.

Return values:

TypeDescription
AdsApp.YouTubeVideoOperation The YouTubeVideoOperation.

exclude()

Builds the excluded YouTube video criterion. Returns an ExcludedYouTubeVideoOperation that corresponds to the creation of the ExcludedYouTubeVideo.

Return values:

TypeDescription
AdsApp.ExcludedYouTubeVideoOperation The ExcludedYouTubeVideoOperation.

withCpc(cpc)

Sets the max CPC bid of the new YouTube video to the specified value.

Arguments:

NameTypeDescription
cpc double The max CPC bid of the YouTube video.

Return values:

TypeDescription
AdsApp.YouTubeVideoBuilder The YouTube video builder with the specified max CPC.

withCpm(cpm)

Sets the CPM bid of the new YouTube video to the specified value.

See Cost-per-thousand impressions (CPM) for more information.

Arguments:

NameTypeDescription
cpm double The CPM bid of the YouTube video.

Return values:

TypeDescription
AdsApp.YouTubeVideoBuilder The YouTube video builder with the specified CPM.

withVideoId(videoId)

Sets the YouTube video ID. This field is required.

Arguments:

NameTypeDescription
videoId String The YouTube video ID.

Return values:

TypeDescription
AdsApp.YouTubeVideoBuilder A YouTubeVideoBuilder with the specified video ID.