- Install the Visual Studio Extension by searching for AdDuplex in the Visual Studio Gallery directly from within Visual Studio (Tools > Extensions and Updates > Online > Visual Studio Gallery) or just get it from the Gallery web page.
- From the Solution Explorer window, right click References, and select Add Reference…
- Click Windows, and then Extensions. Select AdDuplex SDK for Windows 8 (WinJS edition). Then click OK.
- Open the default.html file (or other html file as appropriate for your project).
- In the <head> section, after the project’s JavaScript references of default.css and default.js, add the reference to AdControl.js.
<script src="/AdDuplex/js/AdControl.js"></script>
Note: 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:
Current version of AdDuplex for Windows 8 supports these ad sizes: 160x600, 250x125, 250x250, 292x60, 300x250, 500x130, 728x90.<div id="adDuplexAd" data-win-control="AdDuplexJs.Controls.AdControl" data-win-options="{appId: 'YOUR_AppId_HERE', size:'250x125'}" />
- Make sure the whole AdControl is visible by verifying that it's not obstructed by any other objects on your page.
- You can preview your own exchange ad by setting isTest property to true.
- When navigating use setup() to start and dispose() to stop loading ads. The dispose() method will prevent memory leaks and save network traffic.
Example snippet:
This is not required only if page navigation is accomplished through hyperlinks.WinJS.UI.Pages.define("/pages/home/home.html", { ready: function (element, options) { adDuplexAd.winControl.setup(); }, unload: function () { adDuplexAd.winControl.dispose(); } });
Windows 8.0 WinJS Control Installation and Usage
Follow
Have more questions? Submit a request
Comments