AdsApp.YouTubeVideoAssetBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Builds new YouTube video assets.
Typical usage:
var youTubeVideoId = "123ABCabc-_";
var assetOperation = AdsApp.adAssets().newYouTubeVideoAssetBuilder()
.withName("name")
.withYouTubeVideoId(youTubeVideoId)
.build();
var videoAsset = assetOperation.getResult();
Methods:
build()
Creates a video asset. Returns an
AssetOperation
that can be
used to get the new video asset (or access any associated errors if the
creation failed).
Return values:
withName(name)
Sets new YouTube video asset's name to the specified value.
Arguments:
Name | Type | Description |
name |
String |
The name for the video asset. |
Return values:
withYouTubeVideoId(youTubeVideoId)
Sets YouTube video ID. This field is required.
Arguments:
Name | Type | Description |
youTubeVideoId |
String |
The YouTube video ID. |
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThe \u003ccode\u003enewYouTubeVideoAssetBuilder\u003c/code\u003e facilitates the creation of new YouTube video assets within Google Ads campaigns.\u003c/p\u003e\n"],["\u003cp\u003eIt requires providing a name for the asset using the \u003ccode\u003ewithName\u003c/code\u003e method and the YouTube video ID using \u003ccode\u003ewithYouTubeVideoId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild\u003c/code\u003e method finalizes the asset creation and returns an \u003ccode\u003eAssetOperation\u003c/code\u003e for retrieval or error handling.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ewithYouTubeVideoId\u003c/code\u003e is a required field for successfully building a video asset.\u003c/p\u003e\n"]]],[],null,["# AdsApp.YouTubeVideoAssetBuilder\n\nBuilds new YouTube video assets.\n\nTypical usage:\n\n```gdscript\nvar youTubeVideoId = \"123ABCabc-_\";\nvar assetOperation = AdsApp.adAssets().newYouTubeVideoAssetBuilder()\n .withName(\"name\")\n .withYouTubeVideoId(youTubeVideoId)\n .build();\nvar videoAsset = assetOperation.getResult();\n```\n\n### Methods:\n\n| Member | Type | Description |\n|--------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| [build()](#build) | [AdsApp.AssetOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_assetoperation) | Creates a video asset. |\n| [withName(name)](#withName_name) | [AdsApp.YouTubeVideoAssetBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_youtubevideoassetbuilder) | Sets new YouTube video asset's name to the specified value. |\n| [withYouTubeVideoId(youTubeVideoId)](#withYouTubeVideoId_youTubeVideoId) | [AdsApp.YouTubeVideoAssetBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_youtubevideoassetbuilder) | Sets YouTube video ID. |\n\n`build()`\n---------\n\nCreates a video asset. Returns an `AssetOperation` that can be used to get the new video asset (or access any associated errors if the creation failed).\n\n### Return values:\n\n| Type | Description |\n|------------------------------------------------------------------------------------------|----------------------|\n| [AdsApp.AssetOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_assetoperation) | The asset operation. |\n\n`withName(name)`\n----------------\n\nSets new YouTube video asset's name to the specified value.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|----------|-------------------------------|\n| name | `String` | The name for the video asset. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------|\n| [AdsApp.YouTubeVideoAssetBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_youtubevideoassetbuilder) | The video asset builder with the specified name. |\n\n`withYouTubeVideoId(youTubeVideoId)`\n------------------------------------\n\nSets YouTube video ID. This field is required.\n\n### Arguments:\n\n| Name | Type | Description |\n|----------------|----------|-----------------------|\n| youTubeVideoId | `String` | The YouTube video ID. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|\n| [AdsApp.YouTubeVideoAssetBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_youtubevideoassetbuilder) | The video asset builder with the specified YouTube video ID. |"]]