MRAID is an industry standard API for rich media ads running in mobile applications (http://www.iab.net/mraid). It provides banner ads with a standard way to expand/collapse banners and handle other situations that are not possible in a mobile application environment.
Defined in mraid
addEventListener(event, listener, opt_capture, opt_handlerScope)
Adds an observer for events dispatched by the ad environment. The supported events are:
Downgrades the state of the ad. It will also fire the
Causes the ad experience to go full-screen to the size of the device, dispatching a
Returns the expand properties. Refer to mraid.ExpandProperty.
Returns the version of MRAID specification in use. Ad developers can use this method to confirm a basic feature set at runtime.
Returns whether the ad container is currently on or off the screen. The viewableChange event fires when the ad moves from on-screen to off-screen and vice versa. This is helpful when the ad is of type mraid.PlacementType.INTERSTITIAL. An interstitial loads off the screen, so wait for it to be on-screen before starting animations, timers, etc.
Opens an external URL in a browser. On iOS the browser window remains in the application. On Android the native browser is invoked.
removeEventListener(event, listener, opt_capture, opt_handlerScope)
Unsubscribes a specific handler method from a specific event. Event listeners should always be removed when they are no longer useful to avoid errors. If no listener function is provided, then all functions listening to the event will be removed.
Sets the expand properties. The expand properties object is intended to provide additional features to ad designers. In MRAID v.1.0, expand properties that can be set by the ad designer are limited to the width and height of the ad creative in pixels, and whether the creative is supplying its own close indicator.
Refer to mraid.ExpandProperty.
Sets the useCustomClose of expand properties. This method serves as a convenience method to mraid.ExpandProperty.useCustomClose. Setting the property or calling this method both have the same effect and can be used interchangeably. If an ad sets useCustomClose via both expand properties AND this method, whichever is invoked later will override the earlier setting. They signal the SDK to stop using the default close indicator.
useCustomClose is called
and/or the property is set.
Events dispatched when the ad's state changes. To listen for these events use the addEventListener method.
The expand properties is intended to provide additional features to ad designers. They are used in setExpandProperties
Placement Type. For efficiency, ad designers sometimes flight a single piece of creative in both banner and interstitial placements. So that the creative can be aware of its placement, and therefore potentially behave differently, each ad container has a placement type determining whether the ad is being displayed inline with content (i.e. a banner) or as an interstitial overlaid content (e.g. during a content transition). The SDK returns the value of the placement to creative so that creative can behave differently as necessary. The SDK does not determine whether a banner is an expandable (the creative does) and thus does not return a separate type for expandable.
State of the Ad. To access the state of an ad use the getState method.