This post is Day #28 in a series called the 31 Days of Windows Phone.
Yesterday, I wrote about how to get your application into the marketplace. Today, I’m going to cover how to monetize your trial versions, or your free applications through the use of the advertising control.
Where Do I Get Started?
The place you’re going to want to get started is the Microsoft Advertising pubCenter. They will walk you through getting the SDK, registering your application, and implementing the ads in your application. But, because this is a series on development, I’m going to show you the implementation here, as well.
Adding the Ad Control To Your App
First, you need to GET the control. If you completely skipped the link from my previous paragraph, you haven’t downloaded it. You can get it here:
Once you have added the .DLL to your project, you’ll be able to start adding ad controls to your app. (If you need help getting this assembly into your project, there’s a walkthrough on Day #16: Panorama Control.
Once you’ve got the control available to your project, it’s as simple as any other control. Here’s what it looks like on a XAML page:
<ad:AdControl AdUnitId="Image480_80" ApplicationId="test_client" />
As you can see above, there are two required values for an AdControl. AdUnitId, and ApplicationId. You get both of these values by registering your application in the Microsoft Advertising pubCenter, and creating a new Ad Unit.
Using Test Values In Your AdControl
While we’re testing, we shouldn’t use our ACTUAL AdUnitId values, because that would be like illegally clicking on our banner ads on a web page. The AdControl is smart enough to recognize when it’s running in the emulator, and won’t show ads in that case. Instead, you should use the values in my example above. There’s actually 3 different types of test values, depending on what size/shape of ads you want to show. Here’s the whole list:
|Ad Type||Ad Model||Size (W x H)||Test ApplicationId||Test AdUnitId|
|Text Ad||Contextual||480 x 80||test_client||TextAd|
|XXL Image Banner||Contextual||480 x 80||test_client||Image480_80|
|XL Image Banner||Contextual||300 x 50||test_client||Image300_50|
For my purposes, as you saw above, I am using the 480 x 80 XXL Image Banner. This will take up the bottom 80 pixels of my application’s screen, showing ads from my specific ad unit.
What Is An Ad Unit?
Ad Units are specific “campaigns” that you might want to run. For example, I have an application called “Toothbrush Timer”.” It’s meant to show kids how long to brush each region of their mouths. Because I’m expecting parents to put it on the counter, and watch it with their kids as they brush, advertising seems like a perfect way to catch their eye.
The best part about the Ad Units is the ability to define Categories of advertisements to be shown. In my example, I want to show ads that are relevant to parents and their children. Thankfully, there are tons of different ad categories to choose from (there’s 385!), and you can even have multiple categories (up to 3) in one Ad Unit. Here’s a look at the list:
So, once you’ve created some Ad Units in the pubCenter, grab those AdUnitId and ApplicationId values, and plug them into your AdControl. Then your code, fully formatted, should look more like this:
<ad:AdControl x:Name="AdBox" AdUnitId="10018171" ApplicationId="350b8257-d92a-4978-a218-f3650bd485df" Margin="-12,528,-12,0" Width="480" Height="80" />
And here’s what the ad looks like in my application:
Just by adding this control to your application (assuming your application is actually downloaded by users), you should start seeing activity in the pubCenter. It will show impressions, click-throughs, and other reporting metrics. The most important number shows up right as you enter the site, though: revenue.
So get started showing ads in your application. This is especially handy when you use ads in conjunction with the IsTrial mode that we talked about on Day #23. Show ads before they’ve paid, and hide them afterwards.
Only 3 more days of this series to go…what’s been your favorite day so far?
Download the Code
This simple example just shows an AdControl on a XAML page. But if you need to see how it’s done, this is definitely the example for you.