Displaying Ads on Windows Phone 7 apps – The Basics

Microsoft Ads system has made it extremely easy to monetize your Windows Phone 7 Silverlight or XNA apps. In just a few simple steps, you can start displaying contextual ads in your app. In addition, the documentation team has done a tremendous job in writing very detailed and great information. This post has a lot of content copy-pasted from the help file that came with the Ad Control SDK. The purpose of this post is to quickly highlight the major steps you need to follow without going through all the documentation and get up and running as fast as possible. (Thank you again for writing such great content).

There are just 2 simple steps in getting your app up and running with Microsoft Ads:

Download the latest Ad Control SDK from https://www.microsoft.com/downloads/en/details.aspx?FamilyID=b0f00afc-9709-4cc2-ba2c-57728db6cbd6 and install it. The current version at the time of this writing is 5.1.0.166 (dated 3/4/2011). Default values for the installation are fine. The latest version of the Ad Control SDK allows you to build your app and show ads in test mode. This ensures that you are productive in less than ½ hour before you need to on-board with pubCenter.

Integrate the AdControl into an Application Using the Visual Studio 2010 Visual Designer . The following steps are a guide for using the Visual Studio 2010 Visual Designer to integrate advertising into Windows Phone 7 applications. In a later tutorial we will discuss how to programmatically add the control to different pages and the best practices surrounding that.

Prerequisites

Steps

1. Open Visual Studio and create a New Project.

2. From the installed templates section (on the left), expand Visual C# and click Silverlight for Windows Phone.

3. Select the type of application you are building—for example, Windows Phone Application.

         clip_image002[7]

4. Name the project (for example, AdControlTest) and click OK.

5. In your Visual Studio project, expand the toolbox and right-click Windows Phone Controls. On the context menu, click Add Tab.

         clip_image003[5]

6. Under Windows Phone Controls, a new tab will appear and you can enter a name for this tab—for example, WP7AdControl.

        clip_image004[5]

7. Right-click the new tab WP7AdControl. On the context menu, click Choose Items … .

       clip_image005[5]

8. In the Choose Toolbox Items dialog box, click the Windows Phone Components tab. Click Browse… , and in the Open dialog box, navigate to the location where you installed the Microsoft.Advertising.Mobile.UI.dll previously. Click the Microsoft.Advertising.Mobile.UI.dll file to select it, and then click Open. In the Choose Toolbox Items dialog box, make sure that the check box next to the AdControl Class is selected. Click OK. The AdControl Class will be available in the Toolbox.

       clip_image006[5]

9. You should now see the AdControl Class in a new tab.

        clip_image007[5]

10. From the new tab, drag and drop the AdControl Class into the Application Designer. Position the AdControl Class so that it is fully visible in the Application Designer.

11. Right-click the AdControl Class in the Application Designer. On the context menu, click Properties.

         clip_image008[5]

12. You should now see the AdControl Class Properties panel (on the right hand side).

13. Set the control size either by dragging and dropping the border in the designer or by specifying the size in the Properties panel—for example, Width = 480, Height = 80.

        clip_image009[5]

14. In order to receive ads, you will need to register with Microsoft pubCenter. After registration, you will receive an official ApplicationId and AdUnitId to use in the AdControl Class. Before you use the official IDs, you can use test IDs to see how the ads will look in your application. In the Properties panel, configure the following properties:

  1.  
    1. Set ApplicationId = “test_client”
    2. Set AdUnitId = “Image480_80”

        clip_image010[4]

15. Build and run your application and you will see a sample test ad.

         clip_image011[4]

In the next post, I will elaborate more on some of the advanced concepts such as Test Values for Windows Phone 7 Silverlight Applications, Test Values for Windows Phone 7 XNA Games, How to display ads on multiple pages, Integrating the AdControl into an Application Programmatically (C#), Best practices, API reference, Disable auto rotation and Demographic targeting – Location, Gender, Income, Birthdate, etc.

Links you should know:

Download Microsoft Advertising SDK for Windows Phone 7

Frequently Asked Questions about the Microsoft Advertising program

Monetization Best Practices for Windows Phone 7 apps

PubCenter for registering your mobile apps

 

Important Note:

Before you submit your application to the app store, make sure to set the TestMode to false (it’s true by default) and set the correct values for ApplicationId and AdUnitId’s. We will discuss this in the Advanced Concepts post.