Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
JavaScript Callback Events - Windows 8.0

JavaScript Callback Events - Windows 8.0

Microsoft Advertising Services

Updated: August 2, 2013

Published: June 4, 2013

In the HTML5 (JavaScript) and JavaScript Without HTML5 Tags examples, there are optional events that you can handle in code. The following snippets provide examples of how to define them.

The AdControl events must be enclosed by the MarkSupportedForProcessing function.

The snippets assume you have assigned the events to their event handlers, either in an HTML or JavaScript file. For example: myAdControl.onErrorOccurred = myAdError.


window.myAdError = function (sender, msg) {
  // place code here for when there is an error serving an ad.
  // e.g. you may opt to show a default experience, or reclaim the div for other purposes.

window.myAdRefreshed = function (sender) {
  // place code here that you wish to execute when the ad refreshes.

window.myAdEngagedChanged = function (sender) {
  if (true == sender.isEngaged) {
    // code here for when user engaged with ad, e.g. if a game, pause it.
  else {
    // user no longer engaged with ad, include code to unpause.

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 adsfdbk@microsoft.com. There is no product support through this alias. Documentation feedback only.

Community Additions

© 2015 Microsoft