---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/target.md
  - https://ads.yandex.com/helpcenter/ru/dev/compose-multiplatform/target.md
  - https://ads.yandex.com/helpcenter/zh/dev/compose-multiplatform/target.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

<!--
Используется в Boost: boost/en/ad-monetization/dev/compose-multiplatform
-->

# Ad targeting

You can use the Yandex Mobile Ads SDK API to add extra user information. Adding context data to the request can significantly enhance the quality of advertising and increase your revenue.

## Set up targeting {#setup}

Pass user information using `AdTargeting` when you create an `AdRequest`.

You can provide the following user information:

#|
|| **Parameter** | **Description** ||
|| `age` | User's age, passed as a string (for example, `"14"`, `"18"`, and so on). ||
|| `gender` | User's gender. Possible values: `male` or `female`. ||
|| `location` | The user's location as detected by your app, passed using the `AdLocation` class.

To use location data, you must obtain the user's consent and then enable location signals with `YandexAds.setLocationTracking(true)` in the SDK. ||
|| `contextQuery` | User's search query in the app.

For instance, if the user searched for a car, this parameter might look like this: `"Buy a used car in Moscow"`. ||
|| `contextTags` | Keywords from the page the user was viewing. These can be the page's title, parts of its content, tags, and other elements.

For a page with a car search, this parameter might look like `"Buy a car"`, `"used car"`, `"in Moscow"`. ||
|#


## Targeting examples {#examples}

#### Adaptive inline and sticky banners

```kotlin
val adRequest = AdRequest(
    adUnitId = "R-M-XXXXXX-Y",
    targeting = AdTargeting(
        age = "20",
        contextQuery = "context-query",
        contextTags = listOf("context-tag"),
        gender = "female",
        location = AdLocation(latitude = 55.734202, longitude = 37.588063, accuracy = 0.1),
    ),
)
```

##### Interstitial ads, rewarded ads, and app open ads

```kotlin
val adRequest = AdRequest(
    adUnitId = "R-M-XXXXXX-Y",
    targeting = AdTargeting(
        age = "20",
        contextQuery = "context-query",
        contextTags = listOf("context-tag"),
        gender = "female",
        location = AdLocation(latitude = 55.734202, longitude = 37.588063, accuracy = 0.1),
    ),
)
```
