Skip to main content
Report impression-level ad revenue back to AppsFlyer each time an ad is shown to the user. AppsFlyer attributes the revenue to the campaign that acquired the user, so you can see which channels drive the most revenue, not just the most installs.

Installation

npm install despia-native
pnpm add despia-native
yarn add despia-native
import despia from 'despia-native';

log_ad_revenue

Fire log_ad_revenue with the per-impression value your ad network reports.
const metaRevenue = {
    ad_platform: "facebook",
    currency: "USD",
    revenue: 0.008,
    ad_type: "interstitial",
    ad_unit_id: "your_unit_id"
}
despia("appsflyer://log_ad_revenue?" + new URLSearchParams(metaRevenue).toString())
ad_platform
string
required
Ad network name. Accepted values: "facebook", "tiktok", "admob".
currency
string
required
3-character ISO 4217 currency code, e.g. "USD", "EUR", "AED". Defaults to "USD" if omitted.
revenue
number
required
Revenue amount for this single ad impression. No commas or currency signs.
ad_type
string
Type of ad served: "banner", "interstitial", "rewarded", "native".
ad_unit_id
string
Your ad unit ID from the ad network.
AdMob and Google revenue is reported to AppsFlyer under Google AdMob mediation. Facebook and TikTok revenue is reported with the platform name under custom mediation. Both appear correctly in AppsFlyer’s ad revenue reporting.

Best practices

Log at impression level, one call per ad shown, with the eCPM-derived per-impression value your ad network reports. Do not batch or sum impressions in your web layer, AppsFlyer’s LTV models expect individual impressions. Keep ad_unit_id stable per placement so you can break revenue down by placement later.

Resources

NPM Package

despia-native