<br />

> [!NOTE]
> **Note:** Placement ID is in limited access. To request access, reach out to your account manager.

To segment your ad performance reporting data, use the ad placements feature.
Placements let you segment impression data in a report without needing
additional ad units. To use the placements feature, you need a placement ID.
For details on placements, see
[About placements](https://support.google.com/admob/answer/16837672#about).

This guide covers setting a placement ID in Google Mobile Ads SDK (Legacy) and
viewing an ad performance report.

## Prerequisites

Before you continue, do the following:

- Complete [Set up Google Mobile Ads SDK (Legacy)](https://developers.google.com/admob/android/quick-start.md.txt).
- Have Google Mobile Ads SDK (Legacy) version 24.5.0 or higher.
- Get access to the placement ID feature. To request access, contact your account manager.
- Create a placement ID for your app.

## Set a placement ID

To segment your ad's performance data, you set a placement ID in one of the
following ways:

- When loading the ad.
- Before showing the ad.

You can update the placement ID as needed. When Google Mobile Ads SDK (Legacy) records
an ad impression, it uses the latest set placement ID.

### Set a placement ID at load time

This section covers setting a placement ID at load time. This workflow applies
for all ad formats.

The following example sets a placement ID for an interstitial ad at load
time:

### Kotlin

```kotlin
private fun loadInterstitial(context: Context) {
  val adRequest = AdRequest.Builder().setPlacementId(PLACEMENT_ID).build()
  InterstitialAd.load(
    context,
    "AD_UNIT_ID",
    adRequest,
    object : InterstitialAdLoadCallback() {
      override fun onAdLoaded(ad: InterstitialAd) {
        Log.d(TAG, "Placement ID: " + ad.placementId)
      }
    },
  )
}
```

### Java

```java
public void loadInterstitial(Context context) {
  AdRequest adRequest = new AdRequest.Builder().setPlacementId(PLACEMENT_ID).build();
  InterstitialAd.load(
      context,
      "AD_UNIT_ID",
      adRequest,
      new InterstitialAdLoadCallback() {
        @Override
        public void onAdLoaded(@NonNull InterstitialAd ad) {
          Log.d(TAG, "Placement ID: " + ad.getPlacementId());
        }
      });
}
```

Replace the following values:

- <var class="readonly" translate="no">AD_UNIT_ID</var> with your ad unit ID.
- <var class="readonly" translate="no">PLACEMENT_ID</var> with your placement ID.

### Set placement ID at show time

This section covers setting a placement ID at show time for all ad formats.
Select your preferred ad formats from the following sections:

#### Banner ads

For [banner ads](https://developers.google.com/admob/android/banner.md.txt), you set the placement ID before placing the
ad view in the view hierarchy. The following example sets a placement ID for a
banner ad at show time:

### Kotlin

```kotlin
private fun showBannerView(adView: AdView, parentView: ViewGroup) {
  adView.placementId = PLACEMENT_ID
  parentView.addView(adView)
}
```

### Java

```java
public void showBannerView(AdView adView, ViewGroup parentView) {
  adView.setPlacementId(PLACEMENT_ID);
  parentView.addView(adView);
}
```

#### Full-screen ads

For full-screen ad formats, you set the placement ID before showing an ad. This
workflow applies to the following formats:

- App open: [Show the ad](https://developers.google.com/admob/android/app-open.md.txt#show-ad)
- Interstitial: [Show the ad](https://developers.google.com/admob/android/interstitial.md.txt#show_the_ad_2)
- Rewarded: [Show the ad](https://developers.google.com/admob/android/rewarded.md.txt#show_the_ad)
- Rewarded interstitial: [Show the ad](https://developers.google.com/admob/android/rewarded-interstitial.md.txt#show_the_ad_2)

The following example sets the placement ID for an interstitial ad at show
time:

### Kotlin

```kotlin
private fun showAd(activity: Activity, ad: InterstitialAd) {
  ad.placementId = PLACEMENT_ID
  ad.show(activity)
}
```

### Java

```java
private void showInterstitial(Activity activity, InterstitialAd ad) {
  ad.setPlacementId(PLACEMENT_ID);
  ad.show(activity);
}
```

#### Native ads

For
[native ads](https://developers.google.com/admob/android/native.md.txt),
you set the placement ID after you load a native ad and before registering the
ad to the ad view.

The following example sets a placement ID for a native ad at show time:

### Kotlin

```kotlin
private fun showNativeAd(nativeAdView: NativeAdView, nativeAd: NativeAd) {
  nativeAd.placementId = PLACEMENT_ID
  nativeAdView.setNativeAd(nativeAd)
}
```

### Java

```java
private void showNativeAd(NativeAdView nativeAdView, NativeAd nativeAd) {
  nativeAd.setPlacementId(PLACEMENT_ID);
  nativeAdView.setNativeAd(nativeAd);
}
```

## View placements report

After you set the placement ID, you see a report of the placement ID dimension
in the [AdMob UI](https://admob.google.com). To view the report, follow
[View your placements](https://support.google.com/admob/answer/16837672#view).