Make Money with the Microsoft Ad Control (Mobile Matters)

While some developers create mobile applications as a hobby or as a way to see their names in lights, for others it’s all about the money. As you may already know, the Windows Phone Marketplace offers a simple way to get paid for your hard work by selling apps to users. However, there’s also another, complementary way for you to make money from your Windows Phone 7 applications: advertising. The Microsoft Advertising SDK makes the process of incorporating ads into your apps easy—and you’ll get paid when consumers use your app, even if it’s free to download.
This article will:
  • Show you how to get started with Microsoft Advertising in your application.
  • Walk you through creating an advertising-supported app using XAML or in code—going from File | New all the way to Build and Run.
  • Go beyond the basics to help you improve the advertising experience for your end users and make more money.

About Advertising

The reality is that mobile users are, for the lack of a better word, “thrifty.” Many who won’t hesitate for a second to spend $4 on a double latte will agonize over a 99-cent app purchase. Advertising enables you to still make money from those users who aren’t ready or willing to spend their hard-earned pennies to buy your app. Free apps, “lite” versions of paid apps and trials of paid apps all present ad monetization opportunities. Given that downloads of free and trial apps greatly outpace those of paid apps in the Windows Phone Marketplace, showing ads in your app is simply good math.
The Microsoft Advertising SDK is a free download and the service is free to use. Furthermore, the ads shown when you use the Microsoft Ad Control aren’t just from Microsoft adCenter. Instead, Microsoft has created a real-time ad exchange where top-tier mobile ad networks bid for the right to show their ads in your app. This improves ad rates overall and ensures that advertisers are paying top dollar for ads in mobile apps on Windows Phone 7. You get paid 70 percent of the revenue the ad impressions in your app generate monthly.
As you’ll see later in this article, using the Microsoft Ad Control is easy enough that even part-time developers and students are getting into the act of building ad-supported Windows Phone 7 apps. Your mileage may vary, of course; if your app engages end users and they use it often, the money-making potential goes far beyond pocket change. Many developers have made more from advertising than they have through app sales, and Microsoft has published a couple success stories that highlight a few of these experiences (bit.ly/9RlMFW).

Getting Started

Getting started with the Microsoft Ad Control is easy and, even if you’re still a novice Windows Phone 7 developer, you can be up and running in no time. Here are the steps to include Microsoft Advertising in your application:
  1. Sign up on the Microsoft pubCenter portal with your Windows Live ID. Here you’ll be able to register your ad-supported applications and the locations within those apps where ads will appear.
  2. Get the free Microsoft Advertising SDK for Windows Phone 7. Today, you can download this SDK from the pubCenter portal, but later this year you’ll get it automatically when you install the upcoming version of the Windows Phone Developer Tools.
  3. Add the Microsoft Ad Control to your application. Set a couple of properties in the Ad Control to identify your app and ad location, and you’re ready to submit your ad-enabled app to the Windows Phone Marketplace.
Once your app is live in the Windows Phone Marketplace and starts getting used by end users, it will automatically start generating ad impressions. You’ll get paid for showing these ads on a CPM-basis (cost per thousand views; see “Advertising 101” for more on the cost breakdown) and after you’ve hit a minimum threshold of $50, you’ll automatically get issued a check or direct deposit—your choice—from Microsoft.

pubCenter Setup

Your first step in working with ads from Microsoft is to sign up at the Microsoft Advertising pubCenter portal at pubcenter.microsoft.com using your Windows Live ID (see Figure 1).
Figure 1 The Microsoft Advertising pubCenter Portal
You’ll be asked to enter some information about yourself or your company, then you can jump right in and register your first application and “ad unit.”
In order to define a new application in pubCenter, all you have to do is give it a friendly name. Later on, if you have more than one ad-supported application, you’ll be able to break out the statistics to see how the ads in each of your applications are performing.
On the same screen, you can also define your first ad unit. Each ad unit has a name and represents a location in your app where advertising will be shown. Ad units can be associated with up to three categories that best describe the content surrounding them (see Figure 2).
Figure 2 Registering Your App and Creating an Ad Unit
The categories you select will be one of the many factors that determine which ads are displayed in your app.
Once you click Save, you’ll see a summary of the information for your new pubCenter account and also the IDs for the application and ad unit you just created. When you’re ready to go live, you’ll use these values with the Ad Control to identify your app to the Microsoft Advertising servers.
At this point, you’re done with pubCenter for the time being and are ready to dive into Visual Studio. You can return to pubCenter at any time to define more applications or ad units, see in-depth advertising reports and configure advanced settings such as competitive exclusions.

Adding Ads with Visual Studio

If you’re not using the latest Windows Phone Developer Tools yet, you can download the newest version of the Microsoft Advertising SDK from pubCenter. This SDK includes the Microsoft Ad Control as well as documentation and code samples to help you get started. The June 2011 version of the Ad Control offers rich media support and an improved API set. Make sure you have it installed so that you can follow along. Let’s look at how to use it from the Visual Studio Designer.
Start by creating a new Windows Phone 7 Silverlight project with File | New, and opening up the XAML surface where you want to show ads. Pick a suitable spot where the ad can be frequently shown, but won’t annoy the user; typically, the bottom or top of the screen is best. Drag the AdControl (note: “Ad Control” refers to the Microsoft product, while “AdControl” refers to the class or object) directly from the Toolbox pane to add it directly to a Grid control (see Figure 3).
Figure 3 Placing the AdControl
Once the AdControl is on the page, you need to set some properties for it to work correctly in your application. First, you’ll need to double-check the width and height of the AdControl. It’s recommended to keep the control at the standard dimension of 480 x 80 pixels for mobile ads. Setting a smaller size will prevent standard-sized ads from being displayed on your page. Setting a larger size will mean that there will be some empty space between where the ad is rendered and the border of the AdControl.
Next, you’ll need to link the AdControl with the Application ID and Ad Unit ID you created in the pubCenter portal. It helps to have the portal Web page open so you can copy and paste these values into the Visual Studio window.
Finally, there are two properties you’ll want to set to meet your app’s needs. If set to true, the IsAutoRefreshEnabled property automatically shows a new ad every 60 seconds. This enables you to increase the number of ads a user sees, which should lead to better revenue for your app (see “Advertising 101” for more on ad revenue). Set the IsAutoCollapseEnabled property to true if you want the AdControl to automatically hide itself from view before an ad is downloaded.
The XAML generated by the Visual Studio Designer should look something like this:
<Grid x:Name="ContentPanel" Grid.Row="1">

  <my:AdControl

    Height="80"

    Name="adControl1"

    Width="480"

    IsAutoCollapseEnabled="True"

    IsAutoRefreshEnabled="True"

    AdUnitId="test_client"

    ApplicationId="Image480_80" 

  />

</Grid>
Now hit Run to see your first ads.

AdControl API

If you’re finding that you want to do some fancier things, such as controlling the hiding or showing of ads, or you want to have a bit more control over when the ad shows in your application, you can chose to instantiate the AdControl directly in your code.
But before we get there, let’s start by dissecting how the AdControl works (see Figure 4). Behind the scenes, when your app starts and the AdControl gets initialized, it requests an ad from the Microsoft Advertising servers. The request is formed with the Application ID and Ad Unit ID that you specified in your code.
Figure 4 How the AdControl Works
It’s critical that this information matches what you copied from the pubCenter portal or to the test IDs provided in the documentation. The request also contains some other useful information about your app, such as the region to which ads will be matched.
If the ad it receives back uses images or HTML-based rich media, the AdControl will reconnect with a Web server to download the advertising content (such as JPEG, GIF, HTML or PNG files). Once the user has seen the ad, the AdControl may connect again with the server to record the ad impression. This whole cycle repeats when the ad gets refreshed and a new ad gets downloaded.
There isn’t much in the way of rocket science when it comes to the code required to use the AdControl. You’ll need to start by adding the Microsoft.Advertising.Mobile.UI assembly as a reference in your project. You’ll also want to add a using statement for the Microsoft.Advertising.Mobile.UI namespace. And in your page’s constructor, you’ll place the code to create the AdControl. You’ll then need to add the AdControl instance into the page’s visual tree. In this case, we’re adding it to a grid that we have in our layout (see Figure 5). With the code in Figure 5 in place, your app should be ready to build and show ads using the code you’ve written.
Figure 5 Adding the AdControl to the Visual Tree
  1. using Microsoft.Advertising.Mobile.UI;
  2.  
  3.  
  4.  
  5. // Constructor
  6.  
  7. public MainPage()
  8.  
  9. {
  10.  
  11.   InitializeComponent();
  12.  
  13.  
  14.  
  15.   AdControl adControl = new AdControl();
  16.  
  17.  
  18.  
  19.   // Add the control to a grid control
  20.  
  21.   Grid grid = (Grid)this.LayoutRoot.Children[1];
  22.  
  23.   grid.Children.Add(adControl);
  24.  
  25.  
  26.  
  27.   // Insert real values from pubCenter before
  28.  
  29.   // submitting your app to Windows Phone Marketplace!
  30.  
  31. #ifdef SHOW_TEST_ADS
  32.  
  33.   adControl.ApplicationId = "test_client";
  34.  
  35.   adControl.AdUnitId = "Image480_80";  
  36.  
  37. #else
  38.  
  39.   // Use your real Application ID and Ad Unit ID here
  40.  
  41.   adControl.ApplicationId = "12ab456c-de7f-89ab-0123-4567890c1d23";
  42.  
  43.   adControl.AdUnitId = "12345";
  44.  
  45. #endif
  46.  
  47.  
  48.  
  49.   // Make the AdControl fit the standard 480 x 80 dimension
  50.  
  51.   adControl.Width = 480;
  52.  
  53.   adControl.Height = 80;
  54.  
  55.  
  56.  
  57.   // Let the AdControl collapse and refresh automatically
  58.  
  59.   adControl.IsAutoRefreshEnabled = true;
  60.  
  61.   adControl.IsAutoCollapseEnabled = true;
  62.  
  63. }

Tips and Tricks

Here are a couple of important things to keep in mind when working with the AdControl in your app, and a few ways—such as targeting— that will help you maximize the value of the advertising in your app.
First, always make sure you can see both “test” and “real” ads running in your application. To view test ads, set the ApplicationID to “test_client” and Ad Unit ID to a standard test value such as “Image480_80.” A well-placed #ifdef can come in handy here. You should use test ads while developing and testing your app, but once you’re ready to release, it’s critical you set this back to your pubCenter-issued Application ID and Ad Unit ID. However, testing with your own app IDs is important because it ensures your application works with “real” live ads.
Next, to get the best ads, it’s important to provide as much information as possible to the ad system. The AdControl often gets this information automatically, so your application manifest must have the following capabilities:
  • ID_CAP_PHONEDIALER
  • ID_CAP_NETWORKING
  • ID_CAP_WEBBROWSERCOMPONENT
  • ID_CAP_IDENTITY_USER
  • ID_CAP_MEDIALIB
If it makes sense for your application, it’s also recommended to use the ID_CAP_LOCATION capability. Enabling location-based advertising improves the quality and relevance of the ads that your users will see.
The AdControl.PostalCode and AdControl.Country properties allow an app to update the user's location.  In the following example, a Beverly Hills movie star app would generally know that its users are around that location:

  1. using Microsoft.Advertising;
  2.  
  3. // Make sure the AdControl is created
  4. adControl.Country = "US";
  5. adControl.PostalCode = "90210";
Similarly, it might also be useful to handle a few things about the ad experience in your code. If you’ve set the IsAutoRefreshEnabled property to false, then you’ll be able to refresh ads manually. Call the adControl.Refresh method to bring a new ad into view, but make sure not to call it more than every 30 seconds in order to give users enough time to click on ads they might be interested in.
If you’ve set the IsAutoCollapseEnabled property to false, you can listen for an ErrorOccurred event. This event will fire whenever an ad fails to download or display. You can use this event to collapse the AdControl and reclaim that space for use by your application’s other UI elements. When the AdRefreshed event fires, you’ll know a new ad is ready to be seen and you can restore its visibility (see Figure 6).
Figure 6 The AdRefreshed Event
  1. public void AdControl_AdRefreshed(object sender, EventArgs args)
  2.  
  3. {
  4.  
  5.   AdControl ad = (AdControl)sender;
  6.  
  7.  
  8.  
  9.   Dispatcher.BeginInvoke(() =>
  10.  
  11.   {
  12.  
  13.     ad.Visibility = System.Windows.Visibility.Visible;
  14.  
  15.     Debug.WriteLine(
  16.  
  17.       "ad control '" + ad.Name + "' got ad, visibility = " + ad.Visibility);
  18.  
  19.   });
  20.  
  21. }
  22.  
  23.  
  24.  
  25. public void AdControl_ErrorOccurred(object sender, AdErrorEventArgs args)
  26.  
  27. {
  28.  
  29.   try
  30.  
  31.   {
  32.  
  33.     AdControl ad = (AdControl)sender;
  34.  
  35.  
  36.  
  37.     Dispatcher.BeginInvoke(() =>
  38.  
  39.     {
  40.  
  41.       ad.Visibility = System.Windows.Visibility.Collapsed;
  42.  
  43.       Debug.WriteLine(
  44.  
  45.         "error in ad control '" + ad.Name + "': " + args.Error.Message);
  46.  
  47.       Debug.WriteLine("ad control '" + ad.Name + "' visibility = " + ad.Visibility);
  48.  
  49.     });
  50.  
  51.   }
  52.  
  53.   catch (Exception e)
  54.  
  55.   {
  56.  
  57.     Debug.WriteLine("oh no! " + e.Message);
  58.  
  59.   }
  60.  
  61. }
As you’ve seen, using the AdControl in your application is easy. And if you run into trouble, there are generally only a few things that can go wrong and cause ads not to be shown:
  • No network connectivity
  • Typo in Application ID or Ad Unit ID
  • The user is in a location where ads from Microsoft Advertising aren’t available
  • The AdControl is set to a dimension that’s too small
  • Missing capabilities
Finally, if you’re writing a game and want to use XNA, look at the Microsoft Advertising XNA advertising game component that’s also part of the Microsoft Advertising SDK. Unfortunately, there isn’t enough space to go in-depth on XNA in this article, but there is documentation available online at search @ google or bing.
Now go add some advertising and start getting paid for all that hard work you put into your application!




4 comments

  1. Did you know you can create short links with Shortest and earn money from every visit to your short urls.

    ReplyDelete
  2. If you're looking for a good contextual ad network, I suggest that you take a peek at Chitika.

    ReplyDelete
  3. Get daily ideas and guides for making $1,000s per day FROM HOME for FREE.
    GET FREE ACCESS INSTANLY

    ReplyDelete
  4. If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you gotta watch this video
    right away...

    (VIDEO) Get your ex back with TEXT messages?

    ReplyDelete

Follow by Email

 

Blog Archive

Contributors

My photo

Anika Devi received her Bachelor’s degree in Media, Culture and Communication from New York University in 2012. She began freelancing for Business Solutions BD in 2010 and joined the team as a staff writer three years later. She currently serves as the assistant editor.
Worked well for Website DA, Entrepreneurship, Starting a Blog, Payoneer MasterCard, Sex Tips, Phone Sex, So how do you think? Want to get into her pants? Read here