A Quick Sample App For Monetizing Apps With Microsoft Advertising AdUnits
Just a quick post in case anyone is wondering how to monetize their UWP apps using Microsoft's Advertising framework.
The good news? I found it to be very simple and straight forward, although there are a couple of caveats to be aware of.
It's Easy - Let's get started
First, log into your Windows Dev Center account. On the left hand navigation bar click on Monetize - In-app ads. Then click on the Create ad unit button. Fill in a handful of self explanatory parameters for your new ad unit, and click the Create ad unit button to save. Congratulation, you have just created your first live AdUnit.
Download and install the Microsoft Advertising SDK for XAML
Grab the SDK from the Microsoft web site, and run the installer. Once done, open up your app's project in Visual Studio and add a Reference to the Microsoft Advertising SDK for XAML. To do this right click References - Add Reference - Universal Windows - Extensions. Tick the box for the SDK and click OK.
Bake your shiny new ad unit into your UWP XAML App
This step is easy. But don't be tempted to embed your live ad unit while still developing/debugging your app. It is against Microsoft policy to run live ad units in the debugger and I am pretty sure they would not be pleased - so just don't do it.
Instead, use a test ad unit. Microsoft thankfully provide such a test ad unit with generic IDs. So the XAML will look something like this:
xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
<!-- Test AdControl -->
<UI:AdControl
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Height="50"
Width="320"
Margin="0,20,0,20"/>
The key pieces here are the using: statement referencing Microsoft.Advertising.WinRT.UI, and the ApplicationId and AdUnitId tags. The values here are the generic test ones which you can use exactly as they are. These will tell the Microsoft Advertising framework to serve up test ads so you can ensure it all works.
For mobile apps, there are a couple of banner sizes that are recommended specifically, as they work best. I am relatively sure you can use any of the approved sizes, but maybe best stick to the recommended ones for Windows Phone apps.
Voila, you are ready to earn money with your App - Almost, anyway
Pretty close... A couple of extra steps are required first. Once you are happy with your app and you are ready to submit it to the Microsoft Store, change the XAML for your AdControl to use live ApplicationID and AdUnitId tags. Where do you get these from you might ask? Aha, since you paid attention to this post, you know that you can get the live Id tags from your Windows Dev Center, right?
Put the live Id tags into your app, and then follow the standard processes to package and submit the app to the Microsoft Store. Visual Studio makes this very easy, and there is excellent documentation available from Microsoft on the whole end to end process.
Once your submission is fully approved, your app will be available to customers for download, ready for you to start making money.
Wrapping Up - Grab Heads-Or-Tails app from the Microsoft Store
Hope you enjoyed this post. Any questions just leave a comment or send me an email.
Oh, and if you feel like it, go grab the app from the Store and use it to help you make those tricky decisions in life - after all, it's a tricky, age old question: Heads Or Tails?
Cheers
MB
Further Information
Monetize your App with Ads - Windows Developer Documentation
No comments:
Post a Comment