Targeting

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

Prerequisites

Request configuration

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

The following example sets MobileAds with a RequestConfiguration object with test device IDs:

// Configure your RequestConfiguration with Test Device Ids.
MobileAds.SetRequestConfiguration(new RequestConfiguration
{
    TestDeviceIds = TestDeviceIds
});

Child-directed setting

For purposes of the Children's Online Privacy Protection Act (COPPA), 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, the SDK takes 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):

  • 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).

  • 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:

MobileAds.SetRequestConfiguration(new RequestConfiguration
{
    TagForChildDirectedTreatment = TagForChildDirectedTreatment.True
});

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. Review European Union guidance and consult with your own legal counsel. Note 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 is included in the ad request. This parameter disables personalized advertising, including remarketing, for all ad requests. 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, 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).

  • 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 requests:

MobileAds.SetRequestConfiguration(new RequestConfiguration
{
    TagForUnderAgeOfConsent = TagForUnderAgeOfConsent.True
});

The tags to enable the 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 that includes associated offers within an ad, all ads and their associated offers shown within your app must be appropriate for the content rating 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 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, 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:

MobileAds.SetRequestConfiguration(new RequestConfiguration
{
    MaxAdContentRating = MaxAdContentRating.G
});

To learn more about maximum content rating, see the following:

Ad request

The AdManagerAdRequest object collects targeting information for the ad request.

Custom targeting

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

The following example passes the custom targeting age as 25:

// 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:

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 CategoryExclusion field:

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.

The following example sets the PPID:

AdManagerAdRequest newRequest = new AdManagerAdRequest
{
    PublisherProvidedId = "AB123456789"
};

Publisher provided signals

You can send audience and contextual data as publisher provided signals (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, 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) and contextual data (IAB Content Taxonomy 2.2).

The following example sets audience segmentation:

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"},
    }
};