Skip to main content
June 11, 2015

Increase ad revenue with ad mediation

Thousands of apps in the Store today are using Windows ad mediation to increase ad revenue in Windows Phone apps. Ad mediation, as described in the launch blog post, allows you to manage multiple ad SDKs from different providers, including Microsoft Advertising, AdDuplex, Google AdMob, Inneractive, Smaato, InMobi, and MobFox and get up to 99% fill rate in many cases.

As more developers adopt ad mediation, we have identified the most common questions, or issues that reduce the effectiveness of ad mediation, thus are not able to generate as high fill rate as possible.

If you are having issues with Windows ad mediation, first make sure you’ve read the documentation, then try out the steps below to troubleshoot and get your mediation back on track.

Start with basic troubleshooting steps

The majority of errors are due one of these 6 reasons — double check that you’ve addressed all of them.

  1. Which Visual Studio version are you using?
    The ad mediator only works with Visual Studio 2013. A new version of ad mediator that will work with Visual Studio 2015 will be released this summer, stay tuned for release information.
  2. Did you install the latest version of the ad mediation SDK?
    If so, try uninstalling the current version and reinstalling the latest version SDK.
  3. Are you using a compatible code language?
    At this time, ad mediator only supports Windows Phone Silverlight (8.0, 8.1), Windows Phone XAML (8.1), in projects written either in Visual Basic or C#/XAML. Windows ad mediation SDK works in managed code, and is not designed to natively support platforms like Unity, Cocos2D and similar frameworks.
  1. What type of computer are you using?
    Adding the Ad mediator SDK works on all computers except if they are running on the Atom processor. So for development please use a non-Atom laptop or PC. Ad mediation will work on all devices at runtime.
  1. What type of app are you installing ad mediator in?
    At this time, ad mediator only works with Windows Phone apps.  It will work with a universal app if you drag the control into the designer for the Phone portion of the app only. Support for Windows apps is coming later in the summer.
  1. Which platform are you targeting?The ad mediator only works with Windows Phone 8.0 Silverlight, Windows Phone 8.1 Silverlight and Windows Phone 8.1 XAML. Support for Windows will come later in the summer.

If you’ve covered these steps and are still experiencing having problems, advanced troubleshooting may be needed.

Advanced troubleshooting steps

  • Double check the core 6 troubleshooting steps again.
    1. The majority of reported problems or questions are due to the top 6 reasons, please double check those first before trying more advanced troubleshooting described below.
  • Unable to install the ad mediator control in my project.
    a.   Did you clean out all ad network references? Ad mediator is designed to run by itself in a project, no need to include any ad-specific DLL. To clean the references:
    i. In the Solution Explorer expand References, and remove the references, then right click on the Solution header and clean the solution.
    ii. Then in control panel uninstall all ad networks
    iii. hen reinstall the latest version of ad mediator SDK.b.    Are you dragging the mediator from toolbox into the designer or into the project XML? Ensure you only dragged it into the designer; dragging it into the XML will not work.

Ensure you drag and drop the control to the visual designer.

Image 1
  • Not seeing ads from one or more ad networks.
  • Are you running the most current version of ad mediator? If not, download the current MSI and install it.
    1. To confirm, compare the version in the download page [e.g. 1.0.2] vs the version shown in Visual Studio [reference properties]
  • Did you test in the emulator first? If not, test the ad mediator in the emulator first before proceeding to the next steps.
    1. Some ad networks do not serve test ads and will show an error while you’re testing in the emulator.
  • Ensure you have an active account for each ad network you want to use.
    1. You have to go to each ad network portal, register, set up an account, create the ad units, and use that information for the ad mediation configuration. The documentation lists all the portals for each ad network.
  • Read the document about the required metadata and make sure you’ve obtained the correct metadata from the ad networks.
    1. Check that you’ve entered your personal ad network metadata rather than the default metadata.
    2. Make sure the metadata is entered via Services Manager or in Dev Center (not just the test configuration).
  • Ensure you’ve defined all the ad controls before launching connected services. The ad mediator package is not created until “Launch Connected Services” is hit, and this must be done each time a change is made to ad controls or the ad mediator.
  • Launch Connected Services and view the status. Each ad network should read “Fetched”.  If it does not read “Fetched”, you need to install add the Ad SDKs to the project manually.

How to launch connected services.



Confirming if Ad SDK has been fetched or not.

  • Did you enable all the ad capabilities for each ad network in the project? Different ad networks require different app capabilities. These are shown by each provider in the Services Manager window (see below). Be sure to declare all of the required capabilities in your project’s manifest so that the ads are properly displayed.

Confirming capabilities needed by each Ad SDK.

  • Ad mediation does not include location (latitude/longitude) for the ad network.
    • If you enable the location capability in your app, the ad mediator control will automatically fetch the latitude/longitude coordinates and provide them to ad networks that support them.

Enabling capabilities in Visual Studio.

Image 4
  • Ad mediator was installed correctly, but isn’t running in the emulator or the app.
    • Make sure you have not removed anything from your Visual Studio (the config file, or the DLL reference). Try removing all ad networks from your project, and start fresh by dragging and dropping ad mediator into the design window and then running connected services.
  • The app is crashing when running ads.
    • Check that you are handling the unhandled exceptions from ad networks. Adding this code will prevent the majority of ad-related crashes.
    • Do you have the exception catching turned on in Visual Studio? Turning it on can help you identify the cause of the error.
    • Do you have a stack trace or log event code installed in your project?
    • Installing one can help identify the root cause of the crash.
      1. If you have one installed, did you review the report to help identify the cause?
  • The app stalls while an ad is loading.
    Try using the pause/resume function. Ad mediation can take time and RAM to begin serving ads. Pause/resume can be a useful option if you have a sensitive area in your code or your app switches pages quickly.

    1. To pause ad mediation for any given amount of time during the app runtime, use the AdMediatorControl.Pause() method. Note that when you do this, the most recent ad will continue showing until you resume mediation by calling the AdMediatorControl.Resume() method. To disable the ad mediator completely, use the AdMediatorControl.Disable() method. This will remove any ads that are showing, and it will minimize the memory footprint of the mediator. You can call AdMediatorControl.Resume() to resume mediation, but note that startup time will be slower than usual after ad mediation has been disabled.
    2. Consider switching fast-moving pages in your app to a one page function and changing the page view. This will allow ad mediator time to load and fetch an ad.
  • The ad doesn’t display correctly.
    The Smaato ad control doesn’t line up correctly.

    1. Try using the optional parameters to set values on the SDK controls:
      AdSdkOptionalParameters[AdSdkNames.Smaato][“Margin”] = new Thickness(0, -20, 0, 0);
      AdMediatorControl.AdSdkOptionalParameters[AdSdkNames.Smaato][“Height”] = 100d;
  • The AdDuplex ad control does not show with the correct size (it shows as 250×250).
    1. Ad mediation does not set any value for the size, so you should change it using the optional parameter Size, for example: AdMediator.AdSdkOptionalParameters[AdSdkNames.AdDuplex][“Size”] = “160×600”
  • AdDuplex is asking for only one parameter.
    AdDuplex requires two parameters to configure the ad. Use one for now, and support for the second parameter is coming this summer.
  • The ad is not reaching 90% fill rate.
    Make sure you are using multiple ad networks, including Microsoft Ad SDK.

    1. Try using at least 3 ad networks, and review the reports in Dev Center that show the fill rate to help identify if there are issues with a specific ad network
  • Try to maximize the amount of time an ad is shown.
    1. We have seen the best results (close to a 99% fill rate) in apps that have a single page, and keep the Ad Control always visible. Content is changed, but the ad control is instantiated only once.
    2. Some of the lowest fill rates occur when ads are only shown for a few seconds, and the user changes to another screen, or when the ad control is instantiated and terminated very frequently.
  • You see an error when running ad mediation.
    A “Margin error”

    1. Some networks require specific margin settings so the ad can display correctly. If the ad isn’t completely shown or the margins don’t align correctly, it will cause a margin error. You can dynamically instantiate the AdMediator Control in the code and set the Name, Id, Width, Height, etc. properties via code. Remember that these properties alone are not sufficient to run the AdMediator – there is a config file (called AdMediator.config) which need to be present and correctly configured for AdMediator to run. This file is automatically generated and configured when Connected Services is launched.
  • “Something is covering the ad control”
    1. Ad Duplex will always show an error if the ad is obscured in any way within your app. Read their solution to this error.
  • A “Timeout error”
    1. Adjust the call time for the ad network(s) reporting the error.
  • “Required capabilities are missing from manifest (WMAppManifest.xml): internetClient.”
    1. Different ad networks require different app capabilities. These are shown by each provider in the Services Manager window. Enable each of the required capabilities and declare them in your project’s manifest to clear the error.
  • “There was a conflict between two files.”
    1. You have referenced the MS Ads SDK elsewhere in your app. Ad mediator is designed to work exclusively in your app and will not work if other ad SDKs are used. Remove the MS Ads SDK manually and reinstall ad mediator to clear the error.
  • “The Connected Service component ‘Ad Mediator’ failed: (HRESULT:0x80131940) ‘x’ is an undeclared prefix. Line 1, position 13.” I’m unable to install the ad mediator control in my project – XML error

Visual Studio will scan the XML files included in the project for instances of the ad mediator control. If there is an error with any other XML file in your project, this can make ad mediation file.

Solution: run the code below to attempt to read and parse the XML files as XML documents, and identify XML files that failed to serialize:

  • “Ad control is hidden by other control or invisible”
    1. Ad mediator is designed to run exclusively in a project. Uninstall all ad network instances, and then try re-installing ad mediator. Also make sure there is no other graphic element on top of the ad, even a partial border of an element that is higher in the graphic tree can lead to this error.
  • “(FirstChance) System.ArgumentException in mscorlib -> Use of undefined keyword value 1 for event TaskScheduled”
    1. This is a first chance exception that is handled appropriately by the controls. Ad mediator should not be impacted and your ads should still run.
  • “Unable to start ad mediation” (FileIOException)
    1. Deploy the AdMediator.config with the app. You can do this by linking it or copying it from the library to the root of the app and setting the Build Action to Content.
  • “Admediator.config file is corrupt. Please try submitting your package again.”
    1. You’ve added the code from behind or directly into the XAML file. Remove all instances of ad mediator, and drag it from the toolbox into the designer and then configure.
  • “A reference to a higher version or incompatible assembly cannot be added to the project.”
    1. Right-click the DLL in Explorer and then select Properties. In the Security section, click Unblock).
Image for BAFW

With ad mediation, your apps can increase fill rate and configure the best ad network to use depending on the country, or changes in ad networks. If for example an ad network is having fill rate issues, you can immediately change to select another ad network as primary, with no change to your code, and no app updates required. All changes are done in Dev Center.

Please send us your feedback and issues you see with ad mediation, and vote for features to help prioritize the next features to add.