Monetize Your Site

Banner Rectangle Interstitial

Rectangle Ads

Description and Use Cases

Rectangle Ads are 300x250 sized banners. We recommend using Rectangle Ads inline with content on smartphone targeted sites, and in the corners of sites targeted at tablets.

###Basic Integration This section will discuss how to do basic integration of Rectangle 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. This element should be placed wherever you would like the ad displayed on the site. 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, note that <YOUR_APID> must be replaced with your actual APID. Also, “placementType” must be set to “inline.” 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: "inline",
        width: 300,
        height: 250,
        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: "inline",
        width: 300,
        height: 250,
        allowLocation: true
    }, callBack);
</script>

Advanced Topics