MoPub Ads Mediation with Admob

Background:

When serving ads for your game there is a way to vary/boost your impressions/clicks/income using something called, “Mediation” to say, “If provider A has no ad for me, then get one from provider B”.

In this case, provider A is Admob and provider B is MoPub.

In Unity there is a special package used to do Google Admob mediation with MoPub called,

GoogleMobileAdsMoPubMediation.unitypackage

Info about it here: Escolher redes  |  Unity  |  Google for Developers

This package adds one VERY useful method:

MoPub.Initialize($"{YOUR_MOPUB_APPID}");

Meaning you can initialize your ad serving like this:

// Init Admob, uses the AppId stored in global App Settings (Unity)
MobileAds.Initialize(initStatus =>
{
    // Maybe do stuff here..?
});

// Init MoPub but use hard coded AppId which is different to Admob of course.
MoPub.Initialize($"{YOUR_MOPUD_APPID}");

So, this brilliant post shows step by step how to set up Admob with monogame.

https://community.monogame.net/t/admob-how-too-a-full-example/

In which it says

Firstly after creating your Android App Open “Manage NuGet Packages” (Right click project->Manage NuGet Packages)
Browse search for this “Xamarin.GooglePlayServices.Ads.Lite” and install it

So my question is: Is there a package that can be used that will also let us initialize MoPub as well as Admob (for mediation) in Monogame as can be done for Unity?

I’m not an expert at all and I’m probably completely wrong but I thought you added mediation through the Admob website? It shows MoPub on the Ad Sources tab.

Thanks for replying! :slight_smile:

It is certainly true that setting up Mediation between Admob and Mopub can be done through Admob. I believe it can also be done the other way round and then we use the Mopub SDK.

But everything I do with monogame requires wrappers for native platforms. Such a thing exists for Admob, whereas for Mopub, I have no idea about that.

How exactly it all works is a mystery to me; I had to allow Admob access to read my “Mopub” “Library” somewhere along the line. That’s all fine as far as setting up goes.

However, using the Unity example as a template (the only example I have to go on) to actually have it work at runtime means:

  1. Installing a custom version of the Admob SDK (Admob + Mopub) by way of a custom Unity.package.
  2. At runtime calling both MobileAds.Initialize(AppID is already filled in via a project file) and then MoPub.Initialize($"{YOUR_MOPUD_APPID_WHICH_IS_DIFFERENT_TO_YOUR_ADMOB_OF_COURSE}");

It would be great if the data access was such that Admob could initialize the linked Mopub FOR YOU without needing to initialize it yourself via your own ID, except I see no evidence that is the case, it’s like, sure, Admob can READ some of your Mopub data for recording purposes but it doesn’t have access to initialize it and request adverts from it for you.

But perhaps it does. If that’s the case, why do they take you down this custom package route and having to manually initialize both providers when using Unity?

I’m totally lost and one of the BIG problems with Monogame for me right now is the lack of information surrounding it, tiny little problems can eat up hours/days/weeks of time I don’t have.

Without any other information and having no clue what other package I might need, when the time comes I may well simply take your advice and try to set up mediation within the Admob dashboard and just call it as normal and cross my fingers that it magically delivers ads from Mopub.

I don’t expect it to work, but it might. I’ll surely post about it here either way. For now though I’ve taken it off my radar since such revenue streams are so difficult, fraught and lacking information as to be almost guaranteed failure, my time is much better spent elsewhere.