# Interface Ad

*** ** * ** ***

An ad class that's extended by classes representing different ad types.

| Methods ||
|---|---|
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getAdId` | Ad ID is used to synchronize main ad and companion ads. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getAdPodInfo` | Returns the ad's pod information. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getAdSystem` | The source ad server information included in the ad response. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getAdvertiserName` | The advertiser name as defined by the serving party. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getApiFramework` | Identifies the API needed to execute the ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getCompanionAds` | Gets the companion ads for this ad based on companion ad slot size. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getContentType` | Returns the content type of the currently selected creative, or empty string if no creative is selected or the content type is unavailable. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getCreativeAdId` | Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getCreativeId` | Retrieves the ID of the selected creative for the ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getDealId` | Returns the first deal ID present in the wrapper chain for the current ad, starting from the top. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getDescription` | Returns the description of this ad from the VAST response. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getDuration` | Returns the duration of the selected creative, or -1 for non-linear creatives. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getHeight` | Returns the height of the selected non-linear creative. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getMediaUrl` | Returns the URL of the media file chosen from the ad based on the media selection settings currently in use. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getMinSuggestedDuration` | Returns the minimum suggested duration in seconds that the nonlinear creative should be displayed. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getSkipTimeOffset` | The number of seconds of playback before the ad becomes skippable. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getSurveyUrl` | Returns the URL associated with the survey for the given ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getTitle` | Returns the title of this ad from the VAST response. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getTraffickingParameters` | Gets custom parameters associated with the ad at the time of ad trafficking. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getTraffickingParametersString` | Gets custom parameters associated with the ad at the time of ad trafficking. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getUiElements` | Returns the UI elements that are being displayed when this ad is played. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getUniversalAdIdRegistry` | **Deprecated.**The registry associated with cataloging the UniversalAdId of the selected creative for the ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getUniversalAdIds` | The list of UniversalAdIds of the selected creative for the ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getUniversalAdIdValue` | **Deprecated.**The UniversalAdId of the selected creative for the ad. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getVastMediaBitrate` | When both the creative and the media file have been selected by the SDK, this will return the bitrate for the media file as listed in the vast response. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getVastMediaHeight` | Returns the VAST media height of the selected creative. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getVastMediaWidth` | Returns the VAST media width of the selected creative. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getWidth` | Returns the width of the selected creative. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getWrapperAdIds` | Ad IDs used for wrapper ads. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getWrapperAdSystems` | Ad systems used for wrapper ads. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.getWrapperCreativeIds` | Selected creative IDs used for wrapper ads. |
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad#google.ima.Ad.isLinear` | Indicates whether the ad's current mode of operation is linear or non-linear. |

## Methods

*** ** * ** ***

### getAdId

`getAdId(): string` Ad ID is used to synchronize main ad and companion ads.

| Returns ||
|---|---|
| `string` | The ID of the ad, or the empty string if this information is unavailable. |

*** ** * ** ***

### getAdPodInfo

`getAdPodInfo(): https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdPodInfo` Returns the ad's pod information.

| Returns ||
|---|---|
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdPodInfo` | The ad's pod information. |

*** ** * ** ***

### getAdSystem

`getAdSystem(): string` The source ad server information included in the ad response.

| Returns ||
|---|---|
| `string` | The source ad server of the ad, or the empty string if this information is unavailable. |

*** ** * ** ***

### getAdvertiserName

`getAdvertiserName(): string` The advertiser name as defined by the serving party.

| Returns ||
|---|---|
| `string` | The advertiser name, or the empty string if this information is unavailable. |

*** ** * ** ***

### getApiFramework

`getApiFramework(): string` Identifies the API needed to execute the ad. This corresponds with the apiFramework specified in vast.

| Returns ||
|---|---|
| `string` | The API framework need to execute the ad, or null if this information is unavailable. |

*** ** * ** ***

### getCompanionAds

`getCompanionAds(adSlotWidth: number, adSlotHeight: number,
settings?: https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/class/google.ima.CompanionAdSelectionSettings): https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.CompanionAd[]` Gets the companion ads for this ad based on companion ad slot size. Optionally, advanced selection settings are accepted. Note that this method will only return non-empty array for ad instances acquired on or after STARTED event. Specifically, ads from the LOADED event will return an empty array.

| Parameters ||
|---|---|
| `adSlotWidth: number` | Width of the companion ad slot. |
| `adSlotHeight: number` | Height of the companion ad slot. |
| `` `Optional` settings: https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/class/google.ima.CompanionAdSelectionSettings `` | The selection settings for companion ads. |

| Returns ||
|---|---|
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.CompanionAd[]` | Array of companion ads that matches the settings and the slot size. |

*** ** * ** ***

### getContentType

`getContentType(): string` Returns the content type of the currently selected creative, or empty string if no creative is selected or the content type is unavailable. For linear ads, the content type is only going to be available after the STARTED event, when the media file is selected.

| Returns ||
|---|---|
| `string` | The content type, empty string if not available. |

*** ** * ** ***

### getCreativeAdId

`getCreativeAdId(): string` Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable. This is the Ad-ID of the creative in the VAST response.

| Returns ||
|---|---|
| `string` | The ad ID of the creative. |

*** ** * ** ***

### getCreativeId

`getCreativeId(): string` Retrieves the ID of the selected creative for the ad.

| Returns ||
|---|---|
| `string` | The ID of the selected creative for the ad, or the empty string if this information is unavailable. |

*** ** * ** ***

### getDealId

`getDealId(): string` Returns the first deal ID present in the wrapper chain for the current ad, starting from the top. Returns the empty string if unavailable.

| Returns ||
|---|---|
| `string` | The deal ID. |

*** ** * ** ***

### getDescription

`getDescription(): string` Returns the description of this ad from the VAST response.

| Returns ||
|---|---|
| `string` | The description, empty if not specified. |

*** ** * ** ***

### getDuration

`getDuration(): number` Returns the duration of the selected creative, or -1 for non-linear creatives.

| Returns ||
|---|---|
| `number` | The selected creative duration in seconds, -1 if non-linear. |

*** ** * ** ***

### getHeight

`getHeight(): number` Returns the height of the selected non-linear creative.

| Returns ||
|---|---|
| `number` | The height of the selected non-linear creative or 0 for a linear creative. |

*** ** * ** ***

### getMediaUrl

`getMediaUrl(): string` Returns the URL of the media file chosen from the ad based on the media selection settings currently in use. Returns null if this information is unavailable. Available on STARTED event.

| Returns ||
|---|---|
| `string` | The media URL. |

*** ** * ** ***

### getMinSuggestedDuration

`getMinSuggestedDuration(): number` Returns the minimum suggested duration in seconds that the nonlinear creative should be displayed. Returns -2 if the minimum suggested duration is unknown. For linear creative it returns the entire duration of the ad.

| Returns ||
|---|---|
| `number` | The minimum suggested duration in seconds that a creative should be displayed. |

*** ** * ** ***

### getSkipTimeOffset

`getSkipTimeOffset(): number` The number of seconds of playback before the ad becomes skippable. -1 is returned for non skippable ads or if this is unavailable.

| Returns ||
|---|---|
| `number` | The offset in seconds, or -1. |

*** ** * ** ***

### getSurveyUrl

`getSurveyUrl(): string` Returns the URL associated with the survey for the given ad. Returns null if unavailable.

| Returns ||
|---|---|
| `string` | The survey URL. |

*** ** * ** ***

### getTitle

`getTitle(): string` Returns the title of this ad from the VAST response.

| Returns ||
|---|---|
| `string` | The title, empty if not specified. |

*** ** * ** ***

### getTraffickingParameters

`getTraffickingParameters(): {
[key: string]: string;
}` Gets custom parameters associated with the ad at the time of ad trafficking.

| Returns ||
|---|---|
| `{ [key: string]: string; }` | A mapping of trafficking keys to their values, or the empty Object if this information is not available. |

*** ** * ** ***

### getTraffickingParametersString

`getTraffickingParametersString(): string` Gets custom parameters associated with the ad at the time of ad trafficking. Returns a raw string version of the parsed parameters from getTraffickingParameters.

| Returns ||
|---|---|
| `string` | Trafficking parameters, or the empty string if this information is not available. |

*** ** * ** ***

### getUiElements

`getUiElements(): string[]` Returns the UI elements that are being displayed when this ad is played. Refer to `google.ima.UiElements` for possible elements of the array returned.

| Returns ||
|---|---|
| `string[]` | The UI elements being displayed. |

*** ** * ** ***

### getUniversalAdIdRegistry

`getUniversalAdIdRegistry(): string` The registry associated with cataloging the UniversalAdId of the selected creative for the ad.

> [!WARNING]
> **Deprecated:** Use ad.getUniversalAdIds() instead

| Returns ||
|---|---|
| `string` | Returns the registry value, or "unknown" if unavailable. |

*** ** * ** ***

### getUniversalAdIds

`getUniversalAdIds(): https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.UniversalAdIdInfo[]` The list of UniversalAdIds of the selected creative for the ad.

| Returns ||
|---|---|
| `https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.UniversalAdIdInfo[]` | Returns the list of universal ad ID information that applies for this ad. |

*** ** * ** ***

### getUniversalAdIdValue

`getUniversalAdIdValue(): string` The UniversalAdId of the selected creative for the ad.

> [!WARNING]
> **Deprecated:** Use ad.getUniversalAdIds() instead

| Returns ||
|---|---|
| `string` | Returns the id value or "unknown" if unavailable. |

*** ** * ** ***

### getVastMediaBitrate

`getVastMediaBitrate(): number` When both the creative and the media file have been selected by the SDK, this will return the bitrate for the media file as listed in the vast response.

| Returns ||
|---|---|
| `number` | The bitrate for the selected media file or 0. |

*** ** * ** ***

### getVastMediaHeight

`getVastMediaHeight(): number` Returns the VAST media height of the selected creative.

| Returns ||
|---|---|
| `number` | The VAST media height of the selected creative or 0 if none is selected. |

*** ** * ** ***

### getVastMediaWidth

`getVastMediaWidth(): number` Returns the VAST media width of the selected creative.

| Returns ||
|---|---|
| `number` | The VAST media width of the selected creative or 0 if none is selected. |

*** ** * ** ***

### getWidth

`getWidth(): number` Returns the width of the selected creative.

| Returns ||
|---|---|
| `number` | The width of the selected non-linear creative or 0 for a linear creative. |

*** ** * ** ***

### getWrapperAdIds

`getWrapperAdIds(): string[]` Ad IDs used for wrapper ads. The IDs returned starts at the inline ad (innermost) and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

| Returns ||
|---|---|
| `string[]` | The IDs of the ads, starting at the inline ad, or an empty array if there are no wrapper ads. |

*** ** * ** ***

### getWrapperAdSystems

`getWrapperAdSystems(): string[]` Ad systems used for wrapper ads. The ad systems returned starts at the inline ad and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

| Returns ||
|---|---|
| `string[]` | The ad systems of the ads, starting at the inline ad, or an empty array if there are no wrapper ads. |

*** ** * ** ***

### getWrapperCreativeIds

`getWrapperCreativeIds(): string[]` Selected creative IDs used for wrapper ads. The creative IDs returned starts at the inline ad and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

| Returns ||
|---|---|
| `string[]` | The IDs of the ads' creatives, starting at the inline ad, or an empty array if there are no wrapper ads. |

*** ** * ** ***

### isLinear

`isLinear(): boolean` Indicates whether the ad's current mode of operation is linear or non-linear. If the value is true, it indicates that the ad is in linear playback mode; if false, it indicates non-linear mode. The player checks the linear property and updates its state according to the details of the ad placement. While the ad is in linear mode, the player pauses the content video. If linear is true initially, and the ad is a pre-roll (defined externally), the player may choose to delay loading the content video until near the end of the ad playback.

| Returns ||
|---|---|
| `boolean` | True if the ad is linear, false otherwise. |