Ad Partner Integration
In this article we'll describe how you can start tracking impression-level revenue data (ILRD) in GameAnalytics. In short, we use impression events to get impression data from different ad networks. Currently we support the following ad networks:
- HyperBid
- Fyber
- Ironsource
- Applovin MAX
- TopOn
- AdMob
HyperBid
First make sure you have integrated HyperBid correctly.
To use impression data from HyperBid add the following code inside the Start function and the SDK will then automatically send the impression events for you:
void Start ()
{
// ... code
GameAnalyticsILRD.SubscribeHyperBidImpressions();
}
GameAnalytics helped launch HyperBid, a neutral mediation platform built for mobile games. Read more about HyperBid here.
Fyber
First make sure you have integrated Fyber correctly. You can find more information on this here.
Below example illustrates generating impression events using Unity SDK. Head out to our integration guides for similar methods in our other SDKs
To use impression data from Fyber add the following code inside the Start function and the SDK will then automatically send the impression events for you:
void Start ()
{
// ... code
GameAnalytics.SubscribeFyberImpressions();
}
Ironsource
First make sure you have integrated Ironsource correctly. You can find more information on this here.
Below example illustrates generating impression events using Unity SDK. Head out to our integration guides for similar methods in our other SDKs
To use impression data from Ironsource add the following code inside the Start function and the SDK will then automatically send the impression events for you:
void Start ()
{
// ... code
GameAnalytics.SubscribeIronSourceImpressions();
}
Applovin MAX
First, make sure you’ve integrated MAX correctly. You can find more information on this here.
Below example illustrates generating impression events using Unity SDK. Head out to our integration guides for similar methods in our other SDKs.
To use impression data from MAX add the following code inside the Start function and the SDK will then automatically send the impression events for you.
void Start ()
{
// ... code
GameAnalytics.SubscribeMaxImpressions();
}
TopOn
First make sure you have integrated TopOn correctly. You can find more information on this here.
Below example illustrates generating impression events using Unity SDK. Head out to our integration guides for similar methods in our other SDKs
To use impression data from TopOn add the following code inside the Start function and the SDK will then automatically send the impression events for you:
void Start ()
{
// ... code
GameAnalytics.SubscribeTopOnImpressions();
}
AdMob
First make sure you have integrated AdMob correctly.
The below example illustrates generating impression events using Unity SDK. Head over to our integration guides for similar methods in our other SDKs
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);
}