AdMob Mediation is a feature that lets you serve ads to your apps from multiple sources, including the AdMob Network and third-party ad sources, in one place. AdMob Mediation helps maximize your fill rate and increase your monetization by sending ad requests to multiple networks to verify you find the best available network to serve ads. Case study.
Prerequisites
Before you can integrate mediation for an ad format, you need to integrate that ad format into your app:
New to mediation? Read Overview of AdMob Mediation.
Initialize Google Mobile Ads SDK for React Native
The quick start guide shows you how to initialize the Google Mobile Ads SDK for React Native. During that initialization call, mediation adapters also get initialized. It is important to wait for initialization to complete before you load ads in order to verify full participation from every ad network on the first ad request.
The following sample code shows how you can check each adapter's initialization status prior to making an ad request.
TypeScript
import {InitializationStatus, initialize} from '@google/mobile-ads';
import {useEffect, useState} from 'react';
import {Text, View} from 'react-native';
/**
* Root application component demonstrating Google Mobile Ads SDK initialization
* with mediation adapters.
*/
export function App() {
const [isInitialized, setIsInitialized] = useState<boolean>(false);
useEffect(() => {
// Initialize the Google Mobile Ads SDK.
initialize({}, (status: InitializationStatus) => {
console.log('Mobile Ads SDK initialized successfully:', status);
// Optionally log the adapter states.
for (const [adapterName, adapterStatus] of Object.entries(
status.adapterStatusMap,
)) {
console.log(
`Adapter: ${adapterName}, State: ${adapterStatus.state}, ` +
`Description: ${adapterStatus.description}, Latency: ${adapterStatus.latencyMs} ms`,
);
}
setIsInitialized(true);
});
}, []);
return (
<View>
<Text>
{isInitialized ? 'Mobile Ads SDK Ready' : 'Initializing SDK...'}
</Text>
</View>
);
}
Check which ad network adapter class loaded the ad
The following sample code logs the ad network class name for a banner ad:
TypeScript
Use banner ads with AdMob Mediation
Make sure to disable refresh in all third-party ad source UIs for banner ad units used in AdMob Mediation. This prevents a double refresh since AdMob also triggers a refresh based on your banner ad unit's refresh rate.
Use native ads with AdMob Mediation
The following are some best practices to consider when implementing native mediation.
- Native ad presentation policy
- Each ad network has its own policies. When using mediation, it's important to remember that your app still needs to abide by the policies of the mediated network that provided the ad.
US states privacy laws and GDPR
If you need to comply with the U.S. states privacy laws or General Data Protection Regulation (GDPR), follow the steps in US state regulations settings or GDPR settings to add your mediation partners in AdMob Privacy & messaging's US states or GDPR ad partners list. Failure to do so can lead to partners failing to serve ads on your app.
Learn more about enabling restricted data processing (RDP) and obtaining GDPR consent with the Google User Messaging Platform (UMP) SDK.