Not everyone realises but when you put an ad control such as Microsofts pubCenter control in your app, it doesn’t mean that every single user will see an ad every single time. Microsoft and any other ad provided has a limited number of ad’s to show based on the number they’ve sold. So sometimes there just isn’t an ad to show. This is referred to as fill rate, usually expresses as a percentage this tells you what percentage of requests to show an ad actually resulted in an ad being shown.
Not having 100% fill rates causes 2 issues. Firstly your not maximising your revenue as people are using your app but not seeing an ad. Secondly, unless you’ve designed for it, there’s potentially an odd looking blank space in your app where an ad is meant to go.
There is a solution though, when an ad isn’t received by the ad control it does at least fire an event to inform you that this has happened. You can either then do something to update your UI or show something else in its place like another ad control.
The second ad control I am using is AdDuplex. Unlike a traditional ad, this isn’t going to pay me out any money. Instead its specifically for Windows Phone developers to promote there apps and works on a basis that if you show an ad, your ad will get shown on another app. For every 10 ads your app shows, 8 of yours will be shown on other apps. The remaining 2 ad spaces are used by AdDuplex to make there money. The benefit of this system is there is a 100% fill rate, so your ad space is used to its full potential.
Enough talk, show me the code
In the xaml mark-up I have a MS pubCenter ad control and an AdDuplex control along with the properties set to make them fit the layout of my page. Nothing special over what you would normally do here, other than the fact there’s 2 controls on top of each other and the AdDuplex one is collpsed.
<UI:AdControl Name="MSAdControl" ApplicationId="YOUR APP ID"
AdUnitId="YOUR AD UNIT ID" HorizontalAlignment="Left"
Height="80" VerticalAlignment="Top" Width="480" BorderThickness="0" Grid.Row="0" />
AppId="YOUR APP ID" Visibility="Collapsed" />
In the code behind I’m setting up 2 event handlers on the MS pubCenter control for error occurred and ad refreshed.
The error occurred even will get fired when an Ad isn’t loaded. In that instance I need to show the AdDuplex control. Having an event on the ad refreshed control also ensures that if an ad ever does manage to display the control will be shown again.
MSAdControl.ErrorOccurred += MSAdControl_ErrorOccurred;
MSAdControl.AdRefreshed += new EventHandler(MSAdControl_NewAd);
void MSAdControl_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
MSAdControl.Visibility = Visibility.Collapsed;
AdDuplexAdControl.Visibility = Visibility.Visible;
void MSAdControl_NewAd(object sender, EventArgs e)
AdDuplexAdControl.Visibility = Visibility.Collapsed;
MSAdControl.Visibility = Visibility.Visible;