Google AdMob Ad Revenue Integration

This integration enables Airbridge to collect Google AdMob ad revenue data. The data can be shown on the Airbridge dashboard by attribution and user.

AdMob ad revenue data is collected from the AdMob SDK and sent to the Airbridge SDK. "Impression-level ad revenue" in the AdMob dashboard must be configured in order to collect data. Please make sure that the AdMob SDK is installed and that the "Impression-level ad revenue" is activated.

AdMob SDK Installation

AdMob "Impression-level ad revenue" Setup

Forwarding AdMob Ad Revenue Data to Airbridge

Please setup data callbacks to send ad revenue data to the Airbridge SDK, using the AdMob SDK.

private void RequestRewardedAd()
    RewardedAd.LoadAd(adUnitId, new AdRequest.Builder().Build(), (rewardedAd, error) => {
        if (error != null) { return; }

        this.rewardedAd = rewardedAd;
        this.rewardedAd.OnPaidEvent += this.HandleAdPaidEvent;

public void HandleAdPaidEvent(object sender, AdValueEventArgs args)
    AdValue adValue = args.AdValue;
    var adUnitId = this.rewardedAd.adUnitId;
    var adNetworkAdapter = this.rewardedAd.MediationAdapterClassName();
    AirbridgeEvent @event = new AirbridgeEvent("airbridge.adImpression");

    var admob = new Dictionary<string, object>();
    admob["value_micros"] = adValue.Value;
    admob["currency_code"] = adValue.CurrencyCode;
    admob["precision"] = adValue.Precision;
    admob["ad_unit_id"] = adUnitId;
    admob["ad_network_adapter"] = adNetworkAdapter;
    var adPartners = new Dictionary<string, object>();
    adPartners["admob"] = admob;
    @event.AddSemanticAttribute("adPartners", adPartners);
import GoogleMobileAds
import AirBridge
import UIKit

class ViewController: UIViewController {
    var rewardedAd: GADRewardedAd? = nil
    func requestRewardedAd() {
        let request = GADRequest()
            withAdUnitID: "ad unit ID",
            request: request
        ) { ad, error in
            if let error {
                print("Rewarded ad failed to load with error: \(error.localizedDescription)")
            self.rewardedAd = ad
            self.rewardedAd?.paidEventHandler = { value in
                let (value, currencyCode, precision) = (
                let adUnitID = self.rewardedAd?.adUnitID
                let adNetworkAdapter = self.rewardedAd?.responseInfo.adNetworkClassName
                let event = ABInAppEvent()
                    "adPartners": [
                        "admob": [
                            "value_micros": value,
                            "currency_code": currencyCode,
                            "precision": precision,
                            "ad_unit_id": adUnitID ?? NSNull(),
                            "ad_network_adapter": adNetworkAdapter ?? NSNull(),

@import GoogleMobileAds;
@import UIKit;

@interface ViewController ()
@property(nonatomic, strong) GADRewardedAd *rewardedAd;

@implementation ViewController
- (void)requestRewardedAd {
    __weak ViewController *weakSelf = self;

    GADRequest *request = [GADRequest request];
    [GADRewardedAd loadWithAdUnitID:@"ad unit ID"
                  completionHandler:^(GADRewardedAd *ad, NSError *error) 
        if (error) {
            NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]);
        self.rewardedAd = ad;
        self.rewardedAd.paidEventHandler = ^void(GADAdValue *_Nonnull value){
            ViewController *strongSelf = weakSelf;

            // Extract the impression-level ad revenue data.
            NSDecimalNumber *value; = value.value;
            NSString *currencyCode = value.currencyCode;
            GADAdValuePrecision precision = value.precision;

            // Get the ad unit ID.
            NSString *adUnitId = strongSelf.rewardedAd.adUnitID;
            NSString *adNetworkAdapter = strongSelf.rewardedAd.adNetworkClassName;

            ABInAppEvent* event = [[ABInAppEvent alloc] init];
            [event setCategory:@"airbridge.adImpression"];
            [event setAction:adUnitId];
            [event setLabel:adNetworkAdapter];
            [event setValue:value];
            [event setSemantics:@{
                @"adPartners": @{
                    @"admob": @{
                        @"value_micros": value,
                        @"currency_code": currencyCode,
                        @"precision": precision,
                        @"ad_unit_id": adUnitId,
                        @"ad_network_adapter": adNetworkAdapter

            [event send];

public class MainActivity extends Activity {
    private RewardedAd rewardedAd;
    private final String TAG = "MainActivity";

    protected void onCreate(Bundle savedInstanceState) {
        AdRequest adRequest = new AdRequest.Builder().build();

        RewardedAd.load(this, "ad unit ID", adRequest, new RewardedAdLoadCallback(){
            public void onAdLoaded(@NonNull RewardedAd ad) {
                rewardedAd = ad;
                // Set paid event listener
                rewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
                    public void onPaidEvent(AdValue adValue) {
                        // Extract the impression-level ad revenue data.
                        long valueMicros = adValue.getValueMicros();
                        String currencyCode = adValue.getCurrencyCode();
                        String precision = adValue.getPrecisionType();

                        // Get the ad unit ID.
                        String adUnitId = rewardedAd.getAdUnitId();
                        String adNetworkAdapter = rewardedAd.getMediationAdapterClassName();
                        Event event = new Event("airbridge.adImpression");
                        Map<String, Object> admob = new HashMap<>();
                        admob.put("value_micros", valueMicros);
                        admob.put("currency_code", currencyCode);
                        admob.put("precision", precision);
                        admob.put("ad_unit_id", adUnitId);
                        admob.put("ad_network_adapter", adNetworkAdapter);
                        Map<String, Object> adPartners = new HashMap<>();
                        adPartners.put("admob", mopub);
                        Map<String, Object> semanticAttributes = new HashMap<>();
                        semanticAttributes.put("adPartners", adPartners);

class MainActivity : AppCompatActivity() {
    private var rewardedAd: RewardedAd? = null
    private final var TAG = "MainActivity"

    override fun onCreate(savedInstanceState: Bundle?) {
        AdRequest adRequest = new AdRequest.Builder().build()

        RewardedAd.load(this, "ad unit ID", adRequest, object: RewardedAdLoadCallback() {
            override fun onAdLoaded(ad: RewardedAd) {
                rewardedAd = ad
                // Set paid event listener
                rewardedAd.onPaidEventListener = OnPaidEventListener { adValue ->
                    // Extract the impression-level ad revenue data.
                    val valueMicros = adValue.valueMicros
                    val currencyCode = adValue.currencyCode
                    val precision = adValue.precisionType

                    // Get the ad unit ID.
                    val adUnitId = rewardedAd.adUnitId
                    val adNetworkAdapter = rewardedAd.mediationAdapterClassName

                    val event = Event("airbridge.adImpression")
                    val admob = mutableMapOf<String, Any?>()
                    admob["value_micros"] = valueMicros
                    admob["currency_code"] = currencyCode
                    admob["precision"] = precision
                    admob["ad_unit_id"] = adUnitId
                    admob["ad_network_adapter"] = adNetworkAdapter
                    val adPartners = mapOf("admob" to mopub)
                    event.action = adUnitId
                    event.label = adNetworkAdapter
                    event.value = valueMicros
                    event.semanticAttributes = mutableMapOf("adPartners" to adPartners)