広告収益計測の実装

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

概要

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

広告収益は、集計レベルの粒度(API経由)またはインプレッションレベルの粒度(SDK経由)のいずれかでAppsFlyerにレポートされます。SDK経由のインプレッションレベルデータは次のような特徴があります:

  • データの更新頻度がより頻繁で、AppsFlyerでより早く利用可能になります。
  • SKAN をサポートしています。

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

Reporting ad revenue using the SDK

SDKの動作原則

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

連携

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

Import the iOS ad revenue SDK

  1. Podfile で、以下を指定します:
pod 'AppsFlyer-AdRevenue'

Important: If you have the AppsFlyerFramework pod in your Podfile, remove it to avoid a collision.

  1. ポッドの更新を実行します。

Initialize the iOS ad revenue SDK

  • In AppDelegate, in the didFinishLaunchingWithOptions method, call the AdRevenue start method using the following code:
import AppsFlyerLib
import AppsFlyerAdRevenue

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       AppsFlyerAdRevenue.start()
    }

     @objc func applicationDidBecomeActive() {
        AppsFlyerLib.shared().start()        
    }

}

Trigger the logAdRevenue API call

  • Trigger the logAdRevenue API call upon every valid impression, including mandatory, and any optional, arguments.
let adRevenueParams:[AnyHashable: Any] = [
                    kAppsFlyerAdRevenueCountry : "us",
                    kAppsFlyerAdRevenueAdUnit : "02134568",
                    kAppsFlyerAdRevenueAdType : "Banner",
                    kAppsFlyerAdRevenuePlacement : "place",
                    kAppsFlyerAdRevenueECPMPayload : "encrypt",
                    "foo" : "testcustom",
                    "bar" : "testcustom2"
                ]
                
AppsFlyerAdRevenue.shared().logAdRevenue(
    monetizationNetwork: "facebook",
    mediationNetwork: MediationNetworkType.googleAdMob,
    eventRevenue: 0.026,
    revenueCurrency: "USD",
    additionalParameters: adRevenueParams)