Skip to main content

Impression Events

Overview

Impression Events are used to track impression data from ads shown using different ad-partners. Currently we support TopOn, AdMob, Fyber, MAX and IronSource, with plans to add support for more providers in future.

The event consists of following fields:

FieldTypeExampleDescription
categoryStringimpressionEvent category
ad_network_nameStringmopubName of ad network
impression_dataJSON Object
{

“adgroup_id”: “365cd2475e074026b93da14103a36b97”,
“adgroup_name”: “Non-Mrect Ads”,
“adgroup_priority”: 6,
“adgroup_type”: “gtee”,
“adunit_format”: “Fullscreen”,
“adunit_id”: “24534e1901884e398f1253216226017e”,
“adunit_name”: “Android Sample App Fullscreen”,
“country”: “DK”,
“currency”: “USD”,
“id”: “0e6200add1eb4b8caadcf19c8314e394_00d45a3c00e5ce79”,
“precision”: “publisher_defined”,
“publisher_revenue”: 0.00005

}

Impression data could vary from each network. Description for MoPub data can be found here. Description for Fyber data can be found here.

Implementation

In this article we will describe how impression events are added in GameAnalytics. Impression events are used to get impression data from different ad networks. Currently the following ad networks are supported:

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
GameAnalyticsILRD.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);
}

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
GameAnalyticsILRD.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
GameAnalyticsILRD.SubscribeIronSourceImpressions();
}

MAX

First make sure you have 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
GameAnalyticsILRD.SubscribeMaxImpressions();
}