広告収益計測の実装

SDKによるインプレッションレベルの広告収益レポート

概要:AppsFlyer広告収益SDKコネクターを使用することで、インプレッションレベルの粒度で広告収益を計測できます。

概要

広告収益レポーティングオプション

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.

このドキュメントでは、インプレッションレベルの広告収益をAppsFlyerで計測する方法について詳しく説明します。

Reporting ad revenue using the SDK

SDKの動作原則

広告収益SDKコネクタは、インプレッションの収益データをAppsFlyer SDKに送信します。広告収益イベントである af_ad_revenue が生成され、プラットフォームに送信されます。これらのインプレッションイベントは AppsFlyerで収集および処理され、収益はユーザー獲得をしたオリジナルメディアソースに紐付けられます。

連携

Android広告収益SDKコネクタを実装するには、SDKをインポート、初期化、およびトリガーする必要があります。

Import the Android ad revenue SDK

  1. 依存関係の前に、モジュールレベルの /app/build.gradle に次のコードを追加します:
repositories { 
  mavenCentral()
}
  1. Ad Revenue library(広告収益ライブラリ)を依存関係として追加します:
dependencies {
    implementation 'com.appsflyer:adrevenue:6.9.0'
}
  1. プロジェクトを同期して、dependenciesを取得します。

Initialize the Android ad revenue SDK

  • In the app global class, inside the onCreate method, call initialize, and put the following code:
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());
    }
}

```java
### Trigger the logAdRevenue API call

- Trigger the [`logAdRevenue`](https://ja.dev.appsflyer.com/hc/docs/appsflyeradrevenue#logadrevenue) API call upon every valid impression, including mandatory, and any optional, arguments.
// 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
);