Doanh thu Quảng cáo
Báo cáo doanh thu quảng cáo cấp lượt hiển thị bởi SDK
Khái quát: Trình kết nối SDK doanh thu quảng cáo AppsFlyer cho phép các mạng quảng cáo báo cáo doanh thu quảng cáo bằng cách sử dụng tính chi tiết ở cấp lượt hiển thị.
Tổng quan
Tùy chọn báo cáo doanh thu quảng cáo
Ad revenue is reported to AppsFlyer by either aggregate granularity (via API) or impression-level granularity (via SDK). Impression-level data via SDK has better data freshness and earlier availability in AppsFlyer.
Tài liệu này trình bày chi tiết cách gửi doanh thu quảng cáo cấp lượt hiển thị do các đối tác trong ứng dụng cung cấp tới cho AppsFlyer.
Reporting ad revenue using the SDK
Nguyên lý hoạt động của SDK
Trình kết nối SDK doanh thu quảng cáo gửi dữ liệu doanh thu theo lượt hiển thị đến SDK AppsFlyer. Một sự kiện doanh thu quảng cáo, af_ad_revenue, được tạo và gửi đến nền tảng. Các sự kiện hiển thị này được thu thập và xử lý trong AppsFlyer và doanh thu được phân bổ cho nguồn UA ban đầu.
Tích hợp
Để tích hợp trình kết nối SDK doanh thu quảng cáo Android, bạn cần nhập, khởi chạy và kích hoạt SDK.
Import the Android ad revenue SDK
- Thêm mã sau vào cấp Mô-đun /app/build.gradle trước phần phụ thuộc:
repositories {
mavenCentral()
}
- Thêm thư viện Doanh thu Quảng cáo dưới dạng phần phụ thuộc:
dependencies {
implementation 'com.appsflyer:adrevenue:6.9.0'
}
- Đồng bộ dự án để truy xuất các phần phụ thuộc.
Initialize the Android ad revenue SDK
- Trong lớp chung của ứng dụng, bên trong
onCreate
, gọi rainitialize
, và nhập mã sau:
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
- Kích hoạt
logAdRevenue
lệnh gọi API mỗi khi có lượt hiển thị hợp lệ, bao gồm cả đối số bắt buộc và không bắt buộc bất kỳ nào.
// 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, AppsFlyerAdNetworkEventType.BANNER.toString());
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
);
Đã cập nhật 8 ngày trước