Request configuration
Two layers control what AdMob serves:
| Layer | API | Scope |
|---|---|---|
| Global | Admob.setRequestConfiguration(configuration) | Every later ad request |
| Per request | options of load(), requestOptions of <BannerAd> and startAppOpenAds | One request or one banner |
Global configuration
import { Admob } from 'nitro-ui-admob'
Admob.setRequestConfiguration({
testDeviceIds: ['33BE2250B43518CCDA7DE426D04EE231'],
maxAdContentRating: 'teen',
ageRestrictedTreatment: 'unspecified',
personalization: 'disabled',
})
Call it before loading ads, for example once consent is known. It works before and after Admob.initialize().
:::warning Each call replaces the whole configuration
Fields you omit go back to the SDK defaults; they do not keep earlier values. Pass every field you need in each call.
:::
| Field | Values | Default |
|---|---|---|
testDeviceIds | Device IDs | none |
maxAdContentRating | general, parentalGuidance, teen, matureAudience | SDK default |
ageRestrictedTreatment | unspecified, child, teen | unspecified |
personalization | default, enabled, disabled | default |
Test devices
Each device ID is logged by the SDK on the device's first ad request; copy it from the Xcode console or Logcat into testDeviceIds. Simulators and emulators always receive test ads.
Age treatment
child applies child-directed treatment (COPPA); teen covers users under the age of consent. Consult your legal counsel: setting it certifies that it is accurate.
Personalization
disabled requests non-personalized ads. Map your consent outcome to this field.
Per-request targeting
| Field | Description |
|---|---|
keywords | Keywords describing the app content, such as sports. |
contentUrl | The URL of the content shown next to the ad. |
neighboringContentUrls | URLs of other content in the app, for contextual targeting. |
const ad = await RewardedAd.load(adUnitId, { keywords: ['games'] })
<BannerAd adUnitId={adUnitId} requestOptions={{ contentUrl: article.url }} />
For a banner, changing the contents of requestOptions loads a new ad.