AI-generated Key Takeaways
-
Serves as an entry point for accessing ad type-specific information.
-
Provides methods like
expandedTextAd()
,imageAd()
,responsiveDisplayAd()
, andresponsiveSearchAd()
to retrieve ad details based on their type. -
Each method returns the ad as a specific object type (e.g., ExpandedTextAd, ImageAd) allowing access to its properties.
-
Using a method on an incompatible ad type will result in an error, highlighting the importance of type checking.
Typical usage:
if (ad.isType().expandedTextAd()) { var expandedTextAd = ad.asType().expandedTextAd(); var headlinePart1 = expandedTextAd.getHeadlinePart1(); }
Methods:
Member | Type | Description |
---|---|---|
expandedTextAd() | AdsApp.ExpandedTextAd |
Returns the ad as an ExpandedTextAd. |
imageAd() | AdsApp.ImageAd |
Returns the ad as an ImageAd. |
responsiveDisplayAd() | AdsApp.ResponsiveDisplayAd |
Returns the ad as a ResponsiveDisplayAd. |
responsiveSearchAd() | AdsApp.ResponsiveSearchAd |
Returns the ad as a ResponsiveSearchAd. |
expandedTextAd()
Returns the ad as an ExpandedTextAd. Calling this on an ad
of a different type will result in an error. Return values:
Type | Description |
---|---|
AdsApp.ExpandedTextAd |
The ad as an ExpandedTextAd. |
imageAd()
Returns the ad as an ImageAd. Calling
this on an ad of a different type will result in an error. Return values:
Type | Description |
---|---|
AdsApp.ImageAd |
The ad as an ImageAd. |
responsiveDisplayAd()
Returns the ad as a ResponsiveDisplayAd. Calling
this on an ad of a different type will result in an error. Return values:
Type | Description |
---|---|
AdsApp.ResponsiveDisplayAd |
The ad as a ResponsiveDisplayAd. |
responsiveSearchAd()
Returns the ad as a ResponsiveSearchAd. Calling this
on an ad of a different type will result in an error. Return values:
Type | Description |
---|---|
AdsApp.ResponsiveSearchAd |
The ad as a ResponsiveSearchAd. |