Wenn Sie sich mit anderen Nutzern über unsere Produkte austauschen und Feedback geben möchten, treten Sie dem offiziellen Ad Manager-Discord-Kanal auf dem Server der Google Advertising and Measurement Community bei.
Benutzerdefiniert gerenderte native Anzeigen werden über GADAdLoader-Objekte geladen. Das GADAdLoader-Objekt kann auch so konfiguriert werden, dass Anzeigenanfragen gestellt werden, die entweder zu einer Banner- oder einer nativen Anzeige führen können. Wenn Sie GADAdLoaderAdTypeGAMBanner dem Array-Parameter adTypes zusammen mit nativen Anzeigentypen wie GADAdLoaderAdTypeNative beim Erstellen des GADAdLoader-Objekts hinzufügen, wird angegeben, dass Banneranzeigen mit nativen Anzeigen konkurrieren sollen, um die Anfrage zu erfüllen.
Wenn Sie Banneranzeigen über die GADAdLoader anfordern, muss der Ad Loader-Delegate dem GAMBannerAdLoaderDelegate-Protokoll entsprechen. Dieses Protokoll enthält eine Nachricht, die gesendet wird, wenn eine Banneranzeige geladen wurde:
Der Anzeigen-Loader-Delegate muss auch angeben, welche Banneranzeigengrößen angefordert werden sollen. Dazu muss er wie unten dargestellt auf die validBannerSizesForAdLoader-Nachricht antworten.
Wenn Sie die manuelle Zählung von Impressionen für Banneranzeigen aktivieren möchten, die über GADAdLoader geladen werden, legen Sie beim Initialisieren von GADAdLoader ein GAMBannerViewOptions mit enableManualImpressions auf YES fest.
Wenn eine Banneranzeige geladen wird, können Sie recordManualImpression aufrufen, wenn Sie feststellen, dass eine Anzeige erfolgreich zurückgegeben wurde und auf dem Bildschirm angezeigt wird, um eine Impression manuell auszulösen:
[null,null,["Zuletzt aktualisiert: 2025-08-27 (UTC)."],[[["\u003cp\u003eYou can combine native and banner ads in your ad requests by including both \u003ccode\u003eGADAdLoaderAdTypeNative\u003c/code\u003e and \u003ccode\u003eGADAdLoaderAdTypeGAMBanner\u003c/code\u003e when creating a \u003ccode\u003eGADAdLoader\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eTo receive banner ads through a \u003ccode\u003eGADAdLoader\u003c/code\u003e, your ad loader delegate must conform to the \u003ccode\u003eGAMBannerAdLoaderDelegate\u003c/code\u003e protocol and specify the desired banner ad sizes.\u003c/p\u003e\n"],["\u003cp\u003eWhen loading banner ads via \u003ccode\u003eGADAdLoader\u003c/code\u003e, manual impression counting can be enabled using \u003ccode\u003eGAMBannerViewOptions\u003c/code\u003e and calling \u003ccode\u003erecordManualImpression\u003c/code\u003e when the ad is displayed.\u003c/p\u003e\n"],["\u003cp\u003eRemember that banner ads loaded through \u003ccode\u003eGADAdLoader\u003c/code\u003e will not refresh and that requesting banners alone requires following the separate banner guide.\u003c/p\u003e\n"]]],[],null,["With a few changes to your code, you can combine native and banner ads in your\nad requests.\n\nPrerequisites\n\n- Version 7.20.0 or higher of the Google Mobile Ads SDK\n- Complete the [Get Started](/ad-manager/mobile-ads-sdk/ios/quick-start) guide\n\nLoading an ad\n\nCustom-rendered native ads are loaded via\n[`GADAdLoader`](/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADAdLoader)\nobjects. The `GADAdLoader` object can also be configured to make ad requests\nthat can result in either a banner or native ad. Adding\n`GADAdLoaderAdTypeGAMBanner` to the `adTypes` array parameter, along with\nnative ad types such as `GADAdLoaderAdTypeNative` when creating the\n`GADAdLoader` object specifies that banner ads should compete with native ads\nto fill the request. \n\nSwift \n\n```swift\nadLoader = GADAdLoader(adUnitID: \"/21775744923/example/native-and-banner\",\n rootViewController: self,\n adTypes: [.native, .gamBanner],\n options: [... ad loader options objects ...])\nadLoader.delegate = self\n```\n\nObjective-C \n\n```objective-c\nself.adLoader = [[GADAdLoader alloc]\n initWithAdUnitID:@\"/21775744923/example/native-and-banner\"\n rootViewController:rootViewController\n adTypes:@[ GADAdLoaderAdTypeNative, GADAdLoaderAdTypeGAMBanner ]\n options:@[ ... ad loader options objects ... ]];\nself.adLoader.delegate = self;\n```\n| **Note:** Banner ads can only be loaded via `GADAdLoader` objects when requested alongside native ads. To make an ad request for banners alone, follow the steps outlined in the in the [banner guide](/ad-manager/mobile-ads-sdk/ios/banner). In addition, banners loaded via `GADAdLoader` objects will not refresh.\n\nGAMBannerAdLoaderDelegate\n\nWhen requesting banner ads via the `GADAdLoader`, the ad loader delegate must\nconform to the `GAMBannerAdLoaderDelegate` protocol. This protocol includes a\nmessage that's sent when a banner ad has loaded: \n\nSwift \n\n```swift\npublic func adLoader(_ adLoader: GADAdLoader,\n didReceive GAMBannerView: GAMBannerView)\n```\n\nObjective-C \n\n```objective-c\n- (void)adLoader:(GADAdLoader *)adLoader didReceiveGAMBannerView:(GAMBannerView *)bannerView;\n```\n\nThe ad loader delegate must also specify which banner ad sizes should be\nrequested by responding to the `validBannerSizesForAdLoader` message as shown\nbelow. \n\nSwift \n\n```swift\npublic func validBannerSizes(for adLoader: GADAdLoader) -\u003e [NSValue] {\n return [NSValueFromGADAdSize(GADAdSizeBanner),\n NSValueFromGADAdSize(GADAdSizeMediumRectangle),\n NSValueFromGADAdSize(GADAdSizeFromCGSize(CGSize(width: 120, height: 20)))]\n}\n```\n\nObjective-C \n\n```objective-c\n- (NSArray *)validBannerSizesForAdLoader:(GADAdLoader *)adLoader {\n return @[\n @(GADAdSizeBanner),\n @(GADAdSizeMediumRectangle),\n @(GADAdSizeFromCGSize(CGSizeMake(120, 20)))\n ];\n}\n```\n| **Note:** Don't create your own `GADAdSize` directly. Use one of the predefined ad sizes (such as `GADAdSizeBanner`), or create one using the `GADAdSizeFromCGSize` method, as shown above.\n\nManual impression counting\n\nTo enable [manual impression\ncounting](/ad-manager/mobile-ads-sdk/ios/banner#manual_impression_counting)\non banner ads loaded through `GADAdLoader`, set a\n[`GAMBannerViewOptions`](/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GAMBannerViewOptions)\nwith `enableManualImpressions` set to `YES` when initializing `GADAdLoader`. \n\nSwift \n\n```swift\nlet bannerViewOptions = GAMBannerViewOptions()\nbannerViewOptions.enableManualImpressions = true\nadLoader = GADAdLoader(\n adUnitID: \"/21775744923/example/native-and-banner\", rootViewController: self,\n adTypes: [.native, .gamBanner], options: [bannerViewOptions])\n```\n\nObjective-C \n\n```objective-c\nGAMBannerViewOptions *bannerViewOptions = [[GAMBannerViewOptions alloc] init];\nbannerViewOptions.enableManualImpressions = YES;\nself.adLoader = [[GADAdLoader alloc]\n initWithAdUnitID:@\"/21775744923/example/native-and-banner\"\n rootViewController:self\n adTypes:@[ GADAdLoaderAdTypeNative, GADAdLoaderAdTypeGAMBanner ]\n options:@[ bannerViewOptions ]];\n```\n\nIf a banner ad loads, you can call `recordManualImpression` when you\ndetermine that an ad has been successfully returned and is on-screen to\nmanually fire an impression: \n\nSwift \n\n```swift\nbannerView.recordImpression()\n```\n\nObjective-C \n\n```objective-c\n[self.bannerView recordImpression];\n```"]]