Updated: October 17, 2013
Published: June 27, 2013
From the Solution Explorer window, double click the “package.appxmanifest” file.
Click the Capabilities tab and ensure that Internet Client is checked, as shown below. Without this capability, the ad client cannot make calls to the internet to fetch ads.
From the Solution Explorer window, right click References, and select Add Reference…
Click Windows, and then Extensions. Select Microsoft Advertising SDK for Windows 8.1 (JS). Then click OK.
Confirm that your reference was added. Your Solution Explorer should look similar to the following:
Open the default.html file (or other html file as appropriate for your project).
<!-- Microsoft Advertising required references --> <script src="/MSAdvertisingJS/ads/ad.js" ></script>
This line must be placed in the <head> section after the include of default.js; otherwise, you will encounter an error when you build your project.
Modify the <body> section in the default.html file (or other html file as appropriate for your project) to include the following:
Compile and run the app to see it with an ad, similar to the following:
Complete default.html for a Sample Project
You can drag the ad.js file from the Project Explorer window to the <head> section of the default.html file and the code for the AdControl will insert automatically.
Follow the walkthrough above through step 6. For Step 7, drag the ad.js file from the Project Explorer window to the <head> section of the default.html file. Continue on from Step 8.
Follow the walkthrough above through step 5. Then in VS right-click the project (not the solution) in Project Explorer and from the context menu look down at the bottom entries and click Open in Blend. From Blend, in the Assets tab, under Advertising you can drag and drop the AdControl onto the design space.
Consult the TestMode section for various AdUnitIds to see a variety of ads, and the API reference for additional targeting properties, methods for doing manual ad refreshes, callback functions, and more.
Support and Feedback
Get product support or report a bug in the advertising SDK by visiting the Windows 8 Dev Center support page (scroll down to the section "Microsoft Advertising support").
Send feedback about this documentation to email@example.com. There is no product support through this alias. Documentation feedback only.