Ads served by Google can be categorized as personalized or non-personalized, both requiring consent from users in the EEA. By default, ad requests to Google serve personalized ads, with ad selection based on the user's previously collected data. Google also supports configuring ad requests to serve non-personalized ads. Learn more about personalized and non-personalized ads.
This guide describes how to forward consent to the Google Mobile Ads SDK once you have obtained consent.
- Sign in to your AdMob account and select ad technology providers.
Forward consent to the Google Mobile Ads SDK
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
AdRequest object with the following code to
specify that only non-personalized ads should be requested:
final AdRequest = AdRequest(nonPersonalizedAds: true);
If non-personalized ads are requested, the ad request URL currently includes
&npa=1. However, note that this is an internal implementation detail of the
Google Mobile Ads SDK and is subject to change.
Delay app measurement (optional)
By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts. This initialization behavior ensures you can enable AdMob user metrics without making additional code changes.
However, if your app requires user consent before these events can be sent, you can delay app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.
To delay app measurement for Android add the following
<meta-data> tag in your
<manifest> <application> <!-- Delay app measurement until MobileAds.initialize() is called. --> <meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="true"/> </application> </manifest>
To delay app measurement on iOS, add the
GADDelayAppMeasurementInit key with a
boolean value of
YES to your app’s
Info.plist. You can make this change
Or, edit it in the property list editor:
Google currently is unable to obtain and handle consent for mediation networks, so you'll need to obtain and handle consent for each ad network separately. Each mediation network has its own APIs for handling consent, which are documented for Android and iOS.
See Using Network Specific APIs to learn how to call these APIs from Dart.