Skip to content

Revenue reporting

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 listener for each ad format, as shown in the example below:

function onRevenuePaid(event) {
// The ad has generated revenue
const data = event.nativeEvent;
}
<WortiseBanner
...
onRevenuePaid={onRevenuePaid}
/>

In banners, the listener receives a native event and the revenue data is found in its nativeEvent property. In the rest of the formats, the listener that is registered with addEventListener (onInterstitialRevenuePaid, onRewardedRevenuePaid, onAppOpenRevenuePaid and onNativeRevenuePaid) directly receives the data.

The data is an object that contains the following fields:

FieldTypeDescription
revenueObjectThe revenue generated by the ad
sourceStringThe revenue source

In addition, the revenue object contains the following fields that represent the revenue:

FieldTypeDescription
currencyStringThe currency corresponding to the revenue
precisionStringThe accuracy of the information. It can be ESTIMATED, PRECISE or PUBLISHER_DEFINED
valuedoubleThe revenue value

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

import analytics from '@react-native-firebase/analytics';
function onRevenuePaid(event) {
const { revenue, source } = event.nativeEvent;
const { currency, precision, value } = revenue;
analytics().logEvent('ad_revenue', {
currency,
precision,
source,
value
});
}
<WortiseBanner
...
onRevenuePaid={onRevenuePaid}
/>