<br />

> [!NOTE]
> **Note:** Key-value segmentation is available only for AdMob Pro users. For details, reach out to your Google account manager.

Key-value segmentation lets you define custom targeting to segment users through
an ad request. For details on key-value segmentation, such as adding a key-value
pair in the AdMob UI, see
[Add key-value segmentation to a mediation group](https://support.google.com/admob/answer/14916631).

This page guides you through implementing key-value segmentation when
configuring an ad request using Google Mobile Ads SDK for React Native.

## Before you begin

To set up key-value segmentation in your app, you must first
[add key-value segmentation to a mediation group](https://support.google.com/admob/answer/14916631).

## Attach key-value pairs to an ad request

After setting up your custom key-value pairs in the AdMob UI,
attach the pairs to an ad request in your application.

Set the
[`customTargeting`](https://developers.google.com/admob/react-native/reference/interface/AdRequest.md.txt#AdRequest.customTargeting)
property on the [`AdRequest`](https://developers.google.com/admob/react-native/reference/interface/AdRequest.md.txt) object
to a key-value record representing your custom targeting data.

The following example segments users by duration in an app:

```typescript
const daysInApp = 1;

const request: AdRequest = {
  adUnitId: AD_UNIT_ID,
  customTargeting: {
    USER_DURATION: daysInApp < 3 ? 'NEW' : 'MATURE',
  },
};
```

## Test the key-value segmentation setup

To test your implementation on custom key-value pairs, send an ad request and
check the
[response info](https://developers.google.com/admob/react-native/response-info.md.txt#response_info_details)
object. Verify that the value of the `mediation_group_name` field matches your
expected mediation group name.

The following example verifies a mediation group name in the ad response:

```json
{
  "responseId": "r6_DZtitA8Gi2OMPyKeksAI",
  ...
  "responseExtras": {
    "mediation_group_name": "Mediation group for new users"
  }
}
```