This is the legacy documentation for Google Ads scripts. Go to the current docs.

AdsApp.​Media

Stay organized with collections Save and categorize content based on your preferences.
A Google Ads media object.

Methods:

MemberTypeDescription
getDimensions AdsApp.MediaDimensions Returns a MediaDimensions instance for the media object if it is an image or video.
getEntityType String Returns the type of this entity as a String, in this case, "Media".
getFileSize long Returns the size of the media file in bytes.
getId long Returns the ID of the media object.
getMimeType String Returns a MIME type identifier for the media object.
getName String Returns the name of the media object, or null if the media was created without a name.
getReferenceId String Returns the media object's reference ID key.
getSourceUrl String Returns the URL where the original media was downloaded from, or null if the media was not obtained via download.
getType String Returns the media object's type.
getUrls AdsApp.MediaUrls Returns a MediaUrls instance for the media object if it is an image.
getYouTubeVideoId void Returns the YouTube video ID if this media is a YouTube video, or null otherwise.

getDimensions()

Returns a MediaDimensions instance for the media object if it is an image or video.

Return values:

TypeDescription
AdsApp.MediaDimensions The media dimensions.

getEntityType()

Returns the type of this entity as a String, in this case, "Media".

Return values:

TypeDescription
String Type of this entity: "Media".

getFileSize()

Returns the size of the media file in bytes.

Return values:

TypeDescription
long The file size.

getId()

Returns the ID of the media object.

Return values:

TypeDescription
long The media ID.

getMimeType()

Returns a MIME type identifier for the media object.

For example, this returns IMAGE_PNG for the image/png MIME type. See the API documentation for all possible values.

Return values:

TypeDescription
String The MIME type.

getName()

Returns the name of the media object, or null if the media was created without a name.

Return values:

TypeDescription
String The media object's name.

getReferenceId()

Returns the media object's reference ID key.

Return values:

TypeDescription
String The media reference ID.

getSourceUrl()

Returns the URL where the original media was downloaded from, or null if the media was not obtained via download.

Return values:

TypeDescription
String The source URL.

getType()

Returns the media object's type. This is one of AUDIO, DYNAMIC_IMAGE, ICON, IMAGE, STANDARD_ICON, VIDEO, or MEDIA_BUNDLE.

Return values:

TypeDescription
String The media type.

getUrls()

Returns a MediaUrls instance for the media object if it is an image.

Return values:

TypeDescription
AdsApp.MediaUrls The media URLs.

getYouTubeVideoId()

Returns the YouTube video ID if this media is a YouTube video, or null otherwise.

Returns nothing.