Probably, if you are about to release a new app on Google Play, have a worldwide target and have integrated advertising, you have certainly tried to implement the GDPR consent for users in the European Economic Area (EEA).
It used to be a very simple step with the old consent library, as the user could choose whether to consent to personalized ads, non-personalized ads, or even choose to pay for not seeing the ads at all.
Unfortunately, a red box appears just above the implementation guide that communicates the deprecation of this library in favor of the new User Messaging Platform (UMP), which complies with IAB standards (updated 28th Feb 2022).
The implementation guide is very simple, but I am sure that once you have implemented the library and tested for a few minutes, you will be surprised to find that if consent is denied, or if certain values are not checked in the consent management phase, the ads will not be loaded.
Why does this happen? I double-checked the help page — probably I forgot a few steps — I said to myself, until I read the ConsentStatus.OBTAINED field better. In fact, next to it it says that the consent is obtained, but the personalization is not defined.
This is the key point: it is up to us developers to check if the user has granted the minimum requirements to be able to view the ads, and if he has chosen to see personalized or non-personalized ones.
Google will serve ads when all of the following criteria are met:
— The end user grants Google consent to:
- Store and/or access information on a device (Purpose 1)
- Create a personalized ads profile (Purposes 3)**
- Select personalized ads (Purposes 4)**
— Legitimate interest (or consent, where a publisher configures their CMP to request it) is established for Google to:
- Select basic ads (Purpose 2)
- Measure ad performance (Purpose 7)
- Apply market research to generate audience insights (Purpose 9)
- Develop and improve products (Purpose 10)
— Consent to Google Advertising Products from the vendor list
** Required for Personalized Ads
The UMP library locally saves the values the user gives in the consent dialog (for Android in SharedPreferences), so we can verify them and understand if the user has given consent to see personalized ads, non-personalized ads or denied consent.
Check if publisher can show ads first (Java)
If false (and GDPR applies, so if in EEA) you should prompt the user or to accept all, or explain in details (check above) what to check to display at least Non-Personalized Ads, or ask the user to opt for a premium version of the app, otherwise you will earn absolutely nothing.
If true you can check if user granted at least minimum requirements to show Personalized Ads with the following method (Java)
Finally you know if you can request AdMob Personalized or Non-Personalized Ads, if Non-Personalized you have to forward the request using this snippet (Java)
Below all the helper methods for canShowAds() and canShowPersonalizedAds()
If you need the code in Kotlin here' s the link to the original author (Tyler V) of the methods I ported in Java.
I hope it will help, don' t forget to clap and share with colleagues!