Interface Ad


An ad class that's extended by classes representing different ad types.
Methods
getAdId
Ad ID is used to synchronize main ad and companion ads.
getAdPodInfo
Returns the ad's pod information.
getAdSystem
The source ad server information included in the ad response.
getAdvertiserName
The advertiser name as defined by the serving party.
getApiFramework
Identifies the API needed to execute the ad.
getCompanionAds
Gets the companion ads for this ad based on companion ad slot size.
getCreativeAdId
Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable.
getCreativeId
Retrieves the ID of the selected creative for the ad.
getDealId
Returns the first deal ID present in the wrapper chain for the current ad, starting from the top.
getDescription
Returns the description of this ad from the VAST response.
getDuration
Returns the duration of the selected creative, or -1 for non-linear creatives.
getHeight
Returns the height of the selected non-linear creative.
getMediaUrl
Returns the URL of the media file chosen from the ad based on the media selection settings currently in use.
getMinSuggestedDuration
Returns the minimum suggested duration in seconds that the nonlinear creative should be displayed.
getSkipTimeOffset
The number of seconds of playback before the ad becomes skippable.
getSurveyUrl
Returns the URL associated with the survey for the given ad.
getTitle
Returns the title of this ad from the VAST response.
getTraffickingParameters
Gets custom parameters associated with the ad at the time of ad trafficking.
getTraffickingParametersString
Gets custom parameters associated with the ad at the time of ad trafficking.
getUiElements
Returns the UI elements that are being displayed when this ad is played.
getUniversalAdIdRegistry
Deprecated. The registry associated with cataloging the UniversalAdId of the selected creative for the ad.
getUniversalAdIds
The list of UniversalAdIds of the selected creative for the ad.
getUniversalAdIdValue
Deprecated. The UniversalAdId of the selected creative for the 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.
getVastMediaHeight
Returns the VAST media height of the selected creative.
getVastMediaWidth
Returns the VAST media width of the selected creative.
getWidth
Returns the width of the selected creative.
getWrapperAdIds
Ad IDs used for wrapper ads.
getWrapperAdSystems
Ad systems used for wrapper ads.
getWrapperCreativeIds
Selected creative IDs used for wrapper ads.
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(): AdPodInfo
Returns the ad's pod information.
Returns
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(): null | string
Identifies the API needed to execute the ad. This corresponds with the apiFramework specified in vast.
Returns
null | string The API framework need to execute the ad, or null if this information is unavailable.

getCompanionAds

getCompanionAds(adSlotWidth: number, adSlotHeight: number, settings?: CompanionAdSelectionSettings): 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: CompanionAdSelectionSettings The selection settings for companion ads.
Returns
CompanionAd[] Array of companion ads that matches the settings and the slot size.

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(): null | 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
null | 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(): null | string
Returns the URL associated with the survey for the given ad. Returns null if unavailable.
Returns
null | 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.
Returns
string Returns the registry value, or "unknown" if unavailable.

getUniversalAdIds

getUniversalAdIds(): UniversalAdIdInfo[]
The list of UniversalAdIds of the selected creative for the ad.
Returns
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.
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.