광고 수익
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.
참고
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);
참고
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
- 다음 코드를 모듈 수준 / app/build.gradle 파일의 dependencies 앞에 추가합니다:
repositories {
mavenCentral()
}
- 광고 수익 라이브러리를 종속 항목으로 추가합니다.
dependencies {
implementation 'com.appsflyer:adrevenue:6.9.0'
}
- 프로젝트를 동기화하여 종속성을 검색합니다.
Initialize the Android ad revenue SDK
- 앱 글로벌 클래스에서
onCreate
메서드, 호출initialize
, 다음 코드를 구현합니다:
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
- 필수 및선택적 인수를 포함하여 모든 유효한 노출에 대해
logAdRevenue
API 호출을 트리거합니다.
// 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
);
최신 데이터 약 1개월 전