Revenus publicitaires
Rapport sur les revenus publicitaires de niveau impressions par SDK
The app sends impression revenue data to the SDK which then sends it to AppsFlyer. The revenue data is collected and processed in AppsFlyer, and the revenue is attributed to the original UA source. To learn more about ad revenue see here.
There are two ways for the SDK to generate an ad revenue event, depending on your SDK version. Use the correct method for your SDK version:
- For SDK 6.15.0 and above. Uses the ad revenue SDK API.
- For SDK 6.14.2 and below. Uses the ad revenue SDK connector.
Log ad revenue (for SDK 6.15.0 and above)
When an impression with revenue occurs, invoke the logAdRevenue
method with the revenue details of the impression.
Remarque
If you are using the AdRevenue connector, please remove it before switching to the new
logAdRevenue
method. Failing to do so may cause unexpected behavior.
To implement the method:
- Create an instance of
AFAdRevenueData
with the revenue details of the impression to be logged.Version 6.15.0 of the SDK removes the need for using a connector for sending Ad Revenue data to AppsFlyer. - If you want to add additional details to the ad revenue event, populate a map with key-value pairs.
- Invoke the
logAdRevenue
method with the following arguments:- The
AFAdRevenueData
object you created in step 1. - The
Map
instance with the additional details you created in step 2.
- The
Code Example
import com.appsflyer.AFAdRevenueData;
import com.appsflyer.MediationNetwork;
import com.appsflyer.AppsFlyerLib;
import java.util.HashMap;
import java.util.Map;
AppsFlyerLib appsflyer = AppsFlyerLib.getInstance();
// Create an instance of AFAdRevenueData
AFAdRevenueData adRevenueData = new AFAdRevenueData(
"ironsource", // monetizationNetwork
MediationNetwork.GOOGLE_ADMOB, // mediationNetwork
"USD", // currencyIso4217Code
123.45 // revenue
);
Map<String, Object> additionalParameters = new HashMap<>();
additionalParameters.put(AdRevenueScheme.COUNTRY, "US");
additionalParameters.put(AdRevenueScheme.AD_UNIT, "89b8c0159a50ebd1");
additionalParameters.put(AdRevenueScheme.AD_TYPE, "Banner");
additionalParameters.put(AdRevenueScheme.PLACEMENT, "place");
appsflyer.logAdRevenue(adRevenueData, additionalParameters);
Remarque
The AdMob iLTV SDK reports impression revenue in micro-units. To display the correct ad revenue amount in USD in AppsFlyer, divide the amount extracted from the iLTV event handler by 1 million before sending it to AppsFlyer.
[LEGACY] Log ad revenue (for SDK 6.14.2 and below)
For SDK v6.14.2 and below - the AdRevenue Connector should be used along side the AppsFlyer SDK to send Ad Revenue data to AppsFlyer.
Import the Android ad revenue SDK
- Ajoutez le code suivant au niveau du module /app/build.gradle et avant les dépendances :
repositories {
mavenCentral()
}
- Ajoutez la bibliothèque Ad Revenue comme dépendance :
dependencies {
implementation 'com.appsflyer:adrevenue:6.9.0'
}
- Synchronisez le projet pour récupérer les dépendances.
Initialize the Android ad revenue SDK
- Dans la classe globale de l’app, au sein de la méthode
onCreate
comme méthode, appelezinitialize
, et insérez le code suivant :
import com.appsflyer.adrevenue.AppsFlyerAdRevenue;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AppsFlyerAdRevenue.Builder afRevenueBuilder = new AppsFlyerAdRevenue.Builder(this);
AppsFlyerAdRevenue.initialize(afRevenueBuilder.build());
}
}
Trigger the logAdRevenue API call
- Déclenchez l'appel
logAdRevenue
API à chaque impression valide, ce qui inclut les arguments obligatoires et facultatifs.
// Make sure you import the following:
import com.appsflyer.adrevenue.adnetworks.AppsFlyerAdNetworkEventType;
import com.appsflyer.adrevenue.adnetworks.generic.MediationNetwork;
import com.appsflyer.adrevenue.adnetworks.generic.Scheme;
import java.util.Currency;
import java.util.HashMap;
import java.util.Locale;
// Create optional customParams
Map<String, String> customParams = new HashMap<>();
customParams.put(Scheme.COUNTRY, "US");
customParams.put(Scheme.AD_UNIT, "89b8c0159a50ebd1");
customParams.put(Scheme.AD_TYPE, "Banner");
customParams.put(Scheme.PLACEMENT, "place");
customParams.put(Scheme.ECPM_PAYLOAD, "encrypt");
customParams.put("foo", "test1");
customParams.put("bar", "test2");
// Record a single impression
AppsFlyerAdRevenue.logAdRevenue(
"ironsource",
MediationNetwork.googleadmob,
Currency.getInstance(Locale.US),
0.99,
customParams
);
Mis(e) à jour il y a environ 1 mois