Udostępnij za pośrednictwem


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.

Comments

  • Anonymous
    April 13, 2011
    The downloaded help file (.chm) is static. The documentation online is at: msdn.microsoft.com/.../ff973757(v=MSADS.10).aspx and is updated as issues are raised and resolved.

  • Anonymous
    December 05, 2011
    Does this also work for XNA programs? If so, how do we use this method for XNA. Is it pretty much the same thing?

  • Anonymous
    August 11, 2012
    These ads are so annoying how do i disable them so i don't see them in apps?

  • Anonymous
    August 12, 2012
    @David, disabling ads in apps is something that developers can usually do in the code. If there is a paid version of the ad, you might want to consider buying it to avoid seeing the ads. As a user, you can disable your network on your mobile for not getting ads

  • Anonymous
    November 28, 2012
    The comment has been removed

  • Anonymous
    November 28, 2012
    The comment has been removed

  • Anonymous
    December 10, 2012
    do you still need to set the testmode to false? I've just implemented this and there's no method called TestMode for Microsoft.Advertising.Mobile.UI.AdControl. Most other posts say you need to this but the posts are from 2010. Has this changed?

  • Anonymous
    May 28, 2014
    Can anyone tell me that does developer got paid when user only saw there add and not clicking on those adds banners? And if you have idea please let me know what is the average revenue for developer on 1 advertisement on per view or per click?