[Limited ads](https://support.google.com/admanager/answer/9882911) lets apps
serve ads when your users don't consent to share personal data.
Limited ads mode stops the collection, sharing, and use of personal data for
ad selection. If your users choose to not share personal data,
this feature lets ads continue serving.

This guide covers using limited ads settings in your app, and matching app
behavior with your Google Ad Manager network's global settings.

## Configure client limited ads settings

PAL version 23.0.0 introduces
the `forceLimitedAds` property and removed the
`allowStorage` property. This property is in the
[`ConsentSettings`](https://developers.google.com/ad-manager/pal/android/api/com/google/ads/interactivemedia/pal/ConsentSettings.Builder)

class.

Starting in version 23.0.0, PAL reads Transparency and
Consent Framework (TCF) data from the device to determine user
consent for local storage. Previously, your app was responsible for determining
storage consent. Your app still must pass the `gdpr=` and
`gdpr_consent=` parameters in the ad tag URL.

If the automatic TCF-based determination is insufficient, directly set the
`forceLimitedAds` property in your app. For details, see
[Publisher integration with the IAB Europe TCF](https://support.google.com/admanager/answer/9805023).
Setting the `forceLimitedAds` property to a `true` value prevents PAL from
storing or sending user identifiers in the nonce sent to the server.
Setting the `forceLimitedAds` property to a `true` value is the same as
adding the `ltd=1` parameter to the ad request URL in IMA (Interactive Media
Ads) SDKs. For details about limited ads, see
[`ltd` (Limited ads)](https://support.google.com/admanager/answer/10678356#ltd&zippy=%2Cltd-limited-ads).
When you set the `forceLimitedAds` property to a `true` value, PAL includes
`ltd=1` parameter in the nonce.

To keep the current behavior in your app, you might need to update your
implementation, even if you did not set the `allowStorage` property before.
The `allowStorage` property defaulted to a `false` value, which
*enabled* limited ads. The `forceLimitedAds` property defaults to a `false`
value, which *doesn't enable* limited ads.

### Update PAL implementation for TCF-based determination

PAL Android requires action when updating to version
23.0.0, which lets PAL read TCF data from the
device to determine user consent for local storage. This version also adds the
`forceLimitedAds` property and removes the `allowStorage` property. Only
update your app to use the `forceLimitedAds` property if TCF-based
activation of limited ads doesn't meet your app's requirements. To learn more
about TCF-based determination, see
[Publisher integration with the IAB Europe TCF](https://support.google.com/admanager/answer/9805023).


## Match Google Ad Manager global settings

If you update the Ad Manager settings **Programmatic limited ads** or
**First party
identifiers
for ads on
apps**,
use these new APIs to match the settings in Ad Manager. If you don't use the
APIs PAL might include the identifiers in the nonce that is used in the ad
request to the server. However, Ad Manager might drop the signals based on the
settings in Ad Manager.

The APIs are as follows:

- [`disableLimitedAdsStorage`](https://developers.google.com/ad-manager/pal/android/api/com/google/ads/interactivemedia/pal/GoogleAdManagerSettings.Builder#public-abstract-googleadmanagersettings.builder-disablelimitedadsstorage-boolean-toggle) - disables invalid traffic detection-only identifiers and use of local storage for limited ads. If you updated the **Programmatic limited ads** setting in Ad Manager within **Admin \> Global settings**, use this API to disable usage of local storage for limited ads in PAL. Note that this setting does not apply to non-limited ads.
- [`disableFirstPartyIdentifiers`](https://developers.google.com/ad-manager/pal/android/api/com/google/ads/interactivemedia/pal/GoogleAdManagerSettings.Builder#public-abstract-googleadmanagersettings.builder-disablefirstpartyidentifiers-boolean-toggle) - disables first-party identifiers used for ad selection. If you updated the **First party
  identifiers
  for ads on
  apps** setting in Ad Manager within **Admin \> Global** settings, use this API to disable such identifiers in PAL. Note that this setting does not apply to the use of identifiers and local storage for invalid traffic detection.

## Handle user consent in your app

The following example handles user privacy and data usage in a PAL
implementation:

    ConsentSettings consentSettings = ConsentSettings.builder()
                .directedForChildOrUnknownAge(false)
                .build();
    // PAL Android version 23.0.0 introduces
    // `ConsentSettings.forceLimitedAds` and removes `ConsentSettings.allowStorage`.
    // Best practice is to not set `forceLimitedAds` to allow PAL to automatically
    // determine whether limited ads applies based on the TCF data.
    // To enable limited ads regardless of the TCF determination, set the
    // `forceLimitedAds` property to a `true` value.

    GoogleAdManagerSettings adManagerSettings = GoogleAdManagerSettings.builder()
                // Add this line if the "Programmatic limited ads" toggle is turned
                // off in Ad Manager.
                .disableLimitedAdsStorage(true)
                // Add this line if the
                // "First party identifiers for ads on app" toggle is turned
                // off in Ad Manager.
                .disableFirstPartyIdentifiers(true)
                .build();

    nonceLoader = new NonceLoader(this, consentSettings, adManagerSettings);