Native Ad
eCPM의 통화(Currency) 단위는 USD입니다.
private final AdxNativeAdFactory.NativeAdListener mListener = new AdxNativeAdFactory.NativeAdListener() {
@Override
public void onSuccess(String s, com.adxcorp.ads.nativeads.NativeAd nativeAd) {
if (mAdxUnitId.equals(s)) {
mNativeAd = nativeAd;
mNativeAd.setOnPaidEventListener(new OnPaidEventListener() {
@Override
public void onPaidEvent(double ecpm) {
double revenue = ecpm / 1000;
// Firebase Analytics 샘플
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.AD_PLATFORM, "AD(X)");
params.putString(FirebaseAnalytics.Param.AD_FORMAT, "NativeAd");
params.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, "ADX Native Ad");
params.putDouble(FirebaseAnalytics.Param.VALUE, revenue);
params.putString(FirebaseAnalytics.Param.CURRENCY, "USD");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, params);
// AppsFlyer 샘플
Map<String, String> customParams = new HashMap<>();
customParams.put(Scheme.AD_TYPE, "NativeAd");
customParams.put("ad_unit_name", "ADX Native Ad");
AppsFlyerAdRevenue.logAdRevenue(
"AD(X)",
MediationNetwork.customMediation,
Currency.getInstance(Locale.US),
revenue,
customParams
);
}
});
}
}
@Override
public void onFailure(String s) {
}
};
private val mListener: AdxNativeAdFactory.NativeAdListener = object : AdxNativeAdFactory.NativeAdListener {
override fun onSuccess(s: String, nativeAd: NativeAd) {
mNativeAd = nativeAd
mNativeAd.setOnPaidEventListener(object : OnPaidEventListener() {
fun onPaidEvent(ecpm: Double) {
val revenue: Double = ecpm / 1000
// Firebase Analytics 샘플
firebaseAnalytics = Firebase.analytics
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION) {
param(FirebaseAnalytics.Param.AD_PLATFORM, "AD(X)")
param(FirebaseAnalytics.Param.AD_UNIT_NAME, "ADX Native Ad")
param(FirebaseAnalytics.Param.AD_FORMAT, "NativeAd")
param(FirebaseAnalytics.Param.VALUE, revenue)
param(FirebaseAnalytics.Param.CURRENCY, "USD")
}
// AppsFlyer 샘플
val customParams: MutableMap<String, String> = HashMap()
customParams[Scheme.AD_TYPE] = "NativeAd"
customParams["ad_unit_name"] = "ADX Native Ad"
AppsFlyerAdRevenue.logAdRevenue(
"AD(X)",
MediationNetwork.customMediation,
Currency.getInstance(Locale.US),
revenue,
customParams
)
}
})
}
override fun onFailure(s: String) {
}
}
Last updated