> 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/en/ios-sdk/sdk-integration/revenue-reporting.md).

# Revenue reporting

## Implementation

Since version **1.7.0**, apps can receive an estimated revenue that has likely been generated by an ad.

To do this, it is just needed to implement the corresponding delegate for each ad format, as shown in the example below:

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

```swift
extension ViewController : WABannerDelegate {   
    func didPayRevenue(bannerAd: WABannerAd, data: WARevenueData) {
        // Invoked when the ad has generated revenue
    }
}
```

{% endtab %}
{% endtabs %}

The delegate receives an object of type `WARevenueData` that contains the following fields:

<table><thead><tr><th width="139.62109375">Field</th><th width="140.36328125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>revenue</code></td><td><code>WAAdValue</code></td><td>The revenue generated by the ad</td></tr><tr><td><code>source</code></td><td><code>String</code></td><td>The revenue source</td></tr></tbody></table>

In addition, the `WAAdValue` class contains the following fields that represent the revenue:

<table><thead><tr><th width="140.49609375">Field</th><th width="199.546875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>currency</code></td><td><code>String</code></td><td>The currency corresponding to the revenue</td></tr><tr><td><code>precision</code></td><td><code>WAAdValue.Precision</code></td><td>The accuracy of the information. It can be <code>estimated</code>, <code>precise</code> or <code>publisherDefined</code></td></tr><tr><td><code>value</code></td><td><code>Double</code></td><td>The revenue value</td></tr></tbody></table>

## Integration with Firebase

Below, a basic example is shown of how to report the revenue information to Firebase:

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

```kotlin
import FirebaseAnalytics

func didPayRevenue(bannerAd: WABannerAd, data: WARevenueData) {
    let params = [
        "currency":  data.revenue.currency,
        "precision": data.precision?.name,
        "source":    data.source,
        "value":     data.revenue.value
    ]

    Analytics.logEvent("ad_revenue", parameters: params)
}
```

{% endtab %}
{% endtabs %}
