Interstitial Ads

If you are not able to show inline ads in your mobile website, you should opt for full-screen interstitial ads. These ads are shown without needing space inside your site, as they will overlay the web page content. Interstitial ads can either be shown automatically, as soon as they are ready to be shown or after a user action (e.g., user finished reading an article).

Interstitial ads can also be dismissed via a close button by the user at any time. In order to enable Interstitial ads, you need to first set the dimension to full-screen interstitial (appropriate dimension should be used for tablet and phone) and activate the full-screen mode. All you need are the following lines:

<div id="smaatoad" style="padding:0px"></div>
<script type="text/javascript" src="https://soma-assets.smaato.net/js/smaatoAdTag.js"></script>
<script>
    SomaJS.loadAd({
        adDivId: "smaatoad",
        publisherId: REPLACE_WITH_PUBLISHER_ID,
        adSpaceId: REPLACE_WITH_ADSPACE_ID,
        autoReload: 240,
        dimension: "full_320x480",
        dimensionstrict: true
    });
</script>

For mobile phone and tablet ad dimensions, please use the following options:

Ad Dimension Type Ad Orientation Code Entry Method
Interstitial ads (mobile phone) Portrait full_320x480
Landscape   full_480x320
Interstitial ads (tablet) Portrait full_768x1024
Landscape   full_1024x768

In Combination With Optional Callbacks

Full-screen ads can be used in combination with some optional callbacks that will notify you on user actions and ad states.

  1. shouldShowModal: If this callback is defined, it has to return true or false. If it returns true, the modal will be presented. Otherwise it will be discarded.
  2. modalClosedCallback: If defined, this callback will be called once the modal is closed by the user.

Example:

<div id="smaatoad" style="padding:0px"></div>
<script type="text/javascript" src="https://soma-assets.smaato.net/js/smaatoAdTag.js"></script>
<script>
SomaJS.loadAd({
    adDivId: "smaatoad",
    publisherId: REPLACE_WITH_PUBLISHER_ID,
    adSpaceId: REPLACE_WITH_ADSPACE_ID,
    modalDisplay: true,
    shouldShowModal: function() {
        console.log("Modal is going to be shown!");
        return true;
    },
    modalClosedCallback: function() {
        console.log("The modal is closed!");
    },
    dimension: "full_320x480"
});
</script>

The second option is showing the fullscreen interstitial ad after a user action. To enable this, you need to specify it in the Ad Tag integration and also enable caching ads in the background, along with the modalDisplay parameter. The shouldCacheModalparameter should also be set as true.

Modified: September 24, 2019 at 8:35 pm