April 17, 2017 10:00 am

Monetizing your app: Use interstitial banner as fallback for interstitial video

By / Principal Engineering Manager

Do you show ads while loading your app or between levels of your game (also known as interstitial ads)?

Microsoft Advertising now offers interstitial banners as an option for ads in your app. Interstitial ads have a higher monetization value, but have a lower fill rate in many markets. You can choose to use an interstitial banner when a video ad is not available.

Another option is to request both a video ad and an interstitial banner ad and show whichever ad is ready at the time of loading the app.

The code below is an example of how you can show either a video ad or a banner ad – whichever is ready first for you to load your app.

Add this to the cs file of the page that you want to load the interstitial ad:


//Add the Ads reference:
        using Microsoft.Advertising.WinRT.UI;

        //Initialize the ads:
        InterstitialAd videoInterstitialAd;
        InterstitialAd bannerAd;


        //Initialize the Adunits:
        var applicationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx";
        // video adunit
        var videoAdunitId = "xxxxxxxx";
        // Interstitial banner adunit
        var interstitialAdunitId = "xxxxxxxxx";


        //Request the ads:
        // Instantiate an InterstitialAd
        videoInterstitialAd = new InterstitialAd();
        bannerAd = new InterstitialAd();

        // wire up all 4 events, see below for function template
        videoInterstitialAd.AdReady += OnVideoAdReady;
        videoInterstitialAd.ErrorOccurred += OnVideoError;
        videoInterstitialAd.Completed += OnVideoCompleted;
        videoInterstitialAd.Cancelled += OnVideoCancelled;
        bannerAd.AdReady += MyBannerAd_AdReady;

        // pre-fetch an ad 30-60 seconds before you need it
        videoInterstitialAd.RequestAd(AdType.Video, applicationId, videoAdunitId);
        bannerAd.RequestAd(AdType.Display, applicationId, interstitialAdunitId);

        //write the code for the events
        void OnVideoAdReady(object sender, object e)
        {
            if (isBannerAdAvailable)
            {
                return;
            }

              
     isVideoAdAvailable = true;
            videoInterstitialAd.Show();
            
            
        }

        void OnBannerAdReady(object sender, object e)
        {
           if (isVideoAdAvailable)
            {
                return;
            }

     isBannerAdAvailable = true;
            bannerAd.Show();
                   }

        void OnVideoError(object sender, AdErrorEventArgs e)
        {
            /* ... */
        }

        void OnVideoCompleted(object sender, object e)
        {
            /* ... */
        }

        void OnVideoCancelled(object sender, object e)
        {
            /* ... */
        }

Stay tuned over the next few weeks for additional tips to increase ad monetization.

Updated April 20, 2017 10:21 am

Join the conversation