Interface CompanionAd

  • This page describes the google.ima.CompanionAd interface which represents a companion ad.

  • The interface provides methods to retrieve information about the companion ad such as its ad slot ID, HTML content, content type, height, and width.

  • The getAdSlotId() method returns the ad slot ID as a string.

  • The getContent() method returns the HTML content for the companion ad as a string.

  • The getContentType() method returns the content type of the companion ad as a string, which may be null if unknown.

  • The getHeight() and getWidth() methods return the height and width of the companion ad in pixels as numbers.


Represents a companion ad.
Methods
getAdSlotId
Returns the ad slot id for this companion.
getContent
Returns the HTML content for the companion ad that can be added to the publisher page.
getContentType
Returns the content type of the Companion Ad.
getHeight
Returns the height of the companion in pixels.
getWidth
Returns the width of the companion in pixels.

Methods


getAdSlotId

getAdSlotId(): string
Returns the ad slot id for this companion.
Returns
string The ad slot id for this companion.

getContent

getContent(): string
Returns the HTML content for the companion ad that can be added to the publisher page.
Returns
string The HTML content.

getContentType

getContentType(): string
Returns the content type of the Companion Ad.
Returns
string The content type of the Companion Ad. This may return null if the content type is not known (such as in the case of a VAST HTMLResource or IFrameResource).

getHeight

getHeight(): number
Returns the height of the companion in pixels.
Returns
number The height of the companion in pixels.

getWidth

getWidth(): number
Returns the width of the companion in pixels.
Returns
number The width of the companion in pixels.