> ## Documentation Index
> Fetch the complete documentation index at: https://beta-guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Native Ads

> Implement native ads in your Unity project.

## Native Ad Format

* Ads rendered inside your app UI.
* Attach `DaroNativeAdView` to a Unity UI prefab and wire slots, or read `DaroNativeAd.Info` directly into custom UI.

***

## Integrating Ads

<Steps>
  <Step title="Prepare Native Ad View">
    Add `DaroNativeAdView` to the Unity UI prefab root. Wire `TitleText`, `BodyText`, `IconImage`, `CtaButton`, and `MediaContainer`.

    `MediaContainer` is optional. When the bound ad has no media asset, `DaroNativeAdView` hides `MediaContainer` automatically.

    `Bind(ad)` also connects `CtaButton` taps to the native click flow on Android and iOS.
  </Step>

  <Step title="Create Ad Instance">
    ```csharp theme={null}
    private DaroNativeAd ad;
    [SerializeField] private DaroNativeAdView adView;

    ad = new DaroNativeAd("your-native-ad-unit-id");
    ```
  </Step>

  <Step title="Register Event Handlers">
    ```csharp theme={null}
    ad.OnAdLoaded += info => adView.Bind(ad);
    ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
    ad.OnAdImpression += info => Debug.Log("impression");
    ad.OnAdClicked += info => Debug.Log("clicked");
    ```
  </Step>

  <Step title="Load Ad">
    ```csharp theme={null}
    adView.LoadFor(ad);
    ```
  </Step>

  <Step title="Dispose Ad">
    ```csharp theme={null}
    adView.Unbind();
    ad?.Dispose();
    ad = null;
    ```
  </Step>
</Steps>

<Tip>
  When rendering `DaroNativeAd.Info` in custom UI instead of using `DaroNativeAdView`, call `ad.NotifyClicked()` from the CTA button handler.
</Tip>

<Warning>
  `Info.Icon` and `Info.MediaImage` textures are owned by `DaroNativeAd` and are released when the ad reloads or is disposed. Do not retain or reuse those textures after `Unbind()` and `Dispose()`.
</Warning>

***

## Example

```csharp expandable theme={null}
using Daro;
using UnityEngine;

public sealed class NativeAdHost : MonoBehaviour
{
    [SerializeField] private string adUnitId = "your-native-ad-unit-id";
    [SerializeField] private DaroNativeAdView adView;
    private DaroNativeAd ad;

    private void OnEnable()
    {
        ad = new DaroNativeAd(adUnitId);
        ad.OnAdLoaded += info => adView.Bind(ad);
        ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
        adView.LoadFor(ad);
    }

    private void OnDisable()
    {
        adView.Unbind();
        ad?.Dispose();
        ad = null;
    }
}
```
