Targeting

The RequestConfiguration object collects the global configuration for every ad request and is applied by MobileAds.instance.updateRequestConfiguration().

To ensure that all ad requests apply the request configuration changes, update the request configuration before you Initialize the Mobile Ads SDK.

Child-directed setting

For purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting called "tag for child-directed treatment."

As an app developer, you can indicate whether you want Google to treat your content as child-directed when you make an ad request. If 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 can be used with all versions of the Google Play services SDK through RequestConfiguration.tagForChildDirectedTreatment():

  • Use the argument TagForChildDirectedTreatment.yes to indicate that you want your content treated as child-directed for the purposes of COPPA.
  • Use the argument TagForChildDirectedTreatment.no to indicate that you don't want your content treated as child-directed for the purposes of COPPA.
  • Use the argument TagForChildDirectedTreatment.unspecified or do not set this tag if you do not wish to indicate how you would like your content treated with respect to COPPA in ad requests.

The following example indicates that you want your content treated as child-directed for purposes of COPPA:

final RequestConfiguration requestConfiguration = RequestConfiguration(
  tagForChildDirectedTreatment: TagForChildDirectedTreatment.yes);
MobileAds.instance.updateRequestConfiguration(requestConfiguration);

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 the ad request. 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 tag is set using RequestConfiguration.tagForUnderAgeOfConsent():

  • Use the argument TagForUnderAgeOfConsent.yes to indicate that you want the request configuration to be handled in a manner suitable for users under the age of consent.
  • Use the argument TagForUnderAgeOfConsent.no to indicates that you don't want the request configuration to be handled in a manner suitable for users under the age of consent.
  • Use the argument TagForUnderAgeOfConsent.unspecified or do not set this tag to indicate that you have not specified whether the ad request should receive treatment for users in the European Economic Area (EEA) under the age of consent. The following example indicates that you want TFUA included in your ad request:

    final RequestConfiguration requestConfiguration = RequestConfiguration(
      tagForUnderAgeOfConsent: TagForUnderAgeOfConsent.yes);
    MobileAds.instance.updateRequestConfiguration(requestConfiguration);
    

The tags to enable the Child-directed setting and setTagForUnderAgeOfConsent should not both simultaneously be set to true. If they are, the child-directed setting takes precedence.

Ad content filtering

Ad content ratings can be set using RequestConfiguration.maxAdContentRating():

AdMob ads returned for these requests have a content rating at or below that level. The possible values for this network extra are based on digital content label classifications and can be one of the following MaxAdContentRating objects:

  • MaxAdContentRating.g
  • MaxAdContentRating.pg
  • MaxAdContentRating.t
  • MaxAdContentRating.ma

The following code configures a RequestConfiguration object to specify that the ad content returned correspond to a digital content label designation no higher than G:

final RequestConfiguration requestConfiguration = RequestConfiguration(
  maxAdContentRating: MaxAdContentRating.g);
MobileAds.instance.updateRequestConfiguration(requestConfiguration);

Ad request

The AdManagerAdRequest object collects targeting information to be sent with an ad request.

Custom targeting

You can pass custom key-value pairs to target Google Ad Manager campaigns (line items):

// Example: Pass custom targeting "age=25".
AdManagerAdRequest newRequest = AdManagerAdRequest(
  customTargeting: {'age': '25'},
);

Publisher provided identifiers

You can set a publisher provided identifier (PPID) for use in frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

Here's an example of setting the PPID:

AdManagerAdRequest adRequest = AdManagerAdRequest(
  publisherProvidedId: 'AB123456789',
);

Content URL

To provide a content URL for content-targeted ads and brand safety, you can pass a contentUrl when building an AdManagerAdRequest:

AdManagerAdRequest request = AdManagerAdRequest(
  contentUrl: 'https://www.example.com',
);

Brand safety

Applications that display dynamic content intended for varying audiences are able to provide a short list of URLs by providing neighboringContentUrls when building an AdManagerAdRequest:

final neighboringContentUrls = [
  'https://www.mycontenturl1.com',
  'https://www.mycontenturl2.com',
  'https://www.mycontenturl3.com',
  'https://www.mycontenturl4.com',
];
AdManagerAdRequest request = AdManagerAdRequest(
    neighboringContentUrls: neighboringContentUrls,
  );

neighboringContentUrls differs from contentUrl in that it is only used for brand safety.