How to integrate “Ad Mediator” in your apps?

Microsoft Ad Mediator”, recently released by Microsoft to maximize your ad monetization – we already talked about it last day. If you don’t know about it, read the said post, download the Visual Studio 2013 extension before continuing with this post.


Today, we will discuss how to integrate “Ad Mediator” in your Windows Store and Windows Phone applications. As it currently supports only Windows Phone apps, so we will continue with that.


Once you install the “Ad Mediator” plugin extension for Visual Studio 2013, you will see a new context menu item in your Windows Phone app project named “Connected Service”. This opens the Services Manager window where you can find the Ad Mediator section to add/configure your ad networks.


To do this, right click on your Windows Phone application project, navigate to “Add” – “Connected Service…” as shown in the below screenshot:


Add Connected Service to include AdMediator (


At the first, it will search for all the ad network instances installed in your project and load them in this screen. By default, it loads the “Microsoft Advertising” network.


Loading all instances of AdMediator services (


Once it loads the ad network instances, it shows the name of the ad network, status of fetching the DLLs from NuGet and the required Capabilities. Below you can see that, “Microsoft Advertising” requires 5 (five) capabilities named “ID_CAP_IDENTITY_USER”, “ID_CAP_MEDIALIB_PHOTO”, “ID_CAP_PHONEDIALER”, “ID_CAP_NETWORKING” and “ID_CAP_WEBBROWSERCOMPONENT”. This can be different for other networks. Make sure to add the capabilities in your manifest file.


Select Ad Networks from AdMediator Services (


You can add more ad networks in this screen. Click the “Select ad networks” link as shown above to open the “Select Ad Providers” dialog window. If you want to remove any ad network, you can select the same link and from the next screen you can remove them. Currently only 7 (seven) ad networks are supported by Ad Mediator. Remember that, all networks does not support all types of projects. To know more about the supported ad providers, read my next post.


Select Ad Providers from AdMediator Services (


Once the Ad Mediator plugin adds the selected ad network in your project by fetching the required DLLs from the NuGet, it will show the success message. In case it fails to download, it will mark them red in the same screen. If fails, you have to download and link the said DLLs from the ad provider’s website. Rest will be done by the plugin.


Fetching Status of selected Ad Networks in AdMediator service (


As shown below, you can check the installed ad networks and their respective required capabilities in the Service Manager. Make sure to do the manual changes in the manifest file of your app to include the said capabilities.


Fetched networks in AdMediator Service Manager (


Another important thing that you notice after fetching any ad network in ad mediator is the .config files and the DLL references. You will notice two new .config files in your project: AdMediator.config and packages.config. First one is required by the Ad Mediator to know details about the ad network that you selected. We will discuss more about it later half of this post. The second file is required by the NuGet package manager to know more about the packages installed in the project.


Config files created by AdMediator (               Added Service References in your project by selected AdMediator services (


You can see a no. of additional DLL references added to your project. This could be more or less depending on the selected ad networks.


The next step is to configure each networks to know more about your apps. You must have to create app specific applications on the respective ad networks website and grab the additional property values required by the control. Though this step is optional here, but require for you to test your apps in emulator and/or physical device before submitting it to Dev Center. Once you publish your app, you can directly configure them in your Dev Center account without rebuilding your apps.


Configuring ad network in AdMediator Services Manager (


To get started with configuring the network to test in your app, select the network in the Ad Mediator Service Manager screen and click the “Configure” link at the right side of the panel (as shown above). A new dialog box named “Configure AdDuplex” will popup in the screen as shown below:


Provide details in configuration window of each AdNetwork of AdMediator (


As mentioned earlier, this screen varies for different network. For “Ad Duplex”, it asks for “App ID”. But for others, it could be different. In my next post about Ad Mediator, I will more precisely discuss about these.


Next step is to add the Ad Mediator control in your apps XAML page. First you will need to add the XMLNS namespace and then the control in your page. Here is the XMLNS namespace declaration:




The next step is to add the Ad Mediator control in the XAML page, define a name to it and also an ID. This will help you to find the specific ad in your Dev Center account for you to track. Following is a code snippet of the Ad Mediator control, but it is advisable to drag and drop the control from the toolbox. This will ensure that you have a different name and ID for each control.



That’s all! Now build your application and deploy it in your emulator and/or physical device to test the ads coming up in your phone screen. It might take some time to see the first ad in your device, assuming you have configured the applications properly in the respective sites and added the required properties in Ad Mediator config.


I hope you liked the article. Please share this in your network and let the other developers know about it. Connect with me over Twitter, Facebook and/or Google+ to get the updates that I share over those networks. Subscribe to my blog’s RSS feed and Email Newsletter to get the email notifications directly delivered to your inbox. Stay tuned for the next blog post.


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.


  1. nice post with useful screenshots, thanks

  2. How to show different Ad sizes for tablet and phone using same Universal Ad Mediator control? Possible?

  3. Great tutorial, but on Windows Phone 8.1 (XAML front-end), I am receiving this error:

    Cannot resolve dependency to assembly 'Microsoft.AdMediator.Core, Version=, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.

    I'm going nuts with this. Please help.

  4. I've been using a flash blocker extension for years, in chrome and firefox. When I used to do IT support in a small company I would install the blocker extensions before handing over a computer to a new member of staff, it reduced my work load not having to reinstall computers due to web infections, and staff complaints about laggy internet when they were using mobile data.

    Deep Web


© 2008-2016 - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top