How to send ILRD to GameAnalytics
What you’ll need
- GameAnalytics SDK integration set up
- Mediation partner SDK configured and serving ads correctly
- Unity only: the separate
GA_ILRD_UNITY.unitypackageimported into your project — download the latest version here. See Ad Revenue (ILRD) for Unity for the full guide.
How to send ILRD data to GameAnalytics
To capture ILRD from your mediation provider, you will need to add code to your GameAnalytics SDK integration. This varies depending on the SDK version you are using.
info
Refer to the SDK Documentation for code examples specific to your mediation provider and platform (Unity, Unreal, Roblox, iOS, Android, etc.).
AdMob and GameAnalytics’ Unity SDK
To use impression data from AdMob, add the following code inside the OnCreate function of the first activity of your game:
protected void onCreate(Bundle savedInstanceState)
{
//...other code
interstitialAd.setOnPaidEventListener(new OnPaidEventListener()
{
@Override
public void onPaidEvent(AdValue adValue)
{
JSONObject impressionDataJson = new JSONObject();
try
{
impressionDataJson.put("adunit_id", interstitialAd.getAdUnitId());
impressionDataJson.put("currency", adValue.getCurrencyCode());
impressionDataJson.put("precision", adValue.getPrecisionType());
impressionDataJson.put("adunit_format", GameAnalytics.INTERSTITIAL);
impressionDataJson.put("network_class_name", interstitialAd.getResponseInfo().getMediationAdapterClassName());
impressionDataJson.put("revenue", adValue.getValueMicros());
}
catch (JSONException e)
{
e.printStackTrace();
}
GameAnalytics.addImpressionAdMobEvent(MobileAds.getVersionString(), impressionDataJson);
}
Fyber and GameAnalytics’ Unity SDK
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeFyberImpressions();
}
Unity LevelPlay and GameAnalytics’ Unity SDK
Requires Unity LevelPlay 8.10.1 or newer (including 9.x) and GameAnalytics Unity SDK 8.1.0 or newer.
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeLevelPlayImpressions();
}
Ironsource (legacy plugin) and GameAnalytics’ Unity SDK
For projects still using the legacy IronSource Unity plugin. If you are on Unity LevelPlay 8.10.1+ or 9.x, use SubscribeLevelPlayImpressions() above instead.
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeIronSourceImpressions();
}
Applovin Max and GameAnalytics’ Unity SDK
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeMaxImpressions();
}
Topon and GameAnalytics’ Unity SDK
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeTopOnImpressions();
}