> For the complete documentation index, see [llms.txt](https://docs.wortise.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wortise.com/ios-sdk/integracion-del-sdk/native-google.md).

# Native (Google)

Los anuncios nativos son un tipo de anuncio que puede ser mostrado con el mismo estilo visual del resto de la app, lo que permite una integración natural y no-intrusiva con la interfaz de usuario.

Actualmente, desde Wortise ofrecemos la posibilidad de utilizar los anuncios nativos de la plataforma de anuncios de Google ("*Native Advanced*"), de una manera directa y sencilla.

## Integración

Para solicitar un anuncio nativo, es necesario realizar una integración por código tal y como se muestra en el ejemplo a continuación:

{% tabs %}
{% tab title="Swift" %}

```swift
import UIKit
import WortiseSDK

class ViewController: UIViewController {
    private var nativeAd: WAGoogleNativeAd!

    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        nativeAd = WAGoogleNativeAd(adUnitId: "test-native",
                                    rootViewController: self,
                                    delegate: self)
        nativeAd.loadAd()
    }

    override func willMove(toParent controller: UIViewController?) {
        super.willMove(toParent: controller)
        ...
        nativeAd.destroy()
    }
}

extension ViewController: WAGoogleNativeDelegate {

    func didClick(nativeAd: WAGoogleNativeAd) {
        // Invocado cuando el anuncio ha sido clickeado
    }

    func didFailToLoad(nativeAd: WAGoogleNativeAd, error: WAAdError) {
        // Invocado cuando el anuncio no se ha podido cargar
        // (por error o falta de inventario)
    }

    func didLoad(nativeAd: WAGoogleNativeAd, googleNativeAd: GADNativeAd) {
        // Invocado cuando el anuncio ha sido cargado
    }
    
    func didPayRevenue(nativeAd: WAGoogleNativeAd, data: WARevenueData) {
        // Invocado cuando el anuncio ha generado un ingreso
    }

    func didRecord(impression: WAGoogleNativeAd) {
        // Invocado cuando el anuncio ha generado una impresión
    }
}
```

{% endtab %}
{% endtabs %}

Una vez el anuncio nativo ha sido cargado con éxito, obtenido como resultado una instancia de `GADNativeAd`, es necesario completar la integración siguiendo la documentación de Google al respecto: <https://developers.google.com/ad-manager/mobile-ads-sdk/ios/native/advanced?hl=es#display_a_unifiednativead>

### Especificar opciones

La clase `WAGoogleNativeAd` incluye un atributo llamado `options`, el cual permite indicar opciones personalizadas haciendo uso de la clase `GADAdLoaderOptions` de Google. Este atributo debe ser establecido antes de realizar la carga del anuncio.

A continuación se muestra un breve ejemplo de uso:

{% tabs %}
{% tab title="Swift" %}

```swift
let adOptions = GADNativeAdViewAdOptions()

// Establecer las opciones a través de "adOptions"

googleNativeAd.options = adOptions
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wortise.com/ios-sdk/integracion-del-sdk/native-google.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
