Ad Events

Note: The following example is only applicable with the C#-friendly API.

Both BannerView and Interstitial classes contain the same ad events that you can register for. These events are of type EventHandler. Here is an example of how to register ad events on a banner:

using AdcashSDK;
...
BannerView bannerView = new BannerView("YOUR_AD_UNIT_ID", AdPosition.Top);
bannerView.LoadAd();
// Called when an ad request has successfully loaded.
bannerView.AdLoaded += HandleAdLoaded;
// Called when an ad request failed to load.
bannerView.AdFailedToLoad += HandleAdFailedToLoad;
// Called when an ad is clicked.
bannerView.AdOpened += HandleAdOpened;
// Called when the user is about to return to the app after an ad click.
bannerView.AdClosing += HandleAdClosing;
// Called when the user returned from the app after an ad click.
bannerView.AdClosed += HandleAdClosed;
// Called when the ad click caused the user to leave the application.
bannerView.AdLeftApplication += HandleAdLeftApplication;
...
publicvoidHandleAdLoaded(object sender, EventArgs args){
print("HandleAdLoaded event received.");
// Handle the ad loaded event.
}

The only event with special event arguments is AdFailedToLoad. It passes an instance of AdFailedToLoadEventArgs with a Message describing the error:

Conversion tracking

If you are an advertiser, you might want to send us some information when your app has been opened so that we can track a successful conversion. Keep in mind that only the first time the app is opened is considered a successful conversion.