AdsApp.AdViewSpace
Stay organized with collections
Save and categorize content based on your preferences.
Starting point for viewing type-specific ad information.
Typical usage:
if (ad.isType().expandedTextAd()) {
var expandedTextAd = ad.asType().expandedTextAd();
var headlinePart1 = expandedTextAd.getHeadlinePart1();
}
Methods:
expandedTextAd()
Returns the ad as an
ExpandedTextAd. Calling this on an ad
of a different type will result in an error.
Return values:
imageAd()
Returns the ad as an
ImageAd. Calling
this on an ad of a different type will result in an error.
Return values:
responsiveDisplayAd()
Returns the ad as a
ResponsiveDisplayAd. Calling
this on an ad of a different type will result in an error.
Return values:
responsiveSearchAd()
Returns the ad as a
ResponsiveSearchAd. Calling this
on an ad of a different type will result in an error.
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eServes as an entry point for accessing ad type-specific information.\u003c/p\u003e\n"],["\u003cp\u003eProvides methods like \u003ccode\u003eexpandedTextAd()\u003c/code\u003e, \u003ccode\u003eimageAd()\u003c/code\u003e, \u003ccode\u003eresponsiveDisplayAd()\u003c/code\u003e, and \u003ccode\u003eresponsiveSearchAd()\u003c/code\u003e to retrieve ad details based on their type.\u003c/p\u003e\n"],["\u003cp\u003eEach method returns the ad as a specific object type (e.g., ExpandedTextAd, ImageAd) allowing access to its properties.\u003c/p\u003e\n"],["\u003cp\u003eUsing a method on an incompatible ad type will result in an error, highlighting the importance of type checking.\u003c/p\u003e\n"]]],[],null,["# AdsApp.AdViewSpace\n\nStarting point for viewing type-specific ad information.\n\nTypical usage:\n\n```gdscript\nif (ad.isType().expandedTextAd()) {\n var expandedTextAd = ad.asType().expandedTextAd();\n var headlinePart1 = expandedTextAd.getHeadlinePart1();\n}\n```\n\n### Methods:\n\n| Member | Type | Description |\n|-----------------------------------------------|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| [expandedTextAd()](#expandedTextAd) | [AdsApp.ExpandedTextAd](/google-ads/scripts/docs/reference/adsapp/adsapp_expandedtextad) | Returns the ad as an [ExpandedTextAd](/google-ads/scripts/docs/reference/adsapp/adsapp_expandedtextad). |\n| [imageAd()](#imageAd) | [AdsApp.ImageAd](/google-ads/scripts/docs/reference/adsapp/adsapp_imagead) | Returns the ad as an [ImageAd](/google-ads/scripts/docs/reference/adsapp/adsapp_imagead). |\n| [responsiveDisplayAd()](#responsiveDisplayAd) | [AdsApp.ResponsiveDisplayAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivedisplayad) | Returns the ad as a [ResponsiveDisplayAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivedisplayad). |\n| [responsiveSearchAd()](#responsiveSearchAd) | [AdsApp.ResponsiveSearchAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivesearchad) | Returns the ad as a [ResponsiveSearchAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivesearchad). |\n\n`expandedTextAd()`\n------------------\n\nReturns the ad as an [ExpandedTextAd](/google-ads/scripts/docs/reference/adsapp/adsapp_expandedtextad). Calling this on an ad of a different type will result in an error.\n\n### Return values:\n\n| Type | Description |\n|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| [AdsApp.ExpandedTextAd](/google-ads/scripts/docs/reference/adsapp/adsapp_expandedtextad) | The ad as an [ExpandedTextAd](/google-ads/scripts/docs/reference/adsapp/adsapp_expandedtextad). |\n\n`imageAd()`\n-----------\n\nReturns the ad as an [ImageAd](/google-ads/scripts/docs/reference/adsapp/adsapp_imagead). Calling this on an ad of a different type will result in an error.\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------|\n| [AdsApp.ImageAd](/google-ads/scripts/docs/reference/adsapp/adsapp_imagead) | The ad as an [ImageAd](/google-ads/scripts/docs/reference/adsapp/adsapp_imagead). |\n\n`responsiveDisplayAd()`\n-----------------------\n\nReturns the ad as a [ResponsiveDisplayAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivedisplayad). Calling this on an ad of a different type will result in an error.\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [AdsApp.ResponsiveDisplayAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivedisplayad) | The ad as a [ResponsiveDisplayAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivedisplayad). |\n\n`responsiveSearchAd()`\n----------------------\n\nReturns the ad as a [ResponsiveSearchAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivesearchad). Calling this on an ad of a different type will result in an error.\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| [AdsApp.ResponsiveSearchAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivesearchad) | The ad as a [ResponsiveSearchAd](/google-ads/scripts/docs/reference/adsapp/adsapp_responsivesearchad). |"]]