This guide explains how to provide targeting information to an ad request.
To see ad targeting in action, download the iOS API Demo app in Objective-C or Swift.
Complete the Get Started guide.
It can be accessed via the following piece of code:
let requestConfiguration = GADMobileAds.sharedInstance().requestConfiguration
GADRequestConfiguration requestConfiguration = GADMobileAds.sharedInstance.requestConfiguration;
For purposes of the Children's Online Privacy Protection Act
there is a setting called
As an app developer, you can indicate whether you want Google to treat your content as child-directed when you make an ad request. When you indicate that you want Google to treat your content as child-directed, we take steps to disable IBA and remarketing ads on that ad request. The setting options are as follows:
YESto indicates that you want your content treated as child-directed for purposes of COPPA. This will prevent the transmission of the Advertising Identifier, IDFA.
NOto indicate that you don't want your content treated as child-directed for purposes of COPPA.
Do not set
tagForChildDirectedTreatmentif you do not wish to indicate how you would like your content treated with respect to COPPA.
By setting this tag, you certify that this notification is accurate and you are authorized to act on behalf of the owner of the app. You understand that abuse of this setting may result in termination of your Google account.
Users under the age of consent
You can mark your ad requests to receive treatment for users in the European Economic Area (EEA) under the age of consent. This feature is designed to help facilitate compliance with the General Data Protection Regulation (GDPR). Note that you may have other legal obligations under GDPR. Please review the European Union’s guidance and consult with your own legal counsel. Please remember that Google's tools are designed to facilitate compliance and do not relieve any particular publisher of its obligations under the law. Learn more about how the GDPR affects publishers.
When using this feature, a Tag For Users under the Age of Consent in Europe (TFUA) parameter will be included in all future ad requests. This parameter disables personalized advertising, including remarketing, for that specific ad request. It also disables requests to third-party ad vendors, such as ad measurement pixels and third-party ad servers.
The setting can be used with all versions of the Google Mobile Ads SDK by
tagForUnderAgeOfConsent method on the
GADMobileAds.requestConfiguration object and passing in
trueto indicate that you want ad requests to be handled in a manner suitable for users under the age of consent. This will also prevent the transmission of the Advertising Identifier, IDFA.
- Not setting
tagForUnderAgeOfConsentindicates that you don't want ad requests to be handled in a manner suitable for users under the age of consent.
The following example indicates that you want TFUA included in your ad request:
The tags to enable the child-directed setting
tagForUnderAgeOfConsent should not both simultaneously be set to
If they are, the child-directed setting takes precedence.
Ad content filtering
Apps can set a maximum ad content rating for all ad requests using the
maxAdContentRating property of
GADRequestConfiguration. This setting applies
to all future ad requests for the remainder of the session. The possible values
for this property are based on digital content label
classifications, and should be one
of the following constants:
The following code configures all ad requests to specify that ad content
returned should correspond to a Digital Content Label designation no higher than
GADMobileAds.sharedInstance().requestConfiguration.maxAdContentRating = GADMaxAdContentRatingGeneral
GADMobileAds.sharedInstance.requestConfiguration.maxAdContentRating = GADMaxAdContentRatingGeneral;
GADRequest object collects targeting information to be sent with an ad
When requesting an ad, apps may pass the URL of the content they are serving. This enables keyword targeting to match the ad with the content.
For example, if your app is requesting an ad while showing content from
https://www.example.com, you can pass this URL to target relevant keywords:
let request = GADRequest() request.contentURL = "https://www.example.com"
GADRequest *request = [GADRequest request]; request.contentURL = @"https://www.example.com";
- What targeting gets used when an ad automatically refreshes?
- On ad refresh, the previously specified
GADRequestobject is used for targeting again. To set new targeting, explicitly call
GADBannerViewwith a new
- How do I pass extra targeting parameters to mediation networks?
- See Mediation to find out how to send targeting to mediation networks.