Would you like Ads with that!–Intro to AdRotator for WP7

 

One of those things we always strive for when we write games and apps for a platform is the hope of some recognition for our efforts or failing that a huge pile of cash to admire from our yacht parked in some temperate climate Open-mouthed smile

The subject of how to achieve the latter is always up for debate, do you just ship out your game/app with a nice and affordable price tag  or push it out free and use Ads or In App purchasing to reach that goal, both have merits but why not do both. (also if you offer a trial you can embed the ads and turn them off when the app has been bought!)

All of this is made all the more simpler through the use of the AdRotator control, just drop it in your project with your Ad Account settings and your done! (with a little placement) so lets see just how easy this is.!

 

As usual full source for the Starter projects can be found on Codeplex Here and you can find out more info and download AdRotator from Codeplex here

** Update

V1 of the Silverlight version of AdRotator has now been released with these additional features

  • Default House Ads – You now have the capability to design and implement your own Ad within AdRotator and have it displayed within the Ad Roll, the big benefit of this is that if there is no network available it will now still have an Ad to display (previously no Ads would display).  If you just want it as a fall-back Ad then don’t configure a probability against the Default House Ad.  It’s also completely optional so if you don’t want it just don’t configure it Open-mouthed smile
  • PubCenter Bug fixed but it does require you to update your implementation slightly, details below
  • Publisher configuration now possible in the configuration XML file – now you have two options to configure your Publisher ID’s, either as before hard coded into each pages XAML or code behind OR you can now also configure it in the configuration XML. If you configure both then the Hard Coded values will take precedent, details below.

**HOT NEWS

The XNA version of AdRotator has now been released, check it out on Codeplex here and read all about it’s use in this blog post


Enter AdRotator for WP7

AdRotator is a multi Ad host provider control which also support failover of ad networks to always ensure you get an ad to display in your app or game and thus ensuring better fill rates for your ad providers.

Currently Ad Rotator supports the following networks:

    Microsoft PubCenter
    AdDuplex
    Google AdMob
    Inner-Active
    MobFox
    Smaato

It offers several features such as:

    Multiple Concurrent Ad Provider support
    Failover support (if Ad not delivered it moves to the next Ad Provider)
    Remote Configuration (through external URL)
    Popup support (for scenarios where Ads are a Nag or you don’t have enough real-estate for permanent Ads )
    “*New for V1 Publisher configuration in external XML file 
    **New for V1 Default House Ads (Developer Ads)  

All this and it’s just a single control that you can drop into the Silverlight pages in your apps/games

Granted it’s only for Silverlight at present but it has plans for an XNA version in the near future

XNA Version now released here and instructions here


Getting started with those Ad Networks

First off make sure you’re registered with all the appropriate ad networks as follows:

If you already have all the Ad Providers you want then jump past this section to “Right, Getting your Ad On”!

Pubcenter (Microsoft)

Pubcenter is Microsoft’s Ad network, it has the highest pay-out rates in the US, one thing to check is if your county is supported for publishing Ads as it’s only recently expanded outside the US with other countries on the roadmap.

image

Login / Sign up to Pubcenter using your Microsoft Live ID and register a new app / Ad Unit, this will create your new account and setup your first application also select 3 Categories of ads to be served to your app and a Banner size of “480×80 XX-Large banner”.

Note down the Application ID and Ad Unit ID for use later:

image

If you already have an account, be sure to setup BOTH an application and an Add Unit ID as shown below:

image

AdDuplex

AdDuplex is an App Sharing network, not really focused on Ad Revenue but rather cross promotion of your apps.  They do offer some cash generating options but is it business orientated and requires you to pay for the service.  Check back often though as they are always doing offers and competitions.

image

Once you have registered your account and logged on, create a new app

image

Next Create a new Ad

image

Next up you need to decide what text to be displayed in other apps as 4 separate text lines (displayed in pairs)

image

If your app is already on the marketplace then place the DeepLink for your app in the APP ID field, if not just leave it blank for now

Once done then just record the APP ID from the Ad details:

image

AdMob (Google)

AdMob has been around for ages and is the premier Ad Provider on Android (no surprise there) but also has clients on most devices, however this wide spread does have a downturn impact on the income you can generate from displaying ads and registered clicks, still it’s a robust network and good to have

Visit the site logon using your google ID and click on “Get Started” button and register your details for AdMon, with that done “Create a New App”:

image

Once you’ve selected the Windows 7 Option you will be presented with the Ad details:

image

Once created navigate back to the app lists and select “Manage” against your new app, then note down the Publisher ID:

image

InnerActive

InnerActive is one of the new boys to the Ad Provider network, their signup process is still a but clunky and required you to talk to a representative but they have a good sturdy platform.

Navigate to the site and click on “Getting Started”

image

Now here’s where it stops for a while with Inneractive, you’ll get a mail to activate your account and some contact to set up your Ad Unit ID, once you have that keep it safe, it should look something like this:

“DavideCleopadre_ClockAlarmNightLight_WP7”

MobFox

Another stable platform for use in delivering Ads, not much more to say on this as I’ve not personally had much experience with them.  We did have a few challenges with the client on WP7 but all good now.

Go to the site and click on the link to register as a Publisher:

image

Once logged in click on the link to “Create your mobile application or website” and you will be taken to the following screen:

image

After you have selected WP7 Application you then need to enter the details for your app as follows:

image

Lastly you will be presented with your Publisher ID, keep it safe for later:

image

Smaato

Smaato is heralded as one of the highest paying Ad Providers and from what I’ve seen this is no boast, however their fill rates (percentage between Ads requested and Ads Served) average around 50% and mainly only in the US but if you get ads from them you can be sure of a good kickback (my preferred provider)

For Smaato, create a new account making sure to select “Both” on the question about “I want Ads for”.

When you first logon you’ll be asked to enter payment details, you can either do this now or later.

When you get the main account screen up, click on the “Create Ad Space” button and you will be presented with the following screen:

image

Once you’ve setup your ad space you’ll have an Ad Space ID and Publisher ID, make sure you make a reference of these:

image

One tip with Smaato, you will get more Ads and references if you fill out your profile for the Ad Space, just click on the Icon under profile to do this.  It’s important that you supply the Marketplace Deep link on your profile to start generating revenue!


Last Minute Tip

Be sure to revisit your Ad providers and update your payment information and profile information, this enables advertises to get excited about your project and increase interest for supplying Ads.

It’s important to tell the Ad Providers all you can about your Ad schemes so they can best represent you with advertisers.


Right, Getting your Ad on

SO you got all your Ad accounts setup (granted you only need to sign up for as many as you want/need to), time to put them to use.

You have two options (as in most cases) either you can copy the AdRotator project into your project or just add the AdRotator DLL to your project as a reference, both approaches are detailed below:

Reference Project (Starter 2D SilverXNA Project)

    Create a New folder in your project called AdRotator
    Copy the AdRotator DLL in the AdRotator folder
    Copy all the DLL references for the Ad Networks you wish to use in the AdRotator folder
    **Update The library download now contains all DLL’s for use with the project, copy all of these to your new folder 
    Add all the new DLL’s as references to the project
    If you are using Pubcenter then add the default references as well (shipped as part of the WP7 tools)

Copy Project ** Updated

Although it is still possible to do this method we recommend you just reference the project using the instructions above, this is mainly due to some of the changes in the project structure and our roadmap to V2 and Windows versions.

    Download the source for the AdRotator Solution into a folder in your project, alternatively use an SVN client to synch the project
    Add the main AdRotator project to your solution as an existing project
    Add the AdRotatorSharedModel project to your solution as an existing project (Check it is referenced from the AdRotator Project)
    Reference the project in your solution


Implementing the control

At this point with most WP7 / Silverlight development you can either add the control (once you have built it) in Blend or just cut and paste the following XAML in as the base template formatted for where you want to place it (as shown in the SilverXNA projects)

<adRotator:AdRotatorControl x:Name="AdRotatorControl" Width="480" Height="80" 
            DefaultSettingsFileUri="/Starter3DGame;component/defaultAdSettings.xml" 
            SettingsUrl="http://XNA-UK.NET/defaultAdSettings.xml" 
            PubCenterAdUnitId="10029821" PubCenterAppId="78b9455f-db44-4de8-b0c3-1a91784790cd" 
            AdDuplexAppId="7687" 
            AdMobAdUnitId="a14f2fe26380243" 
            InneractiveAppId="ZenithMoon_HumanImpact_WP7" 
            MobFoxAppId="772ab6d4fcceed40a6c98436af4443ff" MobFoxIsTest="False" 
            SmaatoPublisherId="923855310" SmaatoAppId="65754722" /> 

Most of the default settings should be fairly obvious and you just need to replace the configuration values for each of the Ad Providers, the rest of the options are configurable as follows:

Property Description
DefaultSettingsFileURI

Local Configuration file for ad networks to use, configured in the format of :
Assembly Name of solution with file + “;component/” + Path and filename

SettingsUrl

URL of hosted configuration file (read only) this overwrites the local configuration if found (good for re-configuring solutions remotely)

DefaultAdType

The Primary ad provider to use

SlidingAdDirection
(previously SlidingAdType)

Popup / slide behaviour, options include Top, Bottom, Left and Right.  default is None which just displays a static ad on the screen.
When enabled it hides the ad off screen and gets a new ad on it’s return

SlidingAdDisplaySeconds

How many seconds the ad should remain on screen when the Slide direction has been configured
Default: 10 seconds

SlidingAdHiddenSeconds

How many seconds the ad should remain off screen when the slide direction has been configured
Default: 20 seconds

For more information regarding the configuration of AdRotator see the CodeProject documentation here

Default House Ad configuration

With the Default House Ad functionality you can design your own ad for use within Ad Rotator, this is useful for situations where there is no network connectivity to get new ads and you still want to preserve the Ad presence, it’s also good for showing off other products or offerings while the Ads fly by.

To use this simply create a User control with the dimensions of 480wx100h with what ever content you see fit and then add this line in the Constructor for your page (so that you can also use different ads for different pages if you wish) as follows:

AdRotatorControl.DefaultHouseAdBody = new MyDefaultAd();

Where “MyDefaultAd” is the name of the user control you have created, you can also either hook up the Tap/Click event inside your control to do something (like browse to the marketplace or your website) when clicked or wire it up separately outside the control if you want it to do different things on different pages.

An example of the use of this feature can be found in the example app as part of the library download.

PubCenter Handling and general implementation advice

As an extension to the implementation advice which combats the known issue with the PubCenter control but is also good for maintaining a healthy app is to clear down the AdRotator control on leaving the page and re-instating it on return.  This is not specifically necessary as we handle a lot of this within the control but it is a good practice to be in.

So if you are using PubCenter then this is mandatory if you want your app to pass certification on the marketplace and advisory if you are not using it.

To implement this as stated before, add the following line to each pages that you have added the control in the “OnNavigatedFrom” method

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
	AdRotatorControl.Dispose(); // <- Add this line just before the Base call
	base.OnNavigatedFrom(e);
}

And in the “OnNavigatedTo” method

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
	AdRotatorControl.Invalidate(); //<-- Add this line at some point before the base call
	base.OnNavigatedTo(e);
}

If you don’t have those overrides in your app already you can add them by simply typing “override OnN” and selecting the correct method from the list to automatically add it.


The AdRotator configuration file

One of the features that most impresses me with AdRotator is it’s support for setting the configuration of which ad providers to use and in what frequency through the use of an XML configuration file, what makes it extra special is that it allows the configuration to be downloaded from an external site so you can re-configure which ads to use (to maximise your cash generation) on the fly without re-submitting your apps/games.

It also gives you the ability to set different configurations based on the country / market the app is running in (from the culture setting on the phone)

Here’s what the sample configuration file looks like:

<?xml version="1.0" encoding="utf-8"?> 
<AdSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <CultureDescriptors> 
        <AdCultureDescriptor CultureName="en-US"> 
      <Probabilities Probability="16" AdType="Smaato" AppID="<Insert Smaato AppID here>" SecondaryID="<Insert Smaato Publisher ID here>"/> 
      <Probabilities Probability="16" AdType="AdMob" AppID="<insert AdMob App ID here>"/> 
      <Probabilities Probability="15" AdType="InnerActive" AppID="<Insert InnerActive APPID here>" /> 
      <Probabilities Probability="15" AdType="MobFox" AppID="<Insert MobFox APP ID here>" IsTest="false"/> 
      <Probabilities Probability="40" AdType="PubCenter" AppID="<Insert Pubcenter APP ID here>" SecondaryID="<inserrt Pubcenter AD Unit ID here>" /> 
      <Probabilities Probability="10" AdType="AdDuplex" AppID="<insert AdDuplex AD ID here>"/> 
      <Probabilities AdType="DefaultHouseAd"/> 
    </AdCultureDescriptor> 
        <AdCultureDescriptor CultureName="en-GB"> 
      <Probabilities Probability="20" AdType="Smaato" AppID="<Insert Smaato AppID here>" SecondaryID="<Insert Smaato Publisher ID here>"/> 
      <Probabilities Probability="10" AdType="InnerActive" AppID="<Insert InnerActive APPID here>" /> 
      <Probabilities Probability="10" AdType="MobFox" AppID="<Insert MobFox APP ID here>" IsTest="false"/> 
      <Probabilities Probability="10" AdType="AdDuplex" AppID="<insert AdDuplex AD ID here>"/> 
      <Probabilities Probability="20" AdType="AdMob" AppID="<insert AdMob App ID"/> 
      <Probabilities Probability="20" AdType="PubCenter" AppID="<Insert Pubcenter APP ID here>" SecondaryID="<inserrt Pubcenter AD Unit ID here>" /> 
      <Probabilities AdType="DefaultHouseAd"/> 
    </AdCultureDescriptor> 
        <AdCultureDescriptor CultureName="de-DE"> 
      <Probabilities Probability="25" AdType="Smaato" AppID="<Insert Smaato AppID here>" SecondaryID="<Insert Smaato Publisher ID here>"/> 
      <Probabilities Probability="25" AdType="PubCenter" AppID="<Insert Pubcenter APP ID here>" SecondaryID="<inserrt Pubcenter AD Unit ID here>" /> 
      <Probabilities Probability="25" AdType="AdMob" AppID="<insert AdMob App ID here>"/> 
      <Probabilities Probability="25" AdType="AdDuplex" AppID="<insert AdDuplex AD ID here>"/> 
      <Probabilities AdType="DefaultHouseAd"/> 
    </AdCultureDescriptor> 
        <AdCultureDescriptor CultureName="default"> 
      <Probabilities Probability="16" AdType="Smaato" AppID="<Insert Smaato AppID here>" SecondaryID="<Insert Smaato Publisher ID here>"/> 
      <Probabilities Probability="16" AdType="AdMob" AppID="<insert AdMob App ID here>"/> 
      <Probabilities Probability="16" AdType="InnerActive" AppID="<Insert InnerActive APPID here>" /> 
      <Probabilities Probability="16" AdType="MobFox" AppID="<Insert MobFox APP ID here>" IsTest="false"/> 
      <Probabilities Probability="16" AdType="PubCenter" AppID="<Insert Pubcenter APP ID here>" SecondaryID="<inserrt Pubcenter AD Unit ID here>" /> 
      <Probabilities Probability="16" AdType="AdDuplex" AppID="<insert AdDuplex AD ID here>"/> 
      <Probabilities AdType="DefaultHouseAd"/> 
    </AdCultureDescriptor> 
    </CultureDescriptors> 
</AdSettings>

 

As you can seen the file is fairly self explanatory, each section lists the Ad Providers to use and a probability in which the Ad will be selected at random.  Just set the Ads you want to “Try” and deliver more often with a higher percentage.

In the end the control will verify valid ad providers (one’s that are actually delivering ads for your region) and just use that work, this is re-evaluated each time your app is run.

When you have configured your file, just copy it to the Root of your main project and update the “DefaultSettingsFileURI” property in each page you use the control, you can create a central resource for the control but we have found that it’s better to just enable it on each page you want ads as it re-evaluates the ad providers when the page is opened which can help pick up the latest ads.

Optionally if you have your own website where you can drop your configuration file, then be sure you also configure the “SettingsUrl” property and MAKE SURE you can browse to the file and it’s not blocked by your sites security settings


Conclusion

AdRotator is a quick and simple to use control and enables you to support multiple Ad Networks concurrently with failover support  to always ensure you will display an ad on screen when some providers fail to deliver.

I’ve updated both of the SilverXNA solutions from the Starter tutorial set and published their updates to the marketplace (should be live any day now) so you can check them out.

What are you waiting for Go Get some Ads.

image image

The Starter 2D app with Ads in Game
(using the Slider option)

The Starter 3D app with Ads

Total time taken to put ads in both these projects 10 mins!  Beat that Open-mouthed smile

 

 

I’ve also put the new ad control into my Current game on the marketplace and in a bit of shameless self promotion I’ll point it out here Open-mouthed smile

“Flipped” is a Tile matching fun game with several difficulties and challenges ranging from simple 2/3 and 4 tile matching to time trials / bomb dodging and one final dual tile madness extravaganza, available both as Free (ad supported now with AdRotator) and Buy/Trial.

For more details visit zenithmoon.com

Screenshot Screenshot3
Screenshot4 Screenshot5
download downloadfree

Please spread the word if you can, thanks for supporting

  • Yannick Tchegho

    Dear Simon

    I am not an english speaker ,so excuse my english

    I have found that Admod will stop WP7 Ad supporting at the end of september 2013,So it will be a problem implementing Adrotator , because of no way to add WP7 in Admob .how should we achieve using this again ?

    • http://zenithmoon.com Simon (darkside) Jackson

      Google have been saying they are going to kill AdMob for almost a year now, nothing has happened as yet.
      The whole goal of that is to move devs off AdMob onto their new service AdSense (which has stricter rights)
      So long as AdMob is running, AdRotator will continue to support it for those dev’s that use it, both in V1 and V2.
      Thankfully though AdRotator supports multiple providers and keeps adding more when time permits so we always have other options.

%d bloggers like this: