Smart Banners
Stay organized with collections
Save and categorize content based on your preferences.
Select platform:
Android
iOS
Unity
Smart Banners are ad units that render screen-width banner ads on any screen
size across different devices in either orientation. Smart Banners detect the
width of the device in its current orientation and create the ad view that size.
Smart Banners on iPhones have a height of 50 points in portrait and 32 points in
landscape. On iPads, height is 90 points in both portrait and landscape.
When an image ad isn't large enough to take up the entire allotted space, the
image will be centered, and the space on either side will be filled in.

To use Smart Banners, just specify kGADAdSizeSmartBannerPortrait
(for portait orientation) or kGADAdSizeSmartBannerLandscape
(for landscape
orientation) for the ad size:
Swift
let bannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
Objective-C
GADBannerView *bannerView = [[GADBannerView alloc]
initWithAdSize:kGADAdSizeSmartBannerPortrait];
Since the addition of the safe area for iOS 11, for full-width banners you
should also add constraints for the edges of the banner to the edges of the
safe area. Here is a code snippet showing how to do this:
Swift
func addBannerViewToView(_ bannerView: GADBannerView) {
bannerView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(bannerView)
if #available(iOS 11.0, *) {
// In iOS 11, we need to constrain the view to the safe area.
positionBannerViewFullWidthAtBottomOfSafeArea(bannerView)
}
else {
// In lower iOS versions, safe area is not available so we use
// bottom layout guide and view edges.
positionBannerViewFullWidthAtBottomOfView(bannerView)
}
}
// MARK: - view positioning
@available (iOS 11, *)
func positionBannerViewFullWidthAtBottomOfSafeArea(_ bannerView: UIView) {
// Position the banner. Stick it to the bottom of the Safe Area.
// Make it constrained to the edges of the safe area.
let guide = view.safeAreaLayoutGuide
NSLayoutConstraint.activate([
guide.leftAnchor.constraint(equalTo: bannerView.leftAnchor),
guide.rightAnchor.constraint(equalTo: bannerView.rightAnchor),
guide.bottomAnchor.constraint(equalTo: bannerView.bottomAnchor)
])
}
func positionBannerViewFullWidthAtBottomOfView(_ bannerView: UIView) {
view.addConstraint(NSLayoutConstraint(item: bannerView,
attribute: .leading,
relatedBy: .equal,
toItem: view,
attribute: .leading,
multiplier: 1,
constant: 0))
view.addConstraint(NSLayoutConstraint(item: bannerView,
attribute: .trailing,
relatedBy: .equal,
toItem: view,
attribute: .trailing,
multiplier: 1,
constant: 0))
view.addConstraint(NSLayoutConstraint(item: bannerView,
attribute: .bottom,
relatedBy: .equal,
toItem: bottomLayoutGuide,
attribute: .top,
multiplier: 1,
constant: 0))
}
Objective-C
- (void)addBannerViewToView:(UIView *)bannerView {
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:bannerView];
if (@available(ios 11.0, *)) {
// In iOS 11, we need to constrain the view to the safe area.
[self positionBannerViewFullWidthAtBottomOfSafeArea:bannerView];
} else {
// In lower iOS versions, safe area is not available so we use
// bottom layout guide and view edges.
[self positionBannerViewFullWidthAtBottomOfView:bannerView];
}
}
#pragma mark - view positioning
- (void)positionBannerViewFullWidthAtBottomOfSafeArea:(UIView *_Nonnull)bannerView NS_AVAILABLE_IOS(11.0) {
// Position the banner. Stick it to the bottom of the Safe Area.
// Make it constrained to the edges of the safe area.
UILayoutGuide *guide = self.view.safeAreaLayoutGuide;
[NSLayoutConstraint activateConstraints:@[
[guide.leftAnchor constraintEqualToAnchor:bannerView.leftAnchor],
[guide.rightAnchor constraintEqualToAnchor:bannerView.rightAnchor],
[guide.bottomAnchor constraintEqualToAnchor:bannerView.bottomAnchor]
]];
}
- (void)positionBannerViewFullWidthAtBottomOfView:(UIView *_Nonnull)bannerView {
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeading
multiplier:1
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeTrailing
multiplier:1
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.bottomLayoutGuide
attribute:NSLayoutAttributeTop
multiplier:1
constant:0]];
}
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-09-02 UTC.
[null,null,["Last updated 2025-09-02 UTC."],[[["\u003cp\u003eSmart Banners are responsive ad units that adjust their size to fit the width of the device's screen, spanning the full width in either portrait or landscape orientation.\u003c/p\u003e\n"],["\u003cp\u003eOn iPhones, Smart Banners have a height of 50 points in portrait and 32 points in landscape; on iPads, the height is consistently 90 points in both orientations.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to use the newer adaptive banners instead of Smart Banners for better ad performance and user experience.\u003c/p\u003e\n"],["\u003cp\u003eFor full-width banners, especially with iOS 11 and later, constraints should be added to align the banner edges with the safe area edges for optimal display.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/admob/android/banner/smart \"View this page for the Android platform docs.\") [iOS](/admob/ios/banner/smart \"View this page for the iOS platform docs.\") [Unity](/admob/unity/banner/smart \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\n| Try the newer [adaptive banners](/admob/ios/banner/anchored-adaptive) instead.\n\nSmart Banners are ad units that render screen-width banner ads on any screen\nsize across different devices in either orientation. Smart Banners detect the\nwidth of the device in its current orientation and create the ad view that size.\n\nSmart Banners on iPhones have a height of 50 points in portrait and 32 points in\nlandscape. On iPads, height is 90 points in both portrait and landscape.\n\nWhen an image ad isn't large enough to take up the entire allotted space, the\nimage will be centered, and the space on either side will be filled in.\n\nTo use Smart Banners, just specify `kGADAdSizeSmartBannerPortrait`\n(for portait orientation) or `kGADAdSizeSmartBannerLandscape` (for landscape\norientation) for the ad size: \n\nSwift \n\n```swift\nlet bannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)\n```\n\nObjective-C \n\n```objective-c\nGADBannerView *bannerView = [[GADBannerView alloc]\n initWithAdSize:kGADAdSizeSmartBannerPortrait];\n```\n\nSince the addition of the safe area for iOS 11, for full-width banners you\nshould also add constraints for the edges of the banner to the edges of the\nsafe area. Here is a code snippet showing how to do this: \n\nSwift \n\n```swift\nfunc addBannerViewToView(_ bannerView: GADBannerView) {\n bannerView.translatesAutoresizingMaskIntoConstraints = false\n view.addSubview(bannerView)\n if #available(iOS 11.0, *) {\n // In iOS 11, we need to constrain the view to the safe area.\n positionBannerViewFullWidthAtBottomOfSafeArea(bannerView)\n }\n else {\n // In lower iOS versions, safe area is not available so we use\n // bottom layout guide and view edges.\n positionBannerViewFullWidthAtBottomOfView(bannerView)\n }\n}\n\n// MARK: - view positioning\n@available (iOS 11, *)\nfunc positionBannerViewFullWidthAtBottomOfSafeArea(_ bannerView: UIView) {\n // Position the banner. Stick it to the bottom of the Safe Area.\n // Make it constrained to the edges of the safe area.\n let guide = view.safeAreaLayoutGuide\n NSLayoutConstraint.activate([\n guide.leftAnchor.constraint(equalTo: bannerView.leftAnchor),\n guide.rightAnchor.constraint(equalTo: bannerView.rightAnchor),\n guide.bottomAnchor.constraint(equalTo: bannerView.bottomAnchor)\n ])\n}\n\nfunc positionBannerViewFullWidthAtBottomOfView(_ bannerView: UIView) {\n view.addConstraint(NSLayoutConstraint(item: bannerView,\n attribute: .leading,\n relatedBy: .equal,\n toItem: view,\n attribute: .leading,\n multiplier: 1,\n constant: 0))\n view.addConstraint(NSLayoutConstraint(item: bannerView,\n attribute: .trailing,\n relatedBy: .equal,\n toItem: view,\n attribute: .trailing,\n multiplier: 1,\n constant: 0))\n view.addConstraint(NSLayoutConstraint(item: bannerView,\n attribute: .bottom,\n relatedBy: .equal,\n toItem: bottomLayoutGuide,\n attribute: .top,\n multiplier: 1,\n constant: 0))\n}\n```\n\nObjective-C \n\n```objective-c\n- (void)addBannerViewToView:(UIView *)bannerView {\n bannerView.translatesAutoresizingMaskIntoConstraints = NO;\n [self.view addSubview:bannerView];\n if (@available(ios 11.0, *)) {\n // In iOS 11, we need to constrain the view to the safe area.\n [self positionBannerViewFullWidthAtBottomOfSafeArea:bannerView];\n } else {\n // In lower iOS versions, safe area is not available so we use\n // bottom layout guide and view edges.\n [self positionBannerViewFullWidthAtBottomOfView:bannerView];\n }\n}\n\n#pragma mark - view positioning\n\n- (void)positionBannerViewFullWidthAtBottomOfSafeArea:(UIView *_Nonnull)bannerView NS_AVAILABLE_IOS(11.0) {\n // Position the banner. Stick it to the bottom of the Safe Area.\n // Make it constrained to the edges of the safe area.\n UILayoutGuide *guide = self.view.safeAreaLayoutGuide;\n\n [NSLayoutConstraint activateConstraints:@[\n [guide.leftAnchor constraintEqualToAnchor:bannerView.leftAnchor],\n [guide.rightAnchor constraintEqualToAnchor:bannerView.rightAnchor],\n [guide.bottomAnchor constraintEqualToAnchor:bannerView.bottomAnchor]\n ]];\n}\n\n- (void)positionBannerViewFullWidthAtBottomOfView:(UIView *_Nonnull)bannerView {\n [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView\n attribute:NSLayoutAttributeLeading\n relatedBy:NSLayoutRelationEqual\n toItem:self.view\n attribute:NSLayoutAttributeLeading\n multiplier:1\n constant:0]];\n [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView\n attribute:NSLayoutAttributeTrailing\n relatedBy:NSLayoutRelationEqual\n toItem:self.view\n attribute:NSLayoutAttributeTrailing\n multiplier:1\n constant:0]];\n [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView\n attribute:NSLayoutAttributeBottom\n relatedBy:NSLayoutRelationEqual\n toItem:self.bottomLayoutGuide\n attribute:NSLayoutAttributeTop\n multiplier:1\n constant:0]];\n}\n```"]]