Monetize Your Site

Banner Rectangle Interstitial

Interstitial Ads

Description and Use Cases

Interstitial Ads are full-page ads that display before the expected content. These ads often result in higher eCPM for publishers.

###Basic Integration This section will discuss how to do basic integration of Integration Ads for the Javascript Ad Tag.

1. Add the ad container

The Javascript Ad Tag requires an element for the ad to be placed in. For interstitial ads, the placement will not matter, but the element is still required. The id of this element can be anything you choose, but the id will be required for the ad call. The ad container should NOT use padding. The same effects can be achieved using margins or other styling if desired. Please note the special requirements if the ad container is being placed within an iframe. An example element is shown below.

<div id="adContainer"></div>
2. Add the Javascript Ad Library

Add the Javascript Ad Library script to your site.

<script src="http://cdn.millennialmedia.com/mmadlib/v1/mmadlib.js"></script>
3. Add the Javascript Ad Tag

Insert the Javascript Ad Tag to initialize the ad. The containerElementId must be the id of the ad container created in Step 1. In the example provided below, note that <YOUR_APID> must be replaced with your actual APID. Also, placementType must be set to “interstitial.” The callBack parameter is optional. Please see our API section for further details on the placeAd call.

<script>
    window.mmAPI.placeAd({
        containerElementId: "adContainer",
        apid: "<YOUR_APID>",
        placementType: "interstitial",
        allowLocation: true
    });
</script>

The same example with a callback function would look as follows.

<script>
    function callBack(adFilled) {
         //adFilled will be true if the ad fills, else it will be false
        console.log("was the ad filled: " + adFilled);
    };

    window.mmAPI.placeAd({
        containerElementId: "adContainer",
        apid: "<YOUR_APID>",
        placementType: "interstitial",
        allowLocation: true
    }, callBack);
</script>

Advanced Topics