Skip to main content

Request configuration

Two layers control what AdMob serves:

LayerAPIScope
GlobalAdmob.setRequestConfiguration(configuration)Every later ad request
Per requestoptions of load(), requestOptions of <BannerAd> and startAppOpenAdsOne 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.

:::

FieldValuesDefault
testDeviceIdsDevice IDsnone
maxAdContentRatinggeneral, parentalGuidance, teen, matureAudienceSDK default
ageRestrictedTreatmentunspecified, child, teenunspecified
personalizationdefault, enabled, disableddefault

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​

AdmobRequestOptions:

FieldDescription
keywordsKeywords describing the app content, such as sports.
contentUrlThe URL of the content shown next to the ad.
neighboringContentUrlsURLs 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.