# 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:

```tsx
function onRevenuePaid(data) {
  // El anuncio ha sido generado un ingreso
}

<WortiseBanner
  ...
  onRevenuePaid={onRevenuePaid}
/>
```

El listener recibe como argumento un objeto que contiene los siguientes campos:

<table><thead><tr><th width="139.62109375">Campo</th><th width="175.3203125">Tipo</th><th>Descripción</th></tr></thead><tbody><tr><td><code>revenue</code></td><td><code>Object</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, el objeto `revenue` contiene los siguientes campos que representan al ingreso:

<table><thead><tr><th width="140.49609375">Campo</th><th width="174.91796875">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>String</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:

```tsx
import analytics from '@react-native-firebase/analytics';

function onRevenuePaid({ revenue, source }) {
  const { currency, precision, value } = revenue;

  analytics().logEvent('ad_revenue', {
    currency,
    precision,
    source,
    value
   });
}

<WortiseBanner
  ...
  onRevenuePaid={onRevenuePaid}
/>
```


---

# Agent Instructions: 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:

```
GET https://docs.wortise.com/react-native/integracion-del-sdk/reporte-de-ingresos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
