Banner - tapdaq/cordova-plugin GitHub Wiki

Banner

Contents

Banners are small visual ads that appear inside your application covering a small portion of the screen. The ad is not closed by the user, but is instead dismissed programmatically.

Please make sure that the refresh interval in the ad network dashboard is disabled, otherwise you may experience unexpected behaviour.

1. Load

To load an banner, add the following to your application:

const loadOpts = {
    didLoad: function(response) {
        // banner ad loaded
    },
    didFailToLoad: function(error, response) {
        // banner ad failed to load
    }
};

Tapdaq.loadBanner("my_banner_tag", Tapdaq.BannerSize.Standard, loadOpts);

The banner needs to be loaded for a specific size. You can see a full list of Tapdaq.BannerSize here.

Alternatively, you can load a banner giving a custom size, the SDK will attempt to load an ad that closely resembles the required dimensions.

Tapdaq.loadBanner("my_banner_tag", { width: 300, height: 150 }, loadOpts);

2. Display

To display the video we recommend using the didLoad() listener. To do this, create a callback method and subscribe it to the didLoad() listener before loading the ad.

Banners can be placed at the top or bottom of the screen, use the Tapdaq.BannerPosition parameter to set this.

const loadOpts = {
    didLoad: function(response) {
        Tapdaq.showBanner("my_banner_tag", Tapdaq.BannerSize.Standard);
    }
};

Alternatively, you can provide a custom position on the screen to display the banner, like so:

const loadOpts = {
    didLoad: function(response) {
        Tapdaq.showBanner("my_banner_tag", { x: 100, y: 500 });
    }
};

It is also possible to check the banner is loaded before displaying it to the user, as shown below:

Tapdaq.isBannerReady(function(isReady) {
    if (isReady) {
        Tapdaq.showBanner("my_banner_tag", Tapdaq.BannerPosition.Top);
    }
});

3. Hide

To temporarily hide a banner from the screen at any time, use the following code:

Tapdaq.hideBanner("my_banner_tag");

4. Destroy

You can also destroy the banner, which will like so:

Tapdaq.destroyBanner("my_banner_tag");

Export your application to iOS and Android, then run your application to test the ad displays correctly.

Placement Tags

Banners support placement tags, multiple banners can now be loaded & displayed at once - one per placement tag. All methods (Load, Show, Hide, Destroy) accept an optional placement tag, if none is provided then default will be used.

Refreshing

Banners will refresh after they have been displayed for a set interval time (30seconds), when they are not visible or the app is closed, this timer is paused and will continue when the banner becomes visible. The callback didRefresh will be called when a banner has successfully refreshed, didFailToRefresh will be called if it fails - another refresh event will occur in the next interval.

See the [Callbacks] page for details on implementing callbacks.

Banner sizes

Banner Size AdColony AppLovin Google AdMob Facebook Audience Network InMobi UnityAds
Standard 320x50 320x50 320x50 320x50 320x50 320x50
Large N/A N/A 320x100 320x90 N/A N/A
Medium 300x250 300x250 300x250 300x250 300x250 N/A
Full N/A N/A 468x60 N/A N/A 468x60
Leaderboard 728x90 728x90 728x90 N/A N/A 728x90
Smart N/A N/A various various N/A N/A

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated a banner into your app, what would you like to do next?

⚠️ **GitHub.com Fallback** ⚠️