> 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/android-sdk/integracion-del-sdk/reporte-de-ingresos.md).

# Reporte de ingresos

## Implementación

Desde la versión **1.7.0**, las apps pueden recibir un reporte estimado del ingreso que previsiblemente ha sido generado por un anuncio.

Para ello, simplemente hay que implementar el listener correspondiente para cada formato de anuncio, como se muestra en el ejemplo a continuación:

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

```kotlin
val bannerAd: BannerAd

bannerAd.listener = object : BannerAd.Listener() {
    override fun onBannerRevenuePaid(ad: BannerAd, data: Revenuedata) {
        // Invocado cuando el anuncio ha generado un ingreso
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
BannerAd mBannerAd;

mBannerAd.setListener(new BannerAd.Listener() {
    @Override
    public void onBannerRevenuePaid(@NonNull BannerAd ad,
                                    @NonNull Revenuedata data) {
        // Invocado cuando el anuncio ha generado un ingreso
    }
});
```

{% endtab %}
{% endtabs %}

El listener recibe un objeto de tipo `RevenueData` que contiene los siguientes campos:

<table><thead><tr><th width="139.62109375">Campo</th><th width="140.36328125">Tipo</th><th>Descripción</th></tr></thead><tbody><tr><td><code>revenue</code></td><td><code>AdValue</code></td><td>El ingreso generado por el anuncio</td></tr><tr><td><code>source</code></td><td><code>String</code></td><td>La fuente del ingreso</td></tr></tbody></table>

Además, la clase `AdValue` contiene los siguientes campos que representan al ingreso:

<table><thead><tr><th width="140.49609375">Campo</th><th width="190.46484375">Tipo</th><th>Descripción</th></tr></thead><tbody><tr><td><code>currency</code></td><td><code>String</code></td><td>La divisa correspondiente al ingreso </td></tr><tr><td><code>precision</code></td><td><code>AdValue.Precision</code></td><td>La precisión de la información. Puede ser <code>ESTIMATED</code>, <code>PRECISE</code> o <code>PUBLISHER_DEFINED</code></td></tr><tr><td><code>value</code></td><td><code>Double</code></td><td>El valor del ingreso</td></tr></tbody></table>

## Integración con Firebase

A continuación, se muestra un ejemplo básico para reportar la información de los ingresos a Firebase:

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

```kotlin
override func onBannerRevenuePaid(ad: BannerAd, data: RevenueData) {
    val bundle = Bundle().apply {
        putString("currency",   data.revenue.currency)
        putString("precision",  data.revenue.precision?.name)
        putString("source",     data.source)
        putDouble("value",      data.revenue.value)
    }

    Firebase.analytics.logEvent("ad_revenue", bundle)
}
```

{% endtab %}

{% tab title="Java" %}

<pre class="language-java"><code class="lang-java">@Override
public void onBannerRevenuePaid(@NonNull BannerAd ad,
                                @NonNull RevenueData data) {
<strong>    Bundle bundle = new Bundle();
</strong>
    bundle.putString("source", data.getSource());
    
    AdValue revenue = data.getRevenue();

    bundle.putString("currency",  revenue.getCurrency());
    bundle.putDouble("value",     revenue.getValue());
    
    AdValue.Precision precision = revenue.getPrecision();
    
    if (precision != null) {
        bundle.putString("precision", precision.name());
    }

    FirebaseAnalytics.getInstance(context).logEvent("ad_revenue", bundle);
}
</code></pre>

{% 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/android-sdk/integracion-del-sdk/reporte-de-ingresos.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.
