5

I am using MoPub to show AdMob ads and I need to understand how to properly configure the SDK to pass the consent to the adapters.

For MoPub own ads I use the consent screen provided by Mopub, but they state that the do not collect the consent for AdMob ads. So I need to show an additional consent screen (maybe with Google's Consent SDK if and when it will be available) to get that consent. Up to this everything is ugly but more or less clear.

The question is how I can pass the consent to the AdMob adapter in Mopub SDK. Reading the documentation from AdMob I need to follow these instructions:

The default behavior of the Google Mobile Ads SDK is to serve personalized ads. If a user has consented to receive only non-personalized ads, you can configure an AdRequest object with the following code to specify that only non-personalized ads should be returned:

Bundle extras = new Bundle();
extras.putString("npa", "1");

AdRequest request = new AdRequest.Builder()
    .addNetworkExtrasBundle(AdMobAdapter.class, extras)
    .build();

It is unclear how I can pass the "npa=1" parameter in the NetworkExtrasBundle to the AdMob adapter in Mopub SDK. The GooglePlayServicesBanner class in the SDK seems to be not able of configuring none of those extras.

Is patching the adapter the only way of passing the parameter?

Edit: This has been fixed in the meantime in latest adapter and now it is possible. See the docs.

gxcare
  • 511
  • 4
  • 12
  • Interesting, I'm in a similar position, I also show AdMob ads via MoPub mediation. I don't want to show personalised ads anymore but I'm unsure how to do this using the MoPub SDK - one solution, retire the MoPub SDK from my apps and just go with the Google Ads SDK. I also don't like the idea of bombarding my users with multiple consent dialogs, So it seems the best way around the issue. – Zippy May 21 '18 at 23:19
  • Reading MoPub documentation seems that you should be whitelisted to provide consent info on your own for their ads. With current situation I need to show one question for analytics, one for MoPub ads and one for AdMob ads, and then as noted I need to patch the MoPub mediator code to pass the parameter to AdMob. A mess... – gxcare May 22 '18 at 12:59
  • Can you clarify - "class in the SDK seems to be not able of configuring none of those extras", can you not just edit it with the npa, 1 flag? I've edited mine. I'm assuming that will work....? – Zippy May 23 '18 at 18:53
  • Exactly that: I removed classes I previously had copied in my app with the dependency "com.mopub.mediation:admob", but now I had to put them back and patch them with the flag. In principle they should have provided a way to configure it through the mediation extras. – gxcare May 24 '18 at 19:40
  • @gicci got any solution for this, me too having same problem – Sarath Kumar Jul 07 '18 at 07:44
  • https://developers.mopub.com/docs/mediation/networks/google/#instructions-for-passing-users-ad-preference-to-admob – gxcare Jul 08 '18 at 18:25

1 Answers1

0

If you go here:

Google | MoPub Mediation

you'll find that you have to initialize the MoPub SDK like below to send user consent to MoPub.

HashMap<String, String> config = new HashMap<>();
config.put("npa", "1");  
SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder(adUnitId).withMediatedNetworkConfiguration(GooglePlayServicesAdapterConfiguration.class.getName(), config);
       .build();
MoPub.initializeSdk(this, sdkConfiguration, initSdkListener());

This is a very late answer, but today as I was facing the same problem, and found out this question had no answer, did some digging and found it out.

Additional note: Go through their documentation for other networks too if you're implementing other ad networks.

Vedprakash Wagh
  • 3,595
  • 3
  • 12
  • 33