Skip to main content
Version: 3.3.2

Mrec

Mrec is a 300x250 banner. This type can be useful if the application has a large free area for placing a banner in the interface.

You can use our demo app as a reference project.

Demo App


Display

Mrec ads are refreshed every 15 seconds automatically by default.

To display mrec, use the following method:

Appodeal.ShowMrecView(yPosition, xPosition, "placementName");

Use int value or one of the constants below for yPosition:

  • AppodealViewPosition.VerticalTop — to align a mrec to the top of the screen.
  • AppodealViewPosition.VerticalBottom — to align a mrec to the bottom of the screen.

Use int value or one of the constants below for xPosition:

  • AppodealViewPosition.HorizontalSmart — to use the full-screen width.
  • AppodealViewPosition.HorizontalCenter — to center a mrec horizontally.
  • AppodealViewPosition.HorizontalRight — to align a mrec to the right.
  • AppodealViewPosition.HorizontalLeft — to align a mrec to the left.
Mrec positioning is relative to the top left corner of the screen.

Hide Mrec

To hide a mrec ad use the following method:

Appodeal.HideMrecView();

Callbacks

The callbacks are used to track different events in the lifecycle of an ad, e.g. when an ad was clicked on or closed. Follow the steps below to implement them:

Subscribe to the desired mrec event using one of the options from this guide. (you can subscribe to any number of events you want)

AppodealCallbacks.Mrec.OnLoaded += (sender, args) => { };

You will find all existing mrec events in the example below:

public void SomeMethod()
{
AppodealCallbacks.Mrec.OnLoaded += (sender, args) => OnMrecLoaded(args.IsPrecache);
AppodealCallbacks.Mrec.OnFailedToLoad += (sender, args) => OnMrecFailedToLoad();
AppodealCallbacks.Mrec.OnShown += (sender, args) => OnMrecShown();
AppodealCallbacks.Mrec.OnShowFailed += (sender, args) => OnMrecShowFailed();
AppodealCallbacks.Mrec.OnClicked += (sender, args) => OnMrecClicked();
AppodealCallbacks.Mrec.OnExpired += (sender, args) => OnMrecExpired();
}

#region MrecAd Callbacks

// Called when mrec is loaded precache flag shows if the loaded ad is precache)
private void OnMrecLoaded(bool isPrecache)
{
Debug.Log("Mrec loaded");
}

// Called when mrec failed to load
private void OnMrecFailedToLoad()
{
Debug.Log("Mrec failed to load");
}

// Called when mrec is failed to show
private void OnMrecShowFailed()
{
Debug.Log("Mrec show failed");
}

// Called when mrec is shown
private void OnMrecShown()
{
Debug.Log("Mrec shown");
}

// Called when mrec is clicked
private void OnMrecClicked()
{
Debug.Log("Mrec clicked");
}

// Called when mrec is expired and can not be shown
private void OnMrecExpired()
{
Debug.Log("Mrec expired");
}

#endregion
Unity Main Thread

All callbacks are called on native main threads that do not match the main thread of the Unity. If you need to receive callbacks in the main Unity thread follow our Callback Usage Guide.


Placements

Appodeal SDK allows you to tag each impression with different placement. To use placements, you need to create placements in Appodeal Dashboard. Read more about placements.

To show an ad with placement, you have to call show method with specifying placement's name:

Appodeal.ShowMrecView(yPosition, xPosition, "placementName");

Get Predicted eCPM

This method returns expected eCPM for a currently cached advertisement. The amount is calculated based on historical data for the current ad unit.

Appodeal.GetPredictedEcpm(AppodealAdType.Mrec);