Para analizar nuestros productos y proporcionar comentarios sobre ellos, únete al canal oficial de Ad Manager en Discord, en el servidor Google Advertising and Measurement Community.
Los anuncios nativos renderizados de forma personalizada se cargan a través de objetos GADAdLoader. El objeto GADAdLoader también se puede configurar para realizar solicitudes de anuncios que pueden generar un anuncio de banner o un anuncio nativo. Agregar GADAdLoaderAdTypeGAMBanner al parámetro de array adTypes, junto con tipos de anuncios nativos como GADAdLoaderAdTypeNative cuando se crea el objeto GADAdLoader, especifica que los anuncios gráficos deben competir con los anuncios nativos para completar la solicitud.
Cuando se solicitan anuncios de banner a través de GADAdLoader, el delegado del cargador de anuncios debe cumplir con el protocolo GAMBannerAdLoaderDelegate. Este protocolo incluye un mensaje que se envía cuando se carga un anuncio de banner:
El delegado del cargador de anuncios también debe especificar qué tamaños de anuncios de banner se deben solicitar respondiendo al mensaje validBannerSizesForAdLoader como se muestra a continuación.
Para habilitar el recuento manual de impresiones en los anuncios de banner cargados a través de GADAdLoader, establece un GAMBannerViewOptions con enableManualImpressions establecido en YES cuando inicialices GADAdLoader.
Si se carga un banner, puedes llamar a recordManualImpression cuando determines que se devolvió un anuncio correctamente y que está en pantalla para activar manualmente una impresión:
[null,null,["Última actualización: 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```"]]