Integrate Banner and MREC Ads


Vungle supports following three banner sizes and the standard MREC size.




320.0f x 50.0f


300.0f x 50.0f


728.0f x 90.0f (for tablets)


300.0f x 250.0f (MREC)

About Banner Ads

The Vungle Unity plugin supports banner and MREC ads starting with Vungle SDK for Unity v6.7.0.0. This ad format does not require a full screen; instead, the publisher determines the location of the ad container within their app. However, the size of the banner container must be either 320x50, 300x50, or 728x90 (for tablets). You can set banner ads anywhere on the screen, and the user can continue using the app while the ad is being played. The Enum listing the different banner sizes can be found in the VungleSDK.h file (also described in the table below).

You are not limited on the number of non-fullscreen ads at any given time, but the plugin does not check whether multiple ads are being displayed at one position. Make sure that you are calling one ad for any position provided by our plugin and also ensure that they do not overlap with each other if you are displaying more than one.


Ad Position On Display


Top left corner


Top middle


Top right corner




Bottom left corner


Bottom middle


Bottom right corner

The placement type for banner ads must have the type "Banner" in the Liftoff Monetize dashboard. Feel free to contact your account manager to enable banner placement on the dashboard.

About MREC Ads

Starting with Vungle SDK v.6.4.3, Vungle supports MREC video ads. MREC is an abbreviation for "medium rectangle" ads. Unlike interstitial ads, MREC ads do not require a fullscreen view. Similar to banner ads, MREC video ads are rectangular ads occupying a location anywhere within the app's layout, typically displayed on the top or bottom of the screen, so that the user can continue to interact with the app while the ad is playing. The container size to render an MREC ad is the industry standard: 300x250.

Step 1. Complete Basic Plugin Integration

To integrate banner and MREC ads in your Unity app, begin by following the instructions in the basic plugin integration article. This article contains supplementary information and assumes you have completed basic integration.

Step 2. Implement Event Handlers (Optional)

You can set up event handlers for all five Vungle SDK events surrounding ad presentation.

  • The following event is fired when the SDK starts to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.
    public static event Action<string> onAdStartedEvent;
  • The following event is fired when the SDK closes an ad. This is a great place to reward your users and resume gameplay, sound effects, animations, etc.
    //For IOS & Android 6.9.1+
    public static event Action<string> onAdEndEvent;

    //For Windows. Also for IOS and Android 6.8.1 and below.
    public static event Action<string, AdFinishedEventArgs> onAdFinishedEvent;
    The AdFinishedEventArgs class consists of the following properties for you to check the result of an ad play:
    public class AdFinishedEventArgs : EventArgs
      //Represents a BOOL whether or not the user clicked the download button.
      public bool WasCallToActionClicked{ get; set;}
      //Represents a bool whether or not the video can be considered a completed view.
      public bool IsCompletedView{ get; set;}
  • The following event is fired when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.
    public static event Action<string, bool> adPlayableEvent;
  • The following event is fired when the SDK is initialized successfully.
    public static event Action onInitializeEvent;

New Event Handlers for iOS & Android as of Unity

  • The following event is fired when the ad's CTA button/action is taken.
    public static event Action<string> onAdClickEvent;
  • The following event is fired when an ad has finished playing and is closed
    public static event Action<string> onAdEndEvent

Deprecated for iOS & Android as of Unity 

Vungle.onAdFinished(String id, boolean completed, boolean isCTAClicked);

Sample code:

void initializeEventHandlers()
Vungle.onAdStartedEvent += (placementID) => { DebugLog ("Ad " + placementID + " is starting! Pause your game animation or sound here."); }; Vungle.onAdFinishedEvent += (placementID, args) => { DebugLog ("Ad finished - placementID " + placementID + ", was call to action clicked:" + args.WasCallToActionClicked + ", is completed view:" + args.IsCompletedView); }; Vungle.adPlayableEvent += (placementID, adPlayable) => { DebugLog ("Ad's playable state has been changed! placementID " + placementID + ". Now: " + adPlayable); }; Vungle.onInitializeEvent += () => { DebugLog ("SDK initialized"); }; //For iOS and Android only Vungle.onAdClickEvent += (placementID) => { DebugLog("onClick - Log: " + placementID); }; //For iOS and Android only Vungle.onAdRewardedEvent += (placementID) => { DebugLog("onAdRewardedEvent - Log: " + placementID); }; //For iOS and Android only Vungle.onAdEndEvent += (placementID) => { DebugLog("onAdEnd - Log: " + placementID); }; }

Step 3. Load, Play, and Close an Ad

Load an Ad

Loading a non-fullscreen ad works differently from fullscreen ads and there is a specific loadBanner API that you use to load. You must specify the size and position of the non-fullscreen ad that you want to load and the SDK will automatically refresh it with the time interval that you configured on the dashboard. You must use placements that are specifically created for banner or MREC ads.

Load a non-fullscreen ad by calling the loadBanner method:

Vungle.loadBanner("PLACEMENT_ID", Vungle.VungleBannerSize.VungleAdSizeBanner, Vungle.VungleBannerPosition.BottomCenter);

Display an Ad

The non-fullscreen ads will be displayed at the position in the size that you specified at the time of invoking loadBanner when you call showBanner.


We recommend that you check for ad availibility before attempting to play any ad and isAdvertAvailable can be used just like fullscreen ads. However, for non-fullscreen ads, you would need to pass VungleBannerSize in addition to placement ID for the ad that you intend to display.

Vungle.isAdvertAvailable("PLACEMENT_ID", Vungle.VungleBannerSize.VungleAdSizeBanner);

Close an Ad

You can call closeBanner when you would like to dismiss a non-fullscreen ad.


Position Banner Ad

In 6.9.1 for Android & IOS, the ability to offset banner ads is introduced with the new API: Vungle.setBannerOffset(placementID, x, y). The setBannerOffset should happen after the load and can be done after the banner is displayed. Positive X will move the banner to the right. Negative X will move the banner to the left. Positive Y will move the banner down. Negative Y will move the banner up. Note: The distance of the offset may be different across all platforms and is dependent on how the OS handles the offset.

Sample code: 

void onPlayBanner1()
    Vungle.showBanner(<banner_placementID here>);
    Vungle.setBannerOffset(<banner_placementID> , 50, 50);



Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?