author | ms.assetid | description | title | ms.author | ms.date | ms.topic | ms.prod | ms.technology | keywords | ms.localizationpriority |
---|---|---|---|---|---|---|---|---|---|---|
mcleanbyron |
bb105fbe-bbbd-4d78-899b-345af2757720 |
Learn how to add application ID and ad unit ID values from the Windows Dev Center dashboard to your app before you submit your app to the Store. |
Set up ad units in your app |
mcleans |
10/04/2017 |
article |
windows |
uwp |
windows 10, uwp, ads, advertising, ad units, testing |
medium |
Every ad control in your Universal Windows Platform (UWP) app has a corresponding ad unit that is used by our services to serve ads to the control. Each ad unit consists of an ad unit ID and application ID that you must assign to the AdControl, InterstitialAd, or NativeAd in your app.
We provide test ad unit values that you can use during testing to confirm that your app shows test ads. These test values can only be used in a test version of your app. If you try to use test values in your app after you publish it, your live app not receive ads.
After you finish testing your UWP app and you are ready to submit it to Windows Dev Center, you must create a live ad unit from the In-app ads page in the Windows Dev Center dashboard and update your app code to use the application ID and ad unit ID values for this ad unit.
While you are developing your app, use the test application ID and ad unit ID values from this section to see how your app renders ads during testing.
-
Ad unit ID:
test
-
Application ID:
3f83fe91-d6be-434d-a0ae-7351c5a997f1
[!IMPORTANT] For an AdControl, the size of a live ad is defined by the Width and Height properties. For best results, make sure that the Width and Height properties in your code are one of the supported ad sizes for banner ads. The Width and Height properties will not change based on the size of a live ad.
- Ad unit ID:
test
- Application ID:
d25517cb-12d4-4699-8bdc-52040c712cab
To get a live ad unit from the Dev Center dashboard and use it in your app:
-
Create an ad unit on the In-app ads page in the dashboard. Be sure to specify the correct type of ad unit for the ad control you are using in your app.
[!NOTE] You can optionally enable ad mediation for your ad unit by configuring the settings in the Mediation settings section. Ad mediation enables you to maximize your ad revenue and app promotion capabilities by displaying ads from multiple ad networks, including ads from other paid ad networks and ads for Microsoft app promotion campaigns. By default, we automatically choose the ad mediation settings for your app using machine-learning algorithms to help you maximize your ad revenue across the markets your app supports, but you can optionally manually configure your mediation settings.
-
After you create the new ad unit, retrieve the Application ID and Ad unit ID for the ad unit in the table of available ad units in the Monetize > In-app ads page.
[!NOTE] The application ID values for test ad units and live UWP ad units have different formats. Test application ID values are GUIDs. When you create a live UWP ad unit in the dashboard, the application ID value for the ad unit always matches the Store ID for your app (an example Store ID value looks like 9NBLGGH4R315).
-
Assign the Application ID and Ad unit ID values in your app's code:
-
If your app shows banner ads, assign these values to the ApplicationId and AdUnitId properties of your AdControl object. For more information, see AdControl in XAML and .NET and AdControl in HTML5 and JavaScript.
-
If your app shows interstitial ads, pass these values to the RequestAd method of your InterstitialAd object. For more information, see Interstitial ads.
-
If your app shows native ads, pass these values to the applicationId and adUnitId parameters of the NativeAdsManager constructor. For more information, see Native ads.
-
You can use multiple banner, interstitial, and native ad controls in a single app. In this scenario, we recommend that you assign a different ad unit to each control. Using different ad units for each control enables you to separately configure the mediation settings and get discrete reporting data for each control. This also enables our services to better optimize the ads we serve to your app.
Important
You can use each ad unit in only one app. If you use an ad unit in more than one app, ads will not be served for that ad unit.