SDK Documentation
HomeBlogSign up
English
English
  • 🏠Homepage
  • 🧪Test Ad Units
  • Privacy
    • ✅Google Data Safety
  • Android SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
    • 🛠️ProGuard
  • iOS SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Revenue reporting
    • 🙍User consent
    • 🔓Privacy
  • Unity SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • Flutter SDK
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Native (Google)
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • React Native
    • ⌨️SDK integration
      • App Open
      • Banner
      • Interstitial
      • Rewarded
      • Targeting
      • Revenue reporting
    • 🙎User consent
    • 🔓Privacy
  • Web SDK
    • ⌨️SDK integration
Con tecnología de GitBook
En esta página
  • Implementation
  • Integration with Firebase
  1. iOS SDK
  2. SDK integration

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:

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

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

Field
Type
Description

revenue

WAAdValue

The revenue generated by the ad

source

String

The revenue source

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

Field
Type
Description

currency

String

The currency corresponding to the revenue

precision

WAAdValue.Precision

The accuracy of the information. It can be estimated, precise or publisherDefined

value

Double

The revenue value

Integration with Firebase

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

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)
}
AnteriorNative (Google)SiguienteUser consent

Última actualización hace 3 días

⌨️