Out of the box, AdMob does not handle any related regulations which you may need to enforce on your application. It is up to the developer to implement and handle this on a user-by-user basis. Under Google's EU User Consent Policy, you must obtain consent from users in the European Economic Area (EEA), the UK, and Switzerland to use cookies or other local storage where legally required, and to use personal data to serve ads. For more information, see Google's User Messaging Platform guides for Android and iOS.
The AdMob module provides a AdsConsent helper to help developers quickly implement consent flows within their application.
See the European User Consent page for full examples of how to integrate the helper into your application.
Gather consent and set any request-specific flags before calling
initialize — ads may be preloaded on init.
To request the App Tracking Transparency authorization we recommend using a library or making it part of the UMP consent flow (see the European User Consent page). App Tracking Transparency also requires a usage description string — see the installation guides for Expo or bare React Native.
import mobileAds, { AdsConsent } from 'react-native-google-mobile-ads';
import { check, request, PERMISSIONS, RESULTS } from 'react-native-permissions';
// Gather UMP consent first; see the European User Consent page.
const { canRequestAds } = await AdsConsent.gatherConsent();
const result = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
if (result === RESULTS.DENIED) {
// The permission has not been requested, so request it.
await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
}
if (canRequestAds) {
const adapterStatuses = await mobileAds().initialize();
// Now ads can be loaded.
}