Simpler Native Ads Implementation with the Unified Native Ads API
Today we're pleased to announce the release of the Unified Native Ads API, an
easier way to implement AdMob Native Ads
Advanced. This feature is now available in Google Mobile Ads for iOS, as of
version 7.28.0. The Android version will be made available in an upcoming
release.
With this feature, the existing native ad formats in Native Ads Advanced —
Using the Unified Native Ads API, you no longer need to create UIs for ad
content and app install ad formats separately. Instead you will create one UI
for unified native ads, saving you time from developing and maintaining two
separate UIs and associated code for the two previous ad formats, while still
getting the same ad demand.
Here's a short code example showing how your implementation might change when
migrating from the separate formats to the new unified format:
With the Unified Native Ads format, you still need to respect the required and recommended
assets for display, and check the availability of certain assets when
displaying the Unified Native Ad.
For detailed documentation on how to implement Unified Native Ads, refer to the
developer
documentation and the updated sample
code.
If you have any questions about this feature in the Google Mobile Ads SDK,
please drop us a line at the developer
forum.
GADNativeAppInstallAd
and
GADNativeContentAd
— are replaced by a single format,
GADUnifiedNativeAd.
The corresponding views,
GADNativeAppInstallAdView
and
GADNativeContentAdView,
are replaced by a single corresponding view,
GADUnifiedNativeAdView.
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Note here we request only `kGADAdLoaderAdTypeUnifiedNative` and no
// longer request both `kGADAdLoaderAdTypeAppInstall` and
// `kGADAdLoaderAdTypeContentAd`
self.adLoader = [[GADAdLoader alloc] initWithAdUnitID:YOUR_AD_UNIT_ID
rootViewController:self
adTypes:@[ kGADAdLoaderAdTypeUnifiedNative ]
options:nil];
self.adLoader.delegate = self;
[self.adLoader loadRequest:[GADRequest request]];
}
}
#pragma mark - GADUnifiedNativeAdLoaderDelegate
- (void)adLoader:(GADAdLoader *)adLoader
didReceiveUnifiedNativeAd:(GADUnifiedNativeAd *)nativeAd {
// A unified native ad has loaded, and can be displayed.
}
// Note that the two separate ad type delegate callbacks are no longer needed.
#pragma mark - GADNativeAppInstallAdLoaderDelegate
- (void)adLoader:(GADAdLoader *)adLoader
didReceiveNativeAppInstallAd:(GADNativeAppInstallAd *)nativeAppInstallAd {
// An app install ad has loaded, and can be displayed.
}
#pragma mark - GADNativeContentAdLoaderDelegate
- (void)adLoader:(GADAdLoader *)adLoader
didReceiveNativeContentAd:(GADNativeContentAd *)nativeContentAd {
// A content ad has loaded, and can be displayed.
}