google.ima. Ad
An ad class that's extended by classes representing different ad types.
Methods
getAdId
getAdId() returns 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() returns AdPodInfo
Returns the ad's pod information.
- Returns
-
non-null AdPodInfo
The ad's pod information.
getAdSystem
getAdSystem() returns 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() returns 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() returns (null or string)
Identifies the API needed to execute the ad. This corresponds with the apiFramework specified in vast.
- Returns
-
(null or string)
The API framework need to execute the ad, or null if this information is unavailable.
getCompanionAds
getCompanionAds(adSlotWidth, adSlotHeight, settings) returns Array of non-null 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.
Parameter |
|
---|---|
adSlotWidth |
number Width of the companion ad slot. |
adSlotHeight |
number Height of the companion ad slot. |
settings |
Optional (undefined or non-null CompanionAdSelectionSettings) The selection settings for companion ads. |
- Returns
-
non-null Array of non-null CompanionAd
Array of companion ads that matches the settings and the slot size.
getContentType
getContentType() returns 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 START event, when the media file is selected.
- Returns
-
string
The content type, empty string if not available.
getCreativeAdId
getCreativeAdId() returns 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
getCreativeId
getCreativeId() returns 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() returns 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
getDescription
getDescription() returns string
Returns the description of this ad from the VAST response.
- Returns
-
string
The description, empty if not specified.
getDuration
getDuration() returns 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() returns 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() returns (null or 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 or string)
getMinSuggestedDuration
getMinSuggestedDuration() returns 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() returns 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() returns (null or string)
Returns the URL associated with the survey for the given ad. Returns null if unavailable.
- Returns
-
(null or string)
getTitle
getTitle() returns string
Returns the title of this ad from the VAST response.
- Returns
-
string
The title, empty if not specified.
getTraffickingParameters
getTraffickingParameters() returns Object with string properties
Gets custom parameters associated with the ad at the time of ad trafficking.
- Returns
-
non-null Object with string properties
A mapping of trafficking keys to their values, or the empty Object if this information is not available.
getTraffickingParametersString
getTraffickingParametersString() returns 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() returns Array of string
Returns the UI elements that are being displayed when this ad is played.
Refer to UiElements
for possible elements of the array
returned.
- Returns
-
non-null Array of string
The UI elements being displayed.
getUniversalAdIdRegistry
getUniversalAdIdRegistry() returns string
The registry associated with cataloging the UniversalAdId of the selected creative for the ad.
- Deprecated
- Use ad.getUniversalAdIds() instead
- Returns
-
string
Returns the registry value, or "unknown" if unavailable.
getUniversalAdIdValue
getUniversalAdIdValue() returns string
The UniversalAdId of the selected creative for the ad.
- Deprecated
- Use ad.getUniversalAdIds() instead
- Returns
-
string
Returns the id value or "unknown" if unavailable.
getUniversalAdIds
getUniversalAdIds() returns Array of non-null UniversalAdIdInfo
The list of UniversalAdIds of the selected creative for the ad.
- Returns
-
non-null Array of non-null UniversalAdIdInfo
Returns the list of universal ad ID information that applies for this ad.
getVastMediaBitrate
getVastMediaBitrate() returns 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() returns 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() returns 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() returns 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() returns Array of 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
-
non-null Array of string
The IDs of the ads, starting at the inline ad, or an empty array if there are no wrapper ads.
getWrapperAdSystems
getWrapperAdSystems() returns Array of 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
-
non-null Array of string
The ad systems of the ads, starting at the inline ad, or an empty array if there are no wrapper ads.
getWrapperCreativeIds
getWrapperCreativeIds() returns Array of 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
-
non-null Array of string
The IDs of the ads' creatives, starting at the inline ad, or an empty array if there are no wrapper ads.
isLinear
isLinear() returns 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.