Advertisements for Windows Phone 7

When developing applications, we always want to make our investment profitable and maybe even make a little profit. With Windows Phone 7 (WP7) there are 2 methods to generate revenue: app purchase and ad display. This article focuses on the second method.

Creating a pubCenter account

First, you need to create an account on the Microsoft Advertising pubCenter. pubCenter is the hub for WP7 ads and Windows 8 apps. Very simple and easy to use, so I will omit the account creation details in this article.

Registering an application

In pubCenter, you must first register an application. This application must be unique per WP7 app. This allows better management of reports, performance, and revenue, but does not represent an ad unit itself, only the application.

RegisterApp

You will then get an ID for your application:

Register App Successful

Creating an ad unit

Next, you need to create an ad unit that will display the advertisements. This unit is independent of the applications and can be used multiple times in the same application and even in different applications.

Ad format

For WP7, there are 2 ad formats: X-Large (300x50) and XX-Large (480x80). I suggest the XX-Large format, as it takes the width of the screen and is more interesting in terms of user experience.

Create ad unit

Categories

Categories allow you to target the ads that will be displayed, allowing you to have a unit with ads related to your app.

Create ad unit Categories

URL Exclusions

You can filter the ad URLs that will be displayed.

Create ad unit URL Exclusions

Inserting an ad into your application

To insert an ad unit into your app, you need to download the Microsoft Advertising SDK for WP7 for Visual Studio 2010. Then, you need to insert your control into your page.

Ad Toolbox

Your XAML will look like this, where ApplicationId is the Guid of your application in pubCenter and AdUnitId is a 5-digit number designating the ad unit for this control.

            <my:AdControl 
                ApplicationId="9E3BDC69-DD3D-4DAB-BC6E-26C525E5E1DF"
                AdUnitId="99999"
                />

And an example inside the emulator in a minimal app.

SC

Conclusion

It is faster to insert an ad unit into your application than the time it took you to read this article! A great way to generate some revenue to fund your next project!

Happy coding!


See also