<br />

This guide explains how to provide targeting information to an ad request.

## Before you begin

Before you continue, [set up Google Mobile Ads Unity Plugin](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/quick-start.md.txt).

## Request configuration

The
[`RequestConfiguration`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/request-configuration.md.txt)
object collects the global configuration for every ad
request and is applied by
[`MobileAds.SetRequestConfiguration()`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/mobile-ads.md.txt#setrequestconfiguration).

```c#
MobileAds.SetRequestConfiguration(requestConfiguration);
```

To make sure that all ad requests apply the request configuration changes, set
the request configuration before you
[Initialize the SDK](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/quick-start.md.txt#initialize_the_sdk).

### Set the age treatment

To help you manage your compliance with applicable privacy regulations related
to children and teens, Google Mobile Ads Unity Plugin provides an age treatment setting. The
age treatment setting lets you indicate whether Google Mobile Ads Unity Plugin should apply
specific ad serving protections for children, teens, or an unspecified age.

You can set age treatment with the
[`AgeRestrictedTreatment`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/request-configuration.md.txt#agerestrictedtreatment)
property on the
[`RequestConfiguration`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/request-configuration.md.txt) object.

The following example indicates that ad requests should receive child age
treatment:

```c#
RequestConfiguration requestConfiguration = new RequestConfiguration
{
    // Indicate that ad requests should have child age treatment.
    AgeRestrictedTreatment = AgeRestrictedTreatment.Child
};
MobileAds.SetRequestConfiguration(requestConfiguration);
```

To indicate teen or an unspecified age treatment, replace the
`AgeRestrictedTreatment.Child`
setting with the following:

- `AgeRestrictedTreatment.Teen`
- `AgeRestrictedTreatment.Unspecified`

When using the setting, Google Mobile Ads Unity Plugin includes a `tfat` parameter in ad
requests. Consult your legal counsel to determine the applicable age treatment
for your users based on your legal and regulatory obligations. For more
information, see
[Tag an ad request for age treatment](https://support.google.com/admanager/answer/3671211).

#### Migrate to age treatment from TFCD and TFUA

The age treatment setting replaces the deprecated
`TagForChildDirectedTreatment` (TFCD) and `TagForUnderAgeOfConsent` (TFUA)
properties.

The following table shows the TFCD and TFUA settings and their age treatment
equivalents:

### TFCD

| `TFCD` | Age treatment |
|---|---|
| `TagForChildDirectedTreatment.True` | `AgeRestrictedTreatment.Child` |
| `TagForChildDirectedTreatment.False` | `AgeRestrictedTreatment.Unspecified` |
| `TagForChildDirectedTreatment.Unspecified` | `AgeRestrictedTreatment.Unspecified` |
| No value assigned | `AgeRestrictedTreatment.Unspecified` |
| No equivalent | `AgeRestrictedTreatment.Teen` |

### TFUA

| `TFUA` | Age treatment |
|---|---|
| `TagForUnderAgeOfConsent.True` | `AgeRestrictedTreatment.Child` |
| `TagForUnderAgeOfConsent.False` | `AgeRestrictedTreatment.Unspecified` |
| `TagForUnderAgeOfConsent.Unspecified` | `AgeRestrictedTreatment.Unspecified` |
| No value assigned | `AgeRestrictedTreatment.Unspecified` |
| No equivalent | `AgeRestrictedTreatment.Teen` |

#### Understand age treatment interactions with TFCD and TFUA

If you set the age treatment setting and TFCD or TFUA settings, Google applies
the most conservative treatment.

> [!NOTE]
> **Note:** Apps in the [Designed For Families
> Program](https://developer.android.com/distribute/google-play/families.html) as [Primarily child-directed apps](https://support.google.com/admanager/answer/9467073) and users signed into Google Accounts managed with [Family Link](https://families.google.com/familylink/) automatically have all content treated as child-directed for all ad requests.

#### Forward age treatment with mediation

If you [set the age treatment](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/targeting.md.txt#set_the_age_treatment) using Google Mobile Ads Unity Plugin,
mediation adapters forward the age treatment signal to integrated third-party
ad sources.

The following table lists the mediation adapter versions that support forwarding
the age-restricted treatment signal to integrated third-party ad sources:

| Mediation adapter name | Minimum supported version |
|---|---|
| [AppLovin](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/applovin.md.txt) | 8.7.4 |
| [BidMachine](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/bidmachine.md.txt) | 1.4.2 |
| [Bigo](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/bigo.md.txt) | 1.1.0 |
| [Chartboost](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/chartboost.md.txt) | 4.13.0 |
| [DTExchange (Fyber)](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/dt-exchange.md.txt) | 3.5.10 |
| [i-mobile](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/imobile.md.txt) | 1.3.13 |
| [InMobi](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/inmobi.md.txt) | 5.3.0 |
| [IronSource](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/ironsource.md.txt) | 4.5.3 |
| [Liftoff Monetize (Vungle)](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/liftoff-monetize.md.txt) | 5.7.5 |
| [LY (Line)](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/line.md.txt) | 2.1.1 |
| [maio](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/maio.md.txt) | 3.1.9 |
| [Meta (Facebook)](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/meta.md.txt) | 3.18.7 |
| [Mintegral](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/mintegral.md.txt) | 2.2.3 |
| [Moloco](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/moloco.md.txt) | 3.8.0 |
| [MyTarget](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/mytarget.md.txt) | 3.39.0 |
| [Pangle](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/pangle.md.txt) | 7.0.0 |
| [PubMatic](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/mediation/pubmatic.md.txt) | 2.1.3 |

### Child-directed setting

> [!WARNING]
> **Warning:** The `TagForChildDirectedTreatment` property is deprecated. Instead, [set the `AgeRestrictedTreatment`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/targeting.md.txt#set_the_age_treatment) property.

For purposes of the [Children's Online Privacy Protection Act
(COPPA)](https://www.ftc.gov/tips-advice/business-center/privacy-and-security/children%27s-privacy),
there is a setting called "tag for child-directed treatment."

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.

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, Google Mobile Ads Unity Plugin takes steps
to disable IBA and remarketing ads on that ad request. Use this setting
with all versions of Google Play services SDK through
`RequestConfiguration.TagForChildDirectedTreatment`:

- Set `TagForChildDirectedTreatment` with
  `TagForChildDirectedTreatment.True` to indicate that you want your
  content treated as child-directed for purposes of COPPA. This setting
  prevents the transmission of the [Android advertising identifier
  (AAID)](https://support.google.com/googleplay/android-developer/answer/6048248).

- Set `TagForChildDirectedTreatment` with
  `TagForChildDirectedTreatment.False` to indicate that you don't want your
  content treated as child-directed for purposes of COPPA.

- Set `TagForChildDirectedTreatment` with
  `null` if you don't want 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:

```c#
RequestConfiguration requestConfiguration = new RequestConfiguration
{
    TagForChildDirectedTreatment = TagForChildDirectedTreatment.True
};
MobileAds.SetRequestConfiguration(requestConfiguration);
```

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.

> [!NOTE]
> **Note:** Apps in the [Designed For Families
> Program](https://developer.android.com/distribute/google-play/families.html) as [Primarily child-directed apps](https://support.google.com/admanager/answer/9467073) and users signed into Google Accounts managed with [Family Link](https://families.google.com/familylink/) automatically have all content treated as child-directed for all ad requests.

### Users under the age of consent

> [!WARNING]
> **Warning:** The `TagForUnderAgeOfConsent` property is deprecated. Instead, [set the `AgeRestrictedTreatment`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/targeting.md.txt#set_the_age_treatment) property.


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)](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679). You may have other legal
obligations under GDPR. Review European Union guidance and consult with
your own legal counsel. Google's tools are designed to facilitate
compliance and don't relieve any particular publisher of its obligations under
the law.
[Learn more about how the GDPR affects publishers](https://support.google.com/admanager/answer/7666366).

When using this feature, a Tag For Users under the Age of Consent in
Europe (TFUA) parameter is 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.

Like child-directed settings, there is a method in
`RequestConfiguration` for setting the TFUA parameter:
[`TagForUnderAgeOfConsent`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/request-configuration.md.txt#tagforunderageofconsent),
with the following options.

- Set `TagForUnderAgeOfConsent` with `TagForUnderAgeOfConsent.True`
  to indicate that you want the ad request to receive treatment for users in
  the European Economic Area (EEA) under the age of consent. This setting
  prevents the transmission of the [Android advertising identifier
  (AAID)](https://support.google.com/googleplay/android-developer/answer/6048248).

- Set `TagForUnderAgeOfConsent` with `TagForUnderAgeOfConsent.False`
  to indicate that you want the ad request to *not* receive treatment for users
  in the European Economic Area (EEA) under the age of consent.

- Set `TagForUnderAgeOfConsent` with
  `null` 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:

```c#
RequestConfiguration requestConfiguration = new RequestConfiguration
{
    TagForUnderAgeOfConsent = TagForUnderAgeOfConsent.True
};
MobileAds.SetRequestConfiguration(requestConfiguration);
```

The tags to enable the [Child-directed setting](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/targeting.md.txt#child-directed_setting)
and `TagForUnderAgeOfConsent` shouldn't both simultaneously be set to true.
If they are, the child-directed setting takes precedence.

### Ad content filtering

To comply with Google Play's [Inappropriate Ads Policy](https://support.google.com/googleplay/android-developer/answer/9857753#zippy=%2Cexamples-of-common-violations)
that includes associated offers within an ad, all ads and their associated
offers shown within your app must be appropriate for the [content
rating](https://support.google.com/googleplay/android-developer/answer/9898843) of
your app, even if the content by itself is otherwise compliant with Google
Play's policies.

Tools like maximum ad content rating can help you have more control over the
content of the ads shown to your users. You can set a maximum content rating to
help compliance with platform policies.

Apps can set a maximum ad content rating for their ad requests using the
[`MaxAdContentRating`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/request-configuration.md.txt#maxadcontentrating)
field. AdMob ads returned when this setting is configured have a content rating
at or a lower level than request.

The possible values for this network extra are based on

[digital content label classifications](https://support.google.com/admanager/answer/12375142),

and must be one of the following strings:

- `MaxAdContentRating.G`
- `MaxAdContentRating.PG`
- `MaxAdContentRating.T`
- `MaxAdContentRating.MA`

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

```c#
RequestConfiguration requestConfiguration = new RequestConfiguration
{
    MaxAdContentRating = MaxAdContentRating.G
};
MobileAds.SetRequestConfiguration(requestConfiguration);
```

Learn more about [setting the maximum content rating for each ad
request](https://support.google.com/admanager/answer/12375142).

> [!NOTE]
> **Note:** Content rating filter settings specified through Google Mobile Ads Unity Plugin override any settings configured using the Ad Manager UI.

## 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 through the
[`AdManagerAdRequest.CustomTargeting`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/ad-request.md.txt#customtargeting)
property:

The following example passes the custom targeting age as `25`:

```c#
// Example: Pass custom targeting "age=25".
AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    CustomTargeting = new Dictionary<string, string>
    {
        { "age", "25" }
    }
};
```

The following example targets individuals between the ages of 24 and 26:

```c#
AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    CustomTargeting = new Dictionary<string, string>
    {
        { "age", "24, 25, 26" }
    }
};
```

### Category exclusions

You can add a slot-level category exclusion level to a request by using the
`AdManagerAdRequest` [`CategoryExclusions`](https://developers.google.com/ad-manager/mobile-ads-sdk/unity/reference/class/google-mobile-ads/api/ad-manager/ad-manager-ad-request.md.txt#categoryexclusions)
field:

```c#
AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    CategoryExclusions = new HashSet<string>
    {
        "automobile",
        "boat"
    }
};
```

## Publisher provided identifiers

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

> [!NOTE]
> **Note:** This feature is not available to all publishers. Refer to [About publisher
> provided identifiers](https://support.google.com/admanager/answer/2880055) for details.

The following example sets the PPID:

```c#
AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    PublisherProvidedId = "AB123456789"
};
```

## Publisher provided signals

You can send audience and contextual data as
[publisher provided signals](https://support.google.com/admanager/answer/12451124)
(PPS) in ad requests. With PPS, you can use your user data to improve
programmatic monetization by communicating your audience characteristics to
bidders in all
[transaction types](https://support.google.com/admanager/answer/2805834), using
standard taxonomies, without the need to share user identifiers. Your audience
characteristics can include behavioral and interest-based data ([IAB Audience
Taxonomy 1.1](https://iabtechlab.com/standards/audience-taxonomy/)) and contextual
data ([IAB Content Taxonomy 2.2](https://iabtechlab.com/standards/content-taxonomy/)).

The following example sets audience segmentation:

```c#
AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    Extras = new Dictionary<string, string>
    {
        // Set the demographic to an audience with an "Age Range" of 30-34
        // and an interest in mergers and acquisitions.
        { "IAB_AUDIENCE_1_1", "1, 2, 3, 4, 5" },
        // Set the content to sedan, station wagon and SUV automotive values.
        { "IAB_AUDIENCE_2_2", "6, 7, 8, 9, 10" }
    }
};
```