Google AdMob

Note

This feature is currently in beta. For inquiries and improvement requests, contact your CSM.

Airbridge supports SDK integration with AdMob. With the integration, you can import the ad revenue into Airbridge.

SDK Integration

Click the link below and install the Google AdMob SDK.

Enable impression-level ad revenue

Enable impression-level ad revenue by referring to the article below.

Send Admob data to Airbridge

Configure data callbacks in the AdMob SDK to send ad revenue data to the Airbridge SDK.

The revenue data passed by the AdMob SDK varies depending on the platform environment. For example, for 0.005 USD, 5000 will be returned in Unity and Android, whereas 0.005 will be returned in iOS.

When using the code below, 0.005 is input as the value to the Airbridge SDK across all platforms, and 5000 in semanticAttributes.adPartners.admob.value_micros.

12345678910111213141516171819202122232425262728293031323334353637
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.SetAction(adUnitId);
    @event.SetLabel(adNetworkAdapter);
    @event.SetValue(adValue.Value / 1000000.0);
    @event.AddSemanticAttribute("adPartners", adPartners);
    @event.AddSemanticAttribute("currency", adValue.CurrencyCode);
  
    AirbridgeUnity.TrackEvent(@event);
}

Was this page helpful?

Have any questions or suggestions?